Re: U-boot on RPI3, sees disk but won't boot it

From: Mark Millard <marklmi_at_yahoo.com>
Date: Wed, 21 Sep 2022 16:17:31 UTC
On 2022-Sep-21, at 08:42, bob prohaska <fbsd@www.zefox.net> wrote:

> On Mon, Sep 19, 2022 at 05:26:08PM -0700, Mark Millard wrote:
>> 
>> U-Boot resets the bus, re-enumerates the  devices, etc. This
>> can time out or otherwise fail despite prior activity by the
>> RPi* firmware that managed to use the device.
>> 
>> My NVMe USB SSD media have such issues with RPI4B's, also
>> getting 0 found in U-Boot. This is why I build U-Boot using
>> the patch:
>> 
>> # more /usr/ports/sysutils/u-boot-rpi-arm64/files/patch-include_configs_rpi.h 
>> --- include/configs/rpi.h.orig  2022-01-22 06:03:55.862541000 -0800
>> +++ include/configs/rpi.h       2022-01-22 06:03:05.435341000 -0800
>> @@ -210,6 +210,8 @@
>> 	ENV_DEVICE_SETTINGS \
>> 	ENV_DFU_SETTINGS \
>> 	ENV_MEM_LAYOUT_SETTINGS \
>> +	"usb_pgood_delay=2000\0" \
>> +	"usb_ready_retry=5\0" \
>> 	BOOTENV
>> 
>> 
>> 
> 
> You're using u-boot-rpi-arm64, while I've been using u-boot-rpi3.
> Does that matter? The description seems to imply not.

u-boot-rpi-arm64 works for both RPi3B and RPi4B and is what the
snapshot and release images for them are based on in modern times.
I used to have my RPi* U-Boots be based on u-boot-rpi3 and
u-boot-rpi4 before u-boot-rpi-arm64 was created and used for
snapshots and releases. But I changed to track the actively
used variant as the basis for my builds and installs of
U-Boot for the aarch64 RPi*'s.

But I still have the same patch in place for u-boot-rpi3 and for
u-boot-rpi4 :

# more /usr/ports/sysutils/u-boot-rpi3/files/patch-include_configs_rpi.h
--- include/configs/rpi.h.orig  2022-01-22 06:03:55.862541000 -0800
+++ include/configs/rpi.h       2022-01-22 06:03:05.435341000 -0800
@@ -210,6 +210,8 @@
	ENV_DEVICE_SETTINGS \
	ENV_DFU_SETTINGS \
	ENV_MEM_LAYOUT_SETTINGS \
+	"usb_pgood_delay=2000\0" \
+	"usb_ready_retry=5\0" \
	BOOTENV
 
 
# more /usr/ports/sysutils/u-boot-rpi4/files/patch-include_configs_rpi.h
--- include/configs/rpi.h.orig  2022-01-22 06:03:55.862541000 -0800
+++ include/configs/rpi.h       2022-01-22 06:03:05.435341000 -0800
@@ -210,6 +210,8 @@
	ENV_DEVICE_SETTINGS \
	ENV_DFU_SETTINGS \
	ENV_MEM_LAYOUT_SETTINGS \
+	"usb_pgood_delay=2000\0" \
+	"usb_ready_retry=5\0" \
	BOOTENV
 
 
For my boot media, all 3 U-Boots need the patch. For RPi4B's in
my context, the turbo status is needed for both RPi4B U-Boot
variants. (Unsure for RPi3B's.)

>> #1:
>> 
>> I'm unsure if this applies to more than RPi4B's and the like . . .
>> 
>> Booting an RPi* can have the clock speed(s) vary during booting
>> and this can mess up timeouts/waits/etc. during booting, timing
>> too early, for example. I use one of:
>> 
>> init_turbo=60 # or other sufficient number of seconds
>> 
>> or, if I'm always after turbo mode for general operation,
>> 
>> force_turbo=1
>> 
>> in config.txt to avoid the failure.
>> 
> 
> A few experiments with either (but not both)
> initial_turbo=60 [spelling per rpi docs, hope that's right] or
> force_turbo=1 
> didn't have obvious effect. Sometimes found disk, sometimes didn't.

As I said, I had problems unless both the patch and
the turbo status were in place --but on RPi4B's. I
do not actively use a RPi3B but do have access to
one.

If needed I could at some point try the RPi3B via a
powered hub being involved.

> For what it's worth, I've been using a timeout file, essentially out
> of habit. Renaming it to no.timeout seems to have no obvious effect. 
> It's unclear to me if timeout affects both firmware and u-boot, or
> just firmware. 

I also have and leave in place the timeout file. But I've
not tried to determine if it was necessary for the RPi4B's
in some time. Having it just means one fewer thing to
deal with possibly contributing.

> 
> 
>> On the RPi4B's I have to boot based on both #0 and #1 being
>> in place. Either not being in place can lead to the 0 found
>> status.
>> 
>> A powered hub being involved adds complications not invovled
>> in my context.
>> 
> 
> It might be possible to boot without the powered hub, seems to
> me it has worked in the past. I'll give that a try again.

I seem to remember discussions of startup current requirements
for some spinning rust in your RPi3B context. (The power
situation for RPi4B's is far less problematical.)

>> 
>> What the RPi* firmware does to get U-Boot in place is not
>> used by U-Boot for its activity. The RPi* firmware need
>> not work the same as U-Boot, allowing for differing results.
>> 
> 
> Ahh, I thought u-boot inherited at least some environmental
> details from the firmware. Thanks for the clarification!

Resetting the bus and reenumating the media is how the
not-found status happens. That is what the block of output
from U-Boot is about for the 0 found message (and somewhat
before).

>> I warn that my notes above are based on RPi4B activity, not
>> RPi3B use. Also, no power hub use is involved. How much
>> applies to your context is a valid question.
> 



===
Mark Millard
marklmi at yahoo.com