Hi Andrew,

On 10/28/26 3:15 PM, Anders Roxell wrote:
Hi,

This is part two of two. It applies on top of part one [1], which resets
the DWC3 driver and imports it up to Linux v6.16. Part one alone breaks
the build for every board that enables DWC3. This part adds back the
U-Boot glue, the XHCI and UDC updates and the build fixes, so the tree
builds and the gadget works again. It builds on Jerome's work [2].

The two parts have to go in together. Part one changed too this time, so
I resend both as v10.

The resynced epautoconf matches endpoints on their caps field instead of
on their name. Five UDC drivers never filled that in, so each one gets a
patch next to its other fixup: at91_udc, atmel_usba_udc, ci_udc, musb-new
and mtu3. With those and dwc2, every UDC driver in the tree sets caps.

Build tested one board per driver: every DWC3 glue layer in the tree,
dwc3 on riscv (spacemit_k1), dwc2 with and without DM_USB_GADGET,
at91_udc, atmel_usba_udc, ci_udc, musb-new, mtu3 and am335x_evm. 19
boards, no warnings.

Tested on hardware, per vendor:

- AMD/Xilinx: Love tested and sent a Tested-by.
- TI: DFU and ums on BeagleBoard-X15 (me), and on AM62p and BeaglePlay
   (Anshul).
- NXP: ci_udc with ums on an i.MX93 board (me).
- Amlogic: gadget and host on Khadas VIM3 (Mattijs).
- Rockchip: host on RK3588 Tiger and RK3399 Puma (Quentin).

The rest is build tested only.

Two things are still open.

Anshul sees a single "unknown endpoint event 0" line on AM62p during
enumeration. Siddharth ran mainline with a debug print and did not see
it there. I asked for the raw event value with this series. No answer
yet.

On RK3588 Tiger, Quentin got "WARN endpoint is halted" and a failed usb
write on one port. The resynced core clears SUSPHY when it puts a DRD
controller in host mode, and nothing sets it again. The last patch fixes
that. It is not tested on that board, so I do not know yet if this
was the cause.

The branch has both parts [3].

[1] part one, subject: [PATCH v10 00/63] usb: dwc3: part 1, reset and
     import from Linux v6.16
[2] Jerome's adaptation work: 
https://lore.kernel.org/all/[email protected]/
[3] https://github.com/roxell/u-boot/tree/usb_dwc3_sync_v10
[4] v9 part two: 
https://lore.kernel.org/u-boot/[email protected]/


The following three paragraphs are copied over from v9 (and slightly adapted), just so you don't have to go fishing on the older version for context.

I applied both series on top of current main (3973f3c4d24d ("Merge branch 'qcom-main' of https://git.u-boot-project.org/u-boot/custodians/u-boot-snapdragon";)) and tested on RK3588 Tiger (three DWC3 controllers exposed) and RK3399 Puma (two DWC3 controllers exposed). For each board, one of the DWC3 is routed to a micro-USB OTG port which doesn't seem to work (before or after your patch). Considering it's historically finicky in Linux, I wouldn't read too much into this.

Tests are performed like this: I insert one stick in a port and power reset (turning off/on the power supply) the board and run the commands. Tests for different ports for the same boards are run with a power reset (turning off/on the power supply) in-between tries. If you want some other tests or a different test procedure, I can do that too. I've stopped pressing the Reset button and instead handled the power reset at the power supply directly, because tests were not stable and had a bunch of USB issues (when testing your series, I didn't try to see if it also happened on main). Reading the schematics, I believe the USB ports are kept powered when I press the Reset button and I guess something doesn't like that (either the USB sticks, the SoC, both, who knows).

Some information about the HW routing for those boards. RK3588 Tiger directly routes individual USB ports to separate controllers. RK3399 Puma has a dedicated DWC3 controller for its micro-USB USB3 OTG port, the second DWC3 controller is routed to an onboard USB hub that provides two USB3 ports and two USB2 ports (one exposed on the carrierboard, the other one used for our onboard USB/CAN adapter).

The commands I ran are: usb reset && usb tree && random $loadaddr 0x8000 && mw.q $kernel_addr_r 0xffffffffffffffff 0x1000 && usb dev 0 && usb write $loadaddr 0 0x40 && usb read $kernel_addr_r 0 0x40 && cmp.q $loadaddr $kernel_addr_r 0x1000

I tested twice each scenario, both from main and with your 2 series applied:
- Q7 USB P0 (lower) with Sandisk Ultra Flair USB stick,
- Q7 USB P2 (upper) with Sandisk Ultra Flair USB stick,
- Q7 USB P0 (lower) with Kingston USB stick,
- Q7 USB P2 (upper) with Kingston USB stick,
- Q7 USB P0 (lower) with Sandisk Extreme Pro USB stick,
- Q7 USB P2 (upper) with Sandisk Extreme Pro USB stick,

RK3399 Puma behaves the same in main and with your series applied.
RK3588 Tiger has some regressions.

Q7 USB P2 (upper) doesn't detect the Sandisk Ultra Flair USB stick anymore. It does on main branch, but on the USB2 controller only.

Q7 USB P0 (lower) has issues handling the Kingston USB stick. 1st try:

=> run usbtest
resetting USB...
USB EHCI 1.00
USB OHCI 1.0
USB EHCI 1.00
USB OHCI 1.0
USB XHCI 1.10
USB XHCI 1.10
Bus usb@fc800000: 1 USB Device(s) found
Bus usb@fc840000: 1 USB Device(s) found
Bus usb@fc880000: 1 USB Device(s) found
Bus usb@fc8c0000: 1 USB Device(s) found
Bus usb@fcd00000: 1 USB Device(s) found
Bus usb@fc400000: 2 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
USB device tree:
  1  Hub (480 Mb/s, 0mA)
     u-boot EHCI Host Controller

  1  Hub (12 Mb/s, 0mA)
      U-Boot Root Hub

  1  Hub (480 Mb/s, 0mA)
     u-boot EHCI Host Controller

  1  Hub (12 Mb/s, 0mA)
      U-Boot Root Hub

  1  Hub (5 Gb/s, 0mA)
     U-Boot XHCI Host Controller

  1  Hub (5 Gb/s, 0mA)
  |  U-Boot XHCI Host Controller
  |
  +-2  Mass Storage (5 Gb/s, 126mA)
       Kingston DataTraveler 3.0 1C6F654E48EBB161D95D8F07

32768 bytes filled with random data

Device 0: Vendor: Kingston Rev: PMAP Prod: DataTraveler 3.0
            Type: Removable Hard Disk
            Capacity: 14784.0 MB = 14.4 GB (30277632 x 512)
... is now current device

usb write: device 0 block # 0, count 64 ... Resetting EP 3...
WARN endpoint is halted
Resetting EP 3...
WARN endpoint is halted
WARN endpoint is halted
Resetting EP 3...
WARN endpoint is halted
WARN endpoint is halted
WARN endpoint is halted
WARN endpoint is halted
0 blocks written: ERROR

2nd try:
=> run usbtest
resetting USB...
USB EHCI 1.00
USB OHCI 1.0
USB EHCI 1.00
USB OHCI 1.0
USB XHCI 1.10
USB XHCI 1.10
Bus usb@fc800000: 1 USB Device(s) found
Bus usb@fc840000: 1 USB Device(s) found
Bus usb@fc880000: 1 USB Device(s) found
Bus usb@fc8c0000: 1 USB Device(s) found
Bus usb@fcd00000: 1 USB Device(s) found
Bus usb@fc400000: 2 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
USB device tree:
  1  Hub (480 Mb/s, 0mA)
     u-boot EHCI Host Controller

  1  Hub (12 Mb/s, 0mA)
      U-Boot Root Hub

  1  Hub (480 Mb/s, 0mA)
     u-boot EHCI Host Controller

  1  Hub (12 Mb/s, 0mA)
      U-Boot Root Hub

  1  Hub (5 Gb/s, 0mA)
     U-Boot XHCI Host Controller

  1  Hub (5 Gb/s, 0mA)
  |  U-Boot XHCI Host Controller
  |
  +-2  Mass Storage (5 Gb/s, 126mA)
       Kingston DataTraveler 3.0 1C6F654E48EBB161D95D8F07

32768 bytes filled with random data

Device 0: Vendor: Kingston Rev: PMAP Prod: DataTraveler 3.0
            Type: Removable Hard Disk
            Capacity: 14784.0 MB = 14.4 GB (30277632 x 512)
... is now current device

usb write: device 0 block # 0, count 64 ... Resetting EP 3...
WARN endpoint is halted
WARN endpoint is halted
WARN endpoint is halted
WARN endpoint is halted
WARN endpoint is halted
Resetting EP 3...
WARN endpoint is halted
WARN endpoint is halted
WARN endpoint is halted
WARN endpoint is halted
WARN endpoint is halted
WARN endpoint is halted
WARN endpoint is halted
Resetting EP 3...
WARN endpoint is halted
WARN endpoint is halted
WARN endpoint is halted
WARN endpoint is halted
0 blocks written: ERROR

Cheers,
Quentin

Reply via email to