Snapshot stable/13-n252734-56533712694 and RPi4B: I had to add the likes of initial_turbo=60 to config.txt to boot from USB3

From: Mark Millard <marklmi_at_yahoo.com>
Date: Mon, 17 Oct 2022 17:55:13 UTC
After dd'ing:

FreeBSD-13.1-STABLE-arm64-aarch64-RPI-20221014-56533712694-252734.img

to the USB3 media attempting to boot from the media consistently
got (note the uhub_reattach_port USB_ERR_TIMEOUT lines):

. . .
Release APs...done
uhub0: 5 ports with 4 removable, self powered
Trying to mount root from ufs:/dev/ufs/rootfs [rw]...
ugen0.2: <vendor 0x2109 USB2.0 Hub> at usbus0
uhub1 on uhub0
uhub1: <vendor 0x2109 USB2.0 Hub, class 9/0, rev 2.10/4.21, addr 1> on usbus0
Root mount waiting for: usbus0
uhub1: 4 ports with 4 removable, self powered
Root mount waiting for: usbus0
uhub_reattach_port: port 2 reset failed, error=USB_ERR_TIMEOUT
uhub_reattach_port: device problem (USB_ERR_TIMEOUT), disabling port 2
ugen0.3: <Realtek USB 10/100/1000 LAN> at usbus0
ure0 on uhub0
ure0: <Realtek USB 10/100/1000 LAN, class 0/0, rev 3.00/30.00, addr 2> on usbus0
mountroot: waiting for device /dev/ufs/rootfs...
miibus1: <MII bus> on ure0
rgephy0: <RTL8251/8153 1000BASE-T media interface> PHY 0 on miibus1
rgephy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto
ue0: <USB Ethernet> on ure0
ue0: Ethernet address: ***REDACTED***
Mounting from ufs:/dev/ufs/rootfs failed with error 19.

Loader variables:
  vfs.root.mountfrom=ufs:/dev/ufs/rootfs
  vfs.root.mountfrom.options=rw

Manual root filesystem specification:
  <fstype>:<device> [options]
      Mount <device> using filesystem <fstype>
      and with the specified (optional) option list.

    eg. ufs:/dev/da0s1a
        zfs:zroot/ROOT/default
        cd9660:/dev/cd0 ro
          (which is equivalent to: mount -t cd9660 -o ro /dev/cd0 /)

  ?               List valid disk boot devices
  .               Yield 1 second (for background tasks)
  <empty line>    Abort manual input

mountroot> ?

So I updated config.txt to (shown from after a
successful boot):

# more /boot/msdos/config.txt 
[all]
arm_64bit=1
dtparam=audio=on,i2c_arm=on,spi=on
dtoverlay=mmc
dtoverlay=disable-bt
device_tree_address=0x4000
kernel=u-boot.bin

[pi4]
#hdmi_safe=1
armstub=armstub8-gic.bin
#
# Local addition that avoids USB3 SSD boot failures that look like:
#   uhub_reattach_port: port ? reset failed, error=USB_ERR_TIMEOUT
#   uhub_reattach_port: device problem (USB_ERR_TIMEOUT), disabling port ?
initial_turbo=60

That was in order to boot from USB3, no microsd card
involved. I've not tried to find an approximately-minimal
initial_turbo value. force_turbo=1 likely would also work,
as would other forms of clock rate controls in config.txt .

It appears that FreeBSD is sensitive to variations in the
clock rates during booting but the RPi* firmware can (and
does) vary relevant clock rates unless it is told not to in
some way (initial_turbo use here, there are other ways).
Something is needed to avoid timing out too soon.

Note: The media is not my USB3 media that requires the likes
of usb_pgood_delay for U-Boot in order for U-Boot to find the
device. An unmodified/default u-boot.bin works with the media
just fine. Only the later FreeBSD activity has a problem.

For reference, from the successful boot after the change:

. . .
Release APs...done
Trying to mount root from ufs:/dev/ufs/rootfs [rw]...
uhub0: 5 ports with 4 removable, self powered
ugen0.2: <vendor 0x2109 USB2.0 Hub> at usbus0
uhub1 on uhub0
uhub1: <vendor 0x2109 USB2.0 Hub, class 9/0, rev 2.10/4.21, addr 1> on usbus0
Root mount waiting for: usbus0
uhub1: 4 ports with 4 removable, self powered
Root mount waiting for: usbus0
usb_msc_auto_quirk: UQ_MSC_NO_GETMAXLUN set for USB mass storage device OWC Envoy Pro mini (0x1e91:0xa2a5)
ugen0.3: <OWC Envoy Pro mini> at usbus0
umass0 on uhub0
umass0: <OWC Envoy Pro mini, class 0/0, rev 3.00/1.00, addr 2> on usbus0
umass0:  SCSI over Bulk-Only; quirks = 0x0100
umass0:0:0: Attached to scbus0
da0 at umass-sim0 bus 0 scbus0 target 0 lun 0
da0: <OWC Envoy Pro mini 0> Fixed Direct Access SPC-4 SCSI device
da0: Serial Number ***REDACTED***
da0: 400.000MB/s transfers
da0: 228936MB (468862128 512 byte sectors)
da0: quirks=0x2<NO_6_BYTE>
ugen0.4: <Realtek USB 10/100/1000 LAN> at usbus0
ure0 on uhub0
ure0: <Realtek USB 10/100/1000 LAN, class 0/0, rev 3.00/30.00, addr 3> on usbus0
Warning: no time-of-day clock registered, system time will not be set accurately
Dual Console: Serial Primary, Video Secondary
miibus1: <MII bus> on ure0
rgephy0: <RTL8251/8153 1000BASE-T media interface> PHY 0 on miibus1
rgephy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto
ue0: <USB Ethernet> on ure0
ue0: Ethernet address: ***REDACTED***
Setting hostuuid: 30303031-3030-3030-3265-373238346338.
Setting hostid: 0xd2f9b0de.
Starting file system checks:
/dev/ufs/rootfs: FILE SYSTEM CLEAN; SKIPPING CHECKS
/dev/ufs/rootfs: clean, 498385 free (1281 frags, 62138 blocks, 0.1% fragmentation)
. . .

===
Mark Millard
marklmi at yahoo.com