How to reset USB port

I have a RockPi 4B

I noticed that following a reboot (cold or hot), sometimes the USB devices plugged into the USB port does not work any more. lsusb shows that no devices are connected to the port. To get it working I need to un-plug and re-plug the USB device, which always works after the system boots. But if I leave the device plugged in, even if I reboot many times, it may or may not connect.

I am using Debian 11, with https://radxa-repo.github.io/bsp/ compiled latest u-boot and stable linux headers.

I applied u-boot-latest_2023.10-1_arm64.deb and the linux stable .deb files.

Can anyone tell me why, and how can I reset the port / USB hub controller programmatically?

successful connects on boot:
[ 0.587765] usbcore: registered new interface driver usbfs
[ 0.587967] usbcore: registered new interface driver hub
[ 0.588118] usbcore: registered new device driver usb
[ 4.963470] usbcore: registered new interface driver usbhid
[ 4.963518] usbhid: USB HID core driver
[ 5.292753] usb usb2: We don’t know the algorithms for LPM for this host, disabling LPM.
[ 5.376947] usb usb4: We don’t know the algorithms for LPM for this host, disabling LPM.
[ 5.395698] ehci-platform fe380000.usb: EHCI Host Controller
[ 5.395823] ehci-platform fe380000.usb: new USB bus registered, assigned bus number 5
[ 5.396244] ehci-platform fe380000.usb: irq 58, io mem 0xfe380000
[ 5.402684] ehci-platform fe3c0000.usb: EHCI Host Controller
[ 5.402879] ehci-platform fe3c0000.usb: new USB bus registered, assigned bus number 6
[ 5.403312] ehci-platform fe3c0000.usb: irq 59, io mem 0xfe3c0000
[ 5.404660] ohci-platform fe3a0000.usb: Generic Platform OHCI controller
[ 5.404754] ohci-platform fe3a0000.usb: new USB bus registered, assigned bus number 7
[ 5.405167] ohci-platform fe3a0000.usb: irq 60, io mem 0xfe3a0000
[ 5.411303] ehci-platform fe380000.usb: USB 2.0 started, EHCI 1.00
[ 5.413269] ohci-platform fe3e0000.usb: Generic Platform OHCI controller
[ 5.416724] ohci-platform fe3e0000.usb: new USB bus registered, assigned bus number 8
[ 5.417117] ohci-platform fe3e0000.usb: irq 71, io mem 0xfe3e0000
[ 5.431097] ehci-platform fe3c0000.usb: USB 2.0 started, EHCI 1.00
[ 6.926946] usb 6-1: new high-speed USB device number 2 using ehci-platform
[ 18.966667] usbcore: registered new interface driver snd-usb-audio

Unsuccessful connects on boot
[ 0.585399] usbcore: registered new interface driver usbfs
[ 0.585584] usbcore: registered new interface driver hub
[ 0.585740] usbcore: registered new device driver usb
[ 5.042243] usbcore: registered new interface driver usbhid
[ 5.042542] usbhid: USB HID core driver
[ 5.370442] usb usb2: We don’t know the algorithms for LPM for this host, disabling LPM.
[ 5.455326] usb usb4: We don’t know the algorithms for LPM for this host, disabling LPM.
[ 5.474277] ehci-platform fe380000.usb: EHCI Host Controller
[ 5.474399] ehci-platform fe380000.usb: new USB bus registered, assigned bus number 5
[ 5.474807] ehci-platform fe380000.usb: irq 58, io mem 0xfe380000
[ 5.481308] ehci-platform fe3c0000.usb: EHCI Host Controller
[ 5.481455] ehci-platform fe3c0000.usb: new USB bus registered, assigned bus number 6
[ 5.481843] ehci-platform fe3c0000.usb: irq 59, io mem 0xfe3c0000
[ 5.482644] ohci-platform fe3a0000.usb: Generic Platform OHCI controller
[ 5.482677] ohci-platform fe3a0000.usb: new USB bus registered, assigned bus number 7
[ 5.482842] ohci-platform fe3a0000.usb: irq 60, io mem 0xfe3a0000
[ 5.489472] ehci-platform fe380000.usb: USB 2.0 started, EHCI 1.00
[ 5.492496] ohci-platform fe3e0000.usb: Generic Platform OHCI controller
[ 5.493817] ohci-platform fe3e0000.usb: new USB bus registered, assigned bus number 8
[ 5.494414] ohci-platform fe3e0000.usb: irq 71, io mem 0xfe3e0000
[ 5.505053] ehci-platform fe3c0000.usb: USB 2.0 started, EHCI 1.00
[ 5.761159] usb 6-1: new high-speed USB device number 2 using ehci-platform
[ 11.133092] usb 6-1: device descriptor read/64, error -110
[ 21.637094] usb 6-1: device descriptor read/64, error -71
[ 21.873096] usb 6-1: new high-speed USB device number 3 using ehci-platform
[ 22.033097] usb 6-1: device descriptor read/64, error -71
[ 22.301098] usb 6-1: device descriptor read/64, error -71
[ 22.409230] usb usb6-port1: attempt power cycle
[ 22.821097] usb 6-1: new high-speed USB device number 4 using ehci-platform
[ 23.253090] usb 6-1: device not accepting address 4, error -71
[ 23.381098] usb 6-1: new high-speed USB device number 5 using ehci-platform
[ 23.813090] usb 6-1: device not accepting address 5, error -71
[ 23.813965] usb usb6-port1: unable to enumerate USB device
[ 24.212919] usb 8-1: new full-speed USB device number 2 using ohci-platform
[ 24.412900] usb 8-1: device descriptor read/64, error -62
[ 24.712986] usb 8-1: device descriptor read/64, error -62
[ 25.008904] usb 8-1: new full-speed USB device number 3 using ohci-platform
[ 25.200962] usb 8-1: device descriptor read/64, error -62
[ 25.501031] usb 8-1: device descriptor read/64, error -62
[ 25.609195] usb usb8-port1: attempt power cycle
[ 25.829178] usb 8-1: new full-speed USB device number 4 using ohci-platform
[ 26.245023] usb 8-1: device not accepting address 4, error -62
[ 26.432901] usb 8-1: new full-speed USB device number 5 using ohci-platform
[ 26.848988] usb 8-1: device not accepting address 5, error -62
[ 26.849917] usb usb8-port1: unable to enumerate USB device

Can you tell me the hardware version the ROCK 4B you have? And please also tell me the image you use now.

Hi, ROCK PI 4 v1.52, RK3399, the default Debian 10 OS does not boot on this version
(https://github.com/radxa-build/rock-pi-4b/releases/download/main-df04b3af/rockpi-4b-debian-buster-xfce4-arm64-20220401-0335-gpt.img.xz)
so I used default Debian 11 OS (https://github.com/radxa-build/rock-pi-4b/releases/download/20230427-1720/rock-pi-4b_debian_bullseye_kde_b30.img.xz), and noticed the same issue with and without the update to the u-boot.

The linux 6.1 system for rock-4b is coming out soon, you can wait for this new release, or try the rock 4se 5.10 image: https://github.com/radxa-build/rock-4se/releases/download/b38/rock-4se_debian_bullseye_kde_b38.img.xz.

Ok I will try that tomorrow, can you tell me roughly when the 6.1 for rock-4b is coming?

For 6.1, you can follow the merging of u-boot and kernel.

Hi, I tried the rock 4se 5.10 image and it has the same issue. After the device boots, I can plug / remove / plug it many times and it always initializes properly. I suspect maybe the Depth Sensor takes too long to initialize at the beginning when the board is first powered. Is it possible to restart the USB interface / delay starting the USB interface until the system initializes for 20 seconds?