Re: Rock64 vs. USB3 for 14.0-ALPHA2 's Rock64 snapshot vs. device tree update(?)

From: Mark Millard <marklmi_at_yahoo.com>
Date: Sun, 20 Aug 2023 19:08:02 UTC
On Aug 20, 2023, at 11:08, Guy Yur <guyyur@gmail.com> wrote:

> Hi,

Hello.

>> On Sun, Aug 20, 2023 at 6:15 PM Mark Millard <marklmi@yahoo.com> wrote:
>> On Aug 20, 2023, at 06:50, Guy Yur <guyyur@gmail.com> wrote:
>> 
>> 
>> > On Sun, Aug 20, 2023 at 9:57 AM Mark Millard <marklmi@yahoo.com> wrote:
>> > If I interpret my experiments correctly, 14.0-ALPHA2 no longer
>> > supports the Rock64 USB3 port. This might be a side effect of
>> > importing more modern device tree source files from Linux. (At
>> > least one past import had such an issue for the Rock64, if I
>> > remember correctly.)
>> > 
>> > Hi,
>> > 
>> > Does u-boot see the XHCI controller?
>> 
>> U-Boot has never seen the XHCI controller in all the years that
>> I've used it. The FreeBSD kernel was the first stage that saw the
>> XHCI controller. Relative to booting the Rock64, the stages
>> that I've used are:
>> 
>> A) microsd card with U-Boot.
>> 
>> B) an e.MMC with 2 file systems:
>> 
>> B0) an msdosfs with a FreeBSD dtb/ copy and
>>      EFI/BOOT/bootaa64.efi .
>> 
> 
> I boot from sdcard with msdosfs partition with EFI/BOOT/bootaa64.efi and the dtb in rockchip/ dir in the partition.
> I tested renaming the rockchip dir so the dtb won't be found and there was still a device tree provided.
> seen in devinfo and ofwdump.

Back when I established my structure (long ago) this provided
U-Boot's translation of its *.dtb --which did not work for
FreeBSD purposes at the time. FreeBSD's Rock64 related updates
have been based on tracking upstream linux at some point.
Doing what I did got the FreeBSD *.dtb that FreeBSD expected
(at the time. anyway).

>> B1) a UFS with a (recursive) copy of /boot
>>      and an /etc/hostid . The /boot/loader.conf
>>      has: vfs.root.mountfrom="ufs:/dev/gpt/Rock64root"
>>      (I avoid copying /boot/entropy to the e.MMC .)
>> 
>> C) /dev/gpt/Rock64root has the UFS file system for the
>>     world (with the kernel materials too) and is on
>>     the USB3 media that I use.
>> 
>> (I have the media set up to also boot aarch64 RPi* .)
>> 
>> 14.0-ALPHA2 loads and starts the kernel from the e.MMC
>> just fine. But that kernel does not see what is in the
>> USB3 port. It does see the same when instead in the
>> other USB ports. Previously used to see the USB3 media
>> in the USB3 port just fine and boot world from the USB3
>> media.
>> 
>> > I had to backport u-boot changes to sysutils/u-boot-rock64
>> > (sysutils/u-boot-master) 2023.07.02 to get it working in
>> > u-boot and 14.0-ALPHA1 for Rock64 and Orange Pi R1 Plus.
>> 
>> I've never gone the route of changing U-Boot to handle
>> the USB3 port.
>> 
>> > I took the following (I don't know if all are needed):
>> > https://source.denx.de/u-boot/u-boot/-/commit/caaeac88466f4152bd126e2342765a4b740955ae
>> > https://source.denx.de/u-boot/u-boot/-/commit/b71f74eab42782199757e146483126aee5e3c271
>> > https://source.denx.de/u-boot/u-boot/-/commit/559911ff2ed09812fc0a87513183a44d9ee100cf
>> > https://source.denx.de/u-boot/u-boot/-/commit/185571b6ec301cd228cb059326e51fb51e76e816
>> > https://source.denx.de/u-boot/u-boot/-/commit/5d334b70cce1d8299202d247011b609faeb8e583
>> > https://source.denx.de/u-boot/u-boot/-/commit/9aa93d84038bb47bcd4e9ac4287ef63e1b022971
>> > https://source.denx.de/u-boot/u-boot/-/commit/c0165258582078c206faca352b0f63ccdf535ce7
>> > https://source.denx.de/u-boot/u-boot/-/commit/b6fd3c63f4c5ba8cad518fa34e6a3289a6976f2e
>> 
>> Intersting. Thanks.
> 
> I did some more testing.
> It seems that rock64 u-boot 2023.07.02 uses an embedded device tree and passes it to the kernel.
> The device-tree in the EFI partition is ignored.
> 
> The device tree is a merge of rk3328-rock64.dts and rk3328-rock64-u-boot.dtsi
> and since both rk3328-u-boot.dtsi and rk3328.dtsi have usb@ff600000,
> the u-boot.dtsi version with compatible of "rockchip,rk3328-xhci" is used instead
> of "rockchip,rk3328-dwc3" which the FreeBSD kernel knows.
> 
> b71f74eab42782199757e146483126aee5e3c271 may be enough for FreeBSD to see the controller.

I do not know if the Rock64 related support will continue to
be updated to track the linux upstream updates or not. (If not,
then likely snapshots and releases for Rock64 would stop.)

As stands I do not plan on going down a path that might not
be what FreeBSD ends up with for Rock64 related support if
it is updated. For now, I've just put the Rock64 to the side.
But I'm keeping copies of your notes.

>> > For Orange Pi R1 Plus I also needed the patch adding it:
>> > https://source.denx.de/u-boot/u-boot/-/commit/69e16c7b1cdd03907b86bb31abee24f5d4836400
>> > 
>> > Unfortunately, there is some issue with the XHCI controller, at list with
>> > Realtek RTL8153 USB nic (built in on R1 Plus and tested external card
>> > plugged into Rock64) so it might have issues for other USB devices too.
>> > The nic doesn't work until the USB bus is reset and can get stuck again.
>> > It didn't work on 13.x either.
>> 
>> I've not historically had Rock64 Ethernet problems.
> 
>  The problem I have is when connecting a USB ethernet card to Rock64 USB 3.0 port.
> The internal ethernet works fine.

As I had world on the USB3, having an EtherNet dongle there
is not something that I've tried.

===
Mark Millard
marklmi at yahoo.com