Rock Pi S with kernel 6.6 "latest", crashing with USB OTG connection

Hi, I have the latest kernel 6.6 compiled with bsp + rbuild booting on Pi S OK, access via serial console and ethernet cable.

Disabled radxa-adb, enabled radxa-usbnet services, OK.

When starting the board when powered via GPIO pins 2+4/6 5V, the USB-C port in device mode is not active, connecting to a USB host initiates no enumeration. The board runs OK.

I found out that the OTG port needs to boot with 5V power via the connector to be activated. To get enough power, I am using a powered USB hub.

Pi S with kernel 6.6 boots and runs perfectly when powered via USB-C with the powered USB hub.

However, the board crashes when booting with the hub connected to USB host. It also crashes when powered directly from the USB host, no hub in between. Initially I thought the host did not provide enough power but IMO the problem is the data connection to the USB host.

When powered from powered hub disconnected from USB host (starts/runs fine), then first connection to the USB host enumerates the usb ether device configured by the radxa-usbnet script correctly. I can configure IPs, communicate over the virtual interfaces, OK. Upon disconnecting from USB host the board continues running OK. Upon second reconnecting to the USB host - immediate crash.

By crash I mean the device stops communicating. I have tailing dmesg -w open via the serial console, when the Pi S crashes no extra output in dmesg, no communication via serial console anymore.

When the Pi S boots connected to the USB host, it crashes a few secs after the login prompt appears, regardless of what/if anything gets typed on the keyboard.

When the Pi S boots disconnected from the USB host, it crashes at the very moment the USB host is connected the second time.

I use the dwc2 gadget driver on RaspberryPi4 regularly and it accepts any connecting/disconnecting of the USB host.

Please is this behavior known and is there any way to help with fixing? I would like to use the audio UAC2 gadget function which was added to mainline in 5.18., no go with the ancient 4.4.

Thanks a lot!

This is dmesg on the host when Pi S powered from the host USB. It shows that at boot the ether gadget gets enumerated and activated on the host, then after 5 seconds the gadget disconnects and re-appears. At this second enumeration the Pi S gets stuck. Actually this is identical to booting the board without USB connected (power through the disconnected USB hub) where the second connection gadget -> host crashes the board.

[10935.214742] usb 1-8: new high-speed USB device number 8 using xhci_hcd
[10935.395579] usb 1-8: New USB device found, idVendor=1d6b, idProduct=0104, bcdDevice= 1.00
[10935.395584] usb 1-8: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[10935.395586] usb 1-8: Product: OTG Utils
[10935.395588] usb 1-8: Manufacturer: Radxa
[10935.395589] usb 1-8: SerialNumber: 0123456789ABCDEF
[10935.464758] cdc_ether 1-8:1.0 usb0: register 'cdc_ether' at usb-0000:02:00.0-8, CDC Ethernet Device, 76:2c:a0:7f:22:7e
[10935.464801] usbcore: registered new interface driver cdc_ether
[10935.471082] cdc_ether 1-8:1.0 enx762ca07f227e: renamed from usb0
[10935.701400] userif-3: sent link down event.
[10935.701404] userif-3: sent link up event.                 <---- working OK
[10940.936075] usb 1-8: USB disconnect, device number 8      <----  here is the disconnection
[10940.936591] cdc_ether 1-8:1.0 enx762ca07f227e: unregister 'cdc_ether' usb-0000:02:00.0-8, CDC Ethernet Device
[10941.402627] usb 1-8: new high-speed USB device number 9 using xhci_hcd
[10946.758572] usb 1-8: device descriptor read/64, error -110  <-- device crashed
[10947.006573] usb 1-8: device descriptor read/64, error -71
[10947.246524] usb 1-8: new high-speed USB device number 10 using xhci_hcd
[10947.382565] usb 1-8: device descriptor read/64, error -71
[10947.638558] usb 1-8: device descriptor read/64, error -71
[10947.753829] usb usb1-port8: attempt power cycle
[10948.414501] usb 1-8: new high-speed USB device number 11 using xhci_hcd
[10953.214776] usb 1-8: Device not responding to setup address.
[10958.222675] usb 1-8: Device not responding to setup address.
[10958.430315] usb 1-8: device not accepting address 11, error -71
[10958.630314] usb 1-8: new high-speed USB device number 12 using xhci_hcd
[10963.430575] usb 1-8: Device not responding to setup address.
[10968.442473] usb 1-8: Device not responding to setup address.
[10968.654132] usb 1-8: device not accepting address 12, error -71
[10968.657441] usb usb1-port8: unable to enumerate USB device

The issue is fixed by recent commit https://github.com/torvalds/linux/commit/ca2dc35e555e7043de585f4e46123d8fbd2b5a21 in 6.8 rc1, even 6.6 is too old for that :slight_smile: Including that commit fixes the crash. Still disconnecting/reconnecting the USB host while Pi S being powered through a hub randomly crashes the gadget function, fixed by clearing the configfs with systemctl restart radxa-usbnet.service. I will report that to the USB mailinglist, likely not specific to Pi S.