Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Jun 2021 20:17:14 -0700
From:      Mark Millard via freebsd-arm <freebsd-arm@freebsd.org>
To:        William Carson <freebsd@dsllsn.net>
Cc:        freebsd-arm <freebsd-arm@freebsd.org>
Subject:   Re: Boot from USB on RPi4 8GB? [SOLVED]
Message-ID:  <4F6B79E1-B087-4606-A4B8-663FD85105BD@yahoo.com>
In-Reply-To: <0E3E9A40-2E56-4C49-A992-247408A88EFD@dsllsn.net>
References:  <4F3EE8D2-649B-4522-AD5A-7C308291802F@dsllsn.net> <43FAEEAC-EE36-4810-88AA-FF82AFBCC128@yahoo.com> <2F58272B-BD9C-464B-9A98-BF638971BA86@dsllsn.net> <D82CA5FE-1755-4D38-928E-B8234A4F38D4@yahoo.com> <E267DA59-F294-40D4-B2DB-4E6DF8C87DCF@yahoo.com> <FA5F90A1-0E02-4CC8-A860-38C62E0ED93E@dsllsn.net> <E1FE1FF5-809D-4136-8464-ED09501A2A8B@dsllsn.net> <DFD0AA16-2B52-4095-B12E-DB805E870A3D@yahoo.com> <0E3E9A40-2E56-4C49-A992-247408A88EFD@dsllsn.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2021-Jun-12, at 18:18, William Carson <freebsd at dsllsn.net> wrote:

> . . .
>>=20
>>> Sadly, it also would not boot from either of my NVMe-USB adapters.
>>=20
>> Is the failing behavior identical to before? If not, what
>> evidence is it now producing when trying to boot? ("would
>> not boot" leaves open all possible ways of failing.)
>>=20
>> You previously reported getting:
>>=20
>> QUOTE
>> scanning bus xhci_pci for devices... Device NOT ready
>>  Request Sense returned 02 04 01
>> END QUOTE
>>=20
>> Someone else recently was getting that and got around
>> the problem while trying 3 U-Boot extra steps. They
>> are listed below and I leave in the indication of which
>> happened to work in that context. The point is to
>> establish a configuration setting before U-Boot tries to
>> scan the USB buses looking for the storage media.
>> Otherwise a "usb reset" would need to happen after
>> making the configuration change.
>>=20
>> QUOTE
>>> Looking around on the web I see reports of the:
>>>=20
>>> Request Sense returned 02 04 01
>>>=20
>>> (and the matching Device NOT ready) mean that the
>>> problem will occur and that repeating usb start
>>> or usb reset again until it does not report that
>>> leads to things working.
>>>=20
>>> But I've also seen other, more complete information
>>> indicating that there is a environment setting
>>> (showing an example value):
>>>=20
>>> usb_ready_retry=3D5
>>>=20
>>> to set up before the usb restart (or usb start)
>>> command. It deals with the issue more explicitly
>>> for slow devices.
>>>=20
>>> Another one is (units: msec):
>>>=20
>>> usb_pgood_delay=3D10000
>>>=20
>> Presto! using editenv usb_pgood_delay prompted for input, typing =
10000
>> and hitting return set the value and the disk was found.
>>=20
>> It looks like the setting can only be saved to microSD. With
>> no card saveenv reports
>> Saving Environment to FAT... Card did not respond to voltage select!
>> Failed (1)
>>=20
>>> There are also device that have problems with
>>> large transfers and require extra protocol to
>>> deal with transfer problems before they will
>>> work again, U-Boot not doing that.
>>>=20
>>> usb_max_blk=3D20
>>>=20
>>> sets a old historical value that generally
>>> just works for such devices form what I read.
>>>=20
>>> I see no indication that other usb commands are
>>> worthwhile until one has avoided that "Request
>>> Sense returned 02 04 01" message for usb reset
>>> (a.k.a. usb start).
>>>=20
>>> The reports of this sort of thing are not limited
>>> to RPi's and go back to at least 2014.
>>>=20
>>> If I understand correctly, usb_ready_retry and
>>> usb_pgood_delay and usb_max_blk are part of
>>> normal U-Boot builds these days. But I'm not
>>> certain of that.
>>=20
>> END QUOTE
>=20
> Ok, so in the scenario of SN550 + GeekWorm + USB3, when I'm at the =
U-Boot> prompt, I did the following:
>=20
>    editenv usb_pgood_delay
>    edit: 10000
>    editenv usb_ready_retry
>    edit: 5
>    editenv usb_max_blk
>    edit: 20
>    usb reset ; run usb_boot
>=20
> And we have a successful USB3 boot all the way to the login prompt! =
Unfortunately as indicated, I could not saveenv. I'm not going to bother =
any more with the Samsung NVMes due to the power issue and not having =
any way to provide external, dedicated power to them.
>=20
> With this success, I figured I'd try adding these env values to my =
u-boot build and go back to using my crochet image. I added this patch =
to sysutils/u-boot-rpi4:
>=20
> # cat files/patch-include_configs_rpi.h
> --- include/configs/rpi.h.orig  2021-06-12 23:20:03.061510000 -0000
> +++ include/configs/rpi.h       2021-06-12 23:20:14.131306000 -0000
> @@ -209,6 +209,9 @@
>        ENV_DEVICE_SETTINGS \
>        ENV_DFU_SETTINGS \
>        ENV_MEM_LAYOUT_SETTINGS \
> +       "usb_pgood_delay=3D10000\0" \
> +       "usb_ready_retry=3D5\0" \
> +       "usb_max_blk=3D20\0" \
>        BOOTENV

I'd be surprised if all 3 assignments were required for your
specific context: likely more than what is necessary for that
context.

But it might not be worth bothering to explore for a more
minimal combination/singleton.

> I built my new image, dd'ed it to the SN550, and booted with the =
GeekWorm + USB3. I aborted the autoboot and did a printenv to confirm =
the environment variables were set. They were. I pulled the power and =
did a fresh boot, and we booted successfully all the way to the FreeBSD =
login prompt! Problem solved indeed.

Cool.

> Thank you so much for all of your help and patience, Mark. I wonder if =
maybe those defaults should be added to the u-boot-rpi4 or =
u-boot-rpi-arm64 ports? (I won't pretend to know how this might impact =
other users.)
>=20
> Oh, also, I dropped usb_pgood_delay down to 2000, which seemed common =
for other boards and worked just fine:

Again: Cool.

> -boot-2021.04/configs/teres_i_defconfig:CONFIG_PREBOOT=3D"setenv =
usb_pgood_delay 2000; usb start"
> u-boot-2021.04/include/configs/alt.h:   "usb_pgood_delay=3D2000\0"
> u-boot-2021.04/include/configs/aristainetos2.h: =
"usb_pgood_delay=3D2000\0" \
> u-boot-2021.04/include/configs/beacon-rzg2m.h:  =
"usb_pgood_delay=3D2000\0"        \
> u-boot-2021.04/include/configs/gw_ventana.h:    =
"usb_pgood_delay=3D2000\0" \
> u-boot-2021.04/include/configs/minnowmax.h:                            =
         "usb_pgood_delay=3D40\0"
> u-boot-2021.04/include/configs/nitrogen6x.h:    =
"usb_pgood_delay=3D2000\0" \
> . . .


=3D=3D=3D
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F6B79E1-B087-4606-A4B8-663FD85105BD>