Hi Xavier, On Tue, 13 Jun 2023 at 07:52, Xavier Drudis Ferran <xdru...@tinet.cat> wrote: > > Ok. New test. > > This uses yesterday morning's next branch. > commit 5b589e139620214f > Merge: cc5a940923 32d2461e04 > Merge branch 'next_net/phy_connect_dev' > > USB2 does not work for rk3399 in next (fixes are in master, thanks), > but USB3 is enough. > > I compiled for rock-pi-4-rk3399_defconfig > > flashed to a new microSD card as per doc/board/rockchip/rockchip.rst : > > dd if=u-boot-rockchip.bin of=/dev/sda seek=64 > sync > > Put this microSD card in a Rock Pi 4 B+ > Put a new USB stick in the USB3 port (center blue port closer to board). > > (the microSD card and USB stick come from factory, I guess they were > partitioned with a single FAT partition) > > (make sure emmc and spi are blank) > > Connected only serial console and power. > > Got this: > > U-Boot TPL 2023.07-rc2-00144-g497967f1ee (Jun 12 2023 - 11:15:47) > lpddr4_set_rate: change freq to 400MHz 0, 1 > Channel 0: LPDDR4, 400MHz > BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB > Channel 1: LPDDR4, 400MHz > BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB > 256B stride > lpddr4_set_rate: change freq to 800MHz 1, 0 > Trying to boot from BOOTROM > Returning to boot ROM... > > U-Boot SPL 2023.07-rc2-00144-g497967f1ee (Jun 12 2023 - 11:15:47 +0200) > Trying to boot from MMC1 > NOTICE: BL31: v2.1(release):v2.1-728-ged01e0c4-dirty > NOTICE: BL31: Built : 18:29:11, Mar 22 2022 > > > U-Boot 2023.07-rc2-00144-g497967f1ee (Jun 12 2023 - 11:15:47 +0200) > > SoC: Rockchip rk3399 > Reset cause: POR > Model: Radxa ROCK Pi 4B > DRAM: 4 GiB (effective 3.9 GiB) > PMIC: RK808 > Core: 283 devices, 29 uclasses, devicetree: separate > MMC: mmc@fe310000: 2, mmc@fe320000: 1, mmc@fe330000: 0 > Loading Environment from MMC... *** Warning - bad CRC, using default > environment > > In: serial > Out: serial > Err: serial > Model: Radxa ROCK Pi 4B > Net: eth0: ethernet@fe300000 > Hit any key to stop autoboot: 2 1 0 > rockchip_pcie pcie@f8000000: PCIe link training gen1 timeout! > Bus usb@fe380000: ehci_generic usb@fe380000: Failed to get clocks (ret=-19) > Port not available. > Bus usb@fe3c0000: ehci_generic usb@fe3c0000: Failed to get clocks (ret=-19) > Port not available. > Bus usb@fe800000: Register 2000140 NbrPorts 2 > Starting the controller > USB XHCI 1.10 > Bus usb@fe900000: Register 2000140 NbrPorts 2 > Starting the controller > USB XHCI 1.10 > scanning bus usb@fe800000 for devices... 1 USB Device(s) found > scanning bus usb@fe900000 for devices... cannot reset port 1!? > 2 USB Device(s) found > rockchip_pcie pcie@f8000000: failed to find ep-gpios property > ethernet@fe300000 Waiting for PHY auto negotiation to complete......... > TIMEOUT ! > Could not initialize PHY ethernet@fe300000 > rockchip_pcie pcie@f8000000: failed to find ep-gpios property > ethernet@fe300000 Waiting for PHY auto negotiation to complete......... > TIMEOUT ! > Could not initialize PHY ethernet@fe300000 > => printenv preboot > ## Error: "preboot" not defined > => printenv > arch=arm > baudrate=1500000 > board=evb_rk3399 > board_name=evb_rk3399 > boot_targets=mmc1 mmc0 nvme scsi usb pxe dhcp spi > > bootcmd=bootflow scan > > bootdelay=2 > cpu=armv8 > cpuid#=[something] > eth1addr=[:so:me:th:in:g] > ethact=ethernet@fe300000 > ethaddr=[:so:me:th:in:g] > fdt_addr_r=0x01f00000 > fdtcontroladdr=f1ef9170 > fdtfile=rockchip/rk3399-rock-pi-4b.dtb > fdtoverlay_addr_r=0x02000000 > kernel_addr_r=0x02080000 > kernel_comp_addr_r=0x08000000 > kernel_comp_size=0x2000000 > loadaddr=0x800800 > partitions=uuid_disk=${uuid_gpt_disk};name=loader1,start=32K,size=4000K,uuid=${uuid_gpt_loader1};name=loader2,start=8MB,size=4MB,uuid=${uuid_gpt_loader2};name=trust,size=4M,uuid=${uuid_gpt_atf};name=boot,size=112M,bootable,uuid=${uuid_gpt_boot};name=rootfs,size=-,uuid=[something]; > pxefile_addr_r=0x00600000 > ramdisk_addr_r=0x06000000 > script_offset_f=0xffe000 > script_size_f=0x2000 > scriptaddr=0x00500000 > serial#=[something] > soc=rk3399 > stderr=serial,vidconsole > stdin=serial,usbkbd > stdout=serial,vidconsole > vendor=rockchip > > Environment size: 1041/32764 bytes > => usb info > 1: Hub, USB Revision 3.0 > - U-Boot XHCI Host Controller > - Class: Hub > - PacketSize: 512 Configurations: 1 > - Vendor: 0x0000 Product 0x0000 Version 1.0 > Configuration: 1 > - Interfaces: 1 Self Powered 0mA > Interface: 0 > - Alternate Setting 0, Endpoints: 1 > - Class Hub > - Endpoint 1 In Interrupt MaxPacket 8 Interval 255ms > > 1: Hub, USB Revision 3.0 > - U-Boot XHCI Host Controller > - Class: Hub > - PacketSize: 512 Configurations: 1 > - Vendor: 0x0000 Product 0x0000 Version 1.0 > Configuration: 1 > - Interfaces: 1 Self Powered 0mA > Interface: 0 > - Alternate Setting 0, Endpoints: 1 > - Class Hub > - Endpoint 1 In Interrupt MaxPacket 8 Interval 255ms > > 2: Mass Storage, USB Revision 3.20 > - USB SanDisk 3.2Gen1 05017d2e4d7b4ea0c5822c90c51e0b7 > - Class: (from Interface) Mass Storage > - PacketSize: 512 Configurations: 1 > - Vendor: 0x0781 Product 0x5591 Version 1.0 > Configuration: 1 > - Interfaces: 1 Bus Powered 224mA > Interface: 0 > - Alternate Setting 0, Endpoints: 2 > - Class Mass Storage, Transp. SCSI, Bulk only > - Endpoint 1 In Bulk MaxPacket 1024 > - Endpoint 2 Out Bulk MaxPacket 1024 > > "Synchronous Abort" handler, esr 0x96000010, far 0x101 > elr: 000000000021c398 lr : 000000000021ca70 (reloc) > elr: 00000000f3f32398 lr : 00000000f3f32a70 > x0 : 0000000000000000 x1 : 00000000000010d1 > x2 : 00000000f1f404b8 x3 : 00000000f1f41998 > x4 : 00000000ff1a0000 x5 : 0000000000000034 > x6 : 000000000000000a x7 : 0000000000000002 > x8 : 0000000000000000 x9 : 0000000000000400 > x10: 0000000000000006 x11: 000000000001869f > x12: 0000000000000200 x13: 0000000000000000 > x14: 00000000ffffffff x15: 00000000f1ef81c3 > x16: 0000000000000000 x17: 0000000000000000 > x18: 00000000f1f0dd90 x19: 0000000000000000 > x20: 00000000f1ef8848 x21: 0000000000000002 > x22: 00000000f1ef8848 x23: 0000000000000002 > x24: 00000000f1ef8844 x25: 0000000000000000 > x26: 0000000000000000 x27: 0000000000000000 > x28: 0000000000000000 x29: 00000000f1ef86b0 > > Code: f0000460 a8c27bfd 91099000 1401e518 (39440401) > Resetting CPU ... > > resetting ... > > > > bootcmd=bootflow scan is because DISTRO_DEFAULTS is not > in configs/rock-pi-4-rk3399_defconfig > > I'd say the changes to Kconfig are in ef5e3891f57 and 2d653f686b6. > > In any case this causes > > bootflow scan > > to be called. This tries to access the media in boot_targets until it reaches > usb ( do_bootflow_scan() in cmd/bootflow.c tries mmc1, mmc0 and nvme > unsuccessfully). > > I think this adds a UCLASS_BOOTDEV device under a usb mass storage device > as sibling of a UCLASS_BLK device, and this makes usb info recurse > with a null usb_device pointer and a reset at this dereference.
Yes that's right. So 'usb info' should ignore UCLASS_BOOTDEV devices. That is better than checking for the NULL pointer. > > But I'm still reading the code to understand quite exactly how and > which are the paths. I don't understand how much of this is intendeded > and what should be prevented. Thsi is why my patch just fixed the last > consequence, tthe null pointer dereference. > > I'll keep looking when I can. Regards, Simon