U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v11 00/30] usb: dwc3: part 2, make the resynced code work
@ 2026-11-07  7:21 Anders Roxell
  2026-11-07  7:21 ` [PATCH v11 01/30] x86: asm: io.h: add rmb() and wmb() Anders Roxell
                   ` (31 more replies)
  0 siblings, 32 replies; 40+ messages in thread
From: Anders Roxell @ 2026-11-07  7:21 UTC (permalink / raw)
  To: u-boot
  Cc: marek.vasut, trini, ilias.apalodimas, michal.simek, lukma,
	alchark, jerome.forissier, dlechner, anshuld, sjg, Thinh.Nguyen,
	mkorpershoek, love.kumar, quentin.schulz, s-vadapalli,
	Anders Roxell

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 did not change, so I do
not resend it. The v10 patches [1] still apply on ab4dc5aacf95.

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), RK3588 and RK3399, dwc2 with and without
DM_USB_GADGET, at91_udc, atmel_usba_udc, ci_udc with SPL SDP, musb-new
on sunxi and in the am335x_evm SPL, and mtu3. 24 boards, no warnings.

Ilias found a few bisect gaps, so I built eight of the boards at every
patch. Gadget configs build again from patch 20, the other UDC drivers
from their own fixup patch.

Tested on hardware with v10, 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 RK3399 Puma, same as master (Quentin). RK3588
  Tiger had two regressions, see below.

Tested on hardware with v11:

- NXP: ci_udc with ums on i.MX93, chainloaded from the vendor U-Boot.
  Three ums rounds, the host read 64 MiB each time. It needs usbotg1 in
  peripheral mode.
- TI: dwc3 ums on BeagleBoard-X15, the host enumerates it at high
  speed. That is where I found the event buffer bug in patch 15.
- Rockchip: host on RK3399 Puma and RK3588 Tiger (Quentin). The two
  Tiger regressions from v10 are gone, and he sent a Tested-by:

  Tested-by: Quentin Schulz <quentin.schulz@cherry.de> # RK3399 Puma usbdrd_dwc3_1
  Tested-by: Quentin Schulz <quentin.schulz@cherry.de> # RK3588 Tiger usb_host1_xhci + usb_host2_xhci
- Rockchip: host and gadget on RK3576, a Flipper One and an RK3576 EVB1
  (Alexey). No regressions against master, and he sent a Tested-by:

  Tested-by: Alexey Charkov <alchark@flipper.net> # Rockchip RK3576

The rest is build tested only.

One thing is still open.

Anshul sees a single "unknown endpoint event 0" line on AM62p during
enumeration. I got the same line on the X15 from the event buffer bug
that patch 15 fixes. I think it is the same on AM62p, but I have not
tested it.

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/20251121153812.2076440-1-jerome.forissier@linaro.org/
[3] https://github.com/roxell/u-boot/tree/usb_dwc3_sync_v11
[4] v10 part two: https://lore.kernel.org/u-boot/20261028141554.3073545-1-anders.roxell@linaro.org/

v10 -> v11:
- Rebased on ab4dc5aacf95.
- dm helpers: device_property_count_u32() returns the count, so the
  INCR burst is set again. dev_err_probe() prints one line. Dropped the
  unused of_node and property helpers. Kept Mattijs' Reviewed-by.
  (Ilias)
- udc-core: folded in "enable async callbacks on bind" and the
  epautoconf.c include fix, so dwc3 enumerates at every commit. (Ilias)
- udc-core: IS_ENABLED(CONFIG_XPL_BUILD) instead of #ifndef
  CONFIG_SPL_BUILD. (Ilias)
- xhci-dwc3: the rename is before the dwc3 core patches, so DWC3 and
  XHCI_DWC3 link together again. Dropped the stale
  dwc3_core_soft_reset() prototype. (Ilias)
- at91_udc: the local register functions go away in the patch that
  registers with udc-core. (Ilias)
- io.h/Makefile: the message says what changed, the kernel glue comment
  is gone. (Ilias)
- core: use dwc3_core_is_valid(), and leave GSBUSCFG0 REQINFO alone like
  Linux. (Ilias)
- core: count the ports without xhci_resources. Host-only cores failed
  with -ENOMEM. (Ilias)
- core: no DT read through a NULL udevice from dwc3_uboot_init().
  (Ilias)
- core: drop dwc3_clk_disable(), the glue owns the clocks. (Ilias)
- core: free evt and evt->cache, they leaked without DEVRES. (Ilias)
- core: bring back the 100ms wait after soft reset (SC7280) and
  RUN_STOP on exit (K2). (Ilias)
- core: new patch 15, flush the event buffer after allocation. Without
  it dwc3 read old heap data as events. Found on the X15.
- gadget: keep the pullups_connected check, so a second pullup(1) does
  not reset the controller. (Ilias)
- gadget: dma_unmap_single() instead of dma_map_single() on unmap.
  Dropped the extra invalidate in giveback. (Ilias)
- gadget: flush the whole trb ring on endpoint enable, drop an unused
  variable and fix a comment. (Ilias)
- f_sdp: full speed uses the full speed descriptors again. (Ilias)
- atmel_usba_udc and musb-new: register with udc-core without
  DM_USB_GADGET too. (Ilias)
- ci_udc: give the controller back on udc_stop(). usb reset left freed
  data behind before. (Ilias)
- dwc2_udc_otg: add the gadget to udc-core only once, and only without
  DM_USB_GADGET. (Ilias)

Older changes are listed in v10 [4].

Cheers,
Anders

Anders Roxell (30):
  x86: asm: io.h: add rmb() and wmb()
  dm: add helpers needed by the resynced DWC3 code
  phy: cadence: use reset_control_assert() from reset.h
  usb: phy: add the usb_phy helpers needed by the resynced DWC3 code
  usb: gadget: adapt the gadget API after the resync
  usb: gadget: udc: make udc-core build in U-Boot
  usb: host: xhci: fix up after the resync
  usb: dwc3: core: remove the code U-Boot does not use
  usb: dwc3: core: bring back the U-Boot entry points
  usb: dwc3: core: adapt to the U-Boot APIs
  usb: dwc3: adapt io.h, the Makefile and the TI glue
  usb: dwc3: make gadget and ep0 build in U-Boot
  usb: dwc3: ep0: flush and invalidate cache around ep0 transfers
  usb: dwc3: gadget: flush and invalidate cache around transfers
  usb: dwc3: core: flush the event buffer after allocation
  usb: dwc3: make the am62 glue build in U-Boot
  usb: gadget: ci_udc: move to the udc-core registration
  usb: gadget: ci_udc: set endpoint capabilities
  usb: gadget: dwc2_udc_otg: fix up after the resync
  usb: gadget: fix up the function drivers after the resync
  usb: gadget: at91_udc: register with udc-core
  usb: gadget: atmel_usba_udc: fix up after the resync
  usb: gadget: atmel_usba_udc: set endpoint capabilities
  usb: gadget: at91_udc: set endpoint capabilities
  usb: musb-new: fix up after the resync
  usb: musb-new: set endpoint capabilities
  usb: mtu3: fix up after the resync
  usb: mtu3: set endpoint capabilities
  usb: cdns3: fix up after the resync
  usb: dwc3: enable SUSPHY again after xhci is registered

 arch/x86/include/asm/io.h                 |    2 +
 drivers/phy/cadence/phy-cadence-sierra.c  |   18 -
 drivers/phy/cadence/phy-cadence-torrent.c |    2 -
 drivers/usb/cdns3/ep0.c                   |    8 +-
 drivers/usb/dwc3/Makefile                 |   11 +-
 drivers/usb/dwc3/core.c                   | 1779 +++++----------------
 drivers/usb/dwc3/core.h                   |   41 +-
 drivers/usb/dwc3/dwc3-am62.c              |  424 +----
 drivers/usb/dwc3/dwc3-generic.c           |    8 +-
 drivers/usb/dwc3/dwc3-layerscape.c        |    8 +-
 drivers/usb/dwc3/dwc3-omap.c              |    2 -
 drivers/usb/dwc3/ep0.c                    |  117 +-
 drivers/usb/dwc3/gadget.c                 |  727 ++-------
 drivers/usb/dwc3/gadget.h                 |    4 +-
 drivers/usb/dwc3/io.h                     |   36 +-
 drivers/usb/dwc3/ti_usb_phy.c             |    2 -
 drivers/usb/gadget/at91_udc.c             |   83 +-
 drivers/usb/gadget/atmel_usba_udc.c       |  106 +-
 drivers/usb/gadget/ci_udc.c               |   92 +-
 drivers/usb/gadget/composite.c            |    2 +-
 drivers/usb/gadget/dwc2_udc_otg.c         |   89 +-
 drivers/usb/gadget/epautoconf.c           |    2 -
 drivers/usb/gadget/ether.c                |   21 +-
 drivers/usb/gadget/f_acm.c                |   20 +-
 drivers/usb/gadget/f_fastboot.c           |   10 +-
 drivers/usb/gadget/f_mass_storage.c       |    5 +-
 drivers/usb/gadget/f_rockusb.c            |   11 +-
 drivers/usb/gadget/f_sdp.c                |   12 +-
 drivers/usb/gadget/f_thor.c               |   19 +-
 drivers/usb/gadget/udc/Makefile           |    1 +
 drivers/usb/gadget/udc/udc-core.c         |  931 ++---------
 drivers/usb/host/xhci-dwc3.c              |    4 +-
 drivers/usb/mtu3/mtu3_gadget.c            |   10 +
 drivers/usb/mtu3/mtu3_gadget_ep0.c        |   16 +-
 drivers/usb/musb-new/musb_gadget.c        |   21 +-
 drivers/usb/musb-new/musb_gadget_ep0.c    |   24 +-
 drivers/usb/musb-new/musb_uboot.c         |   51 +-
 include/dm/device_compat.h                |   11 +
 include/dm/read.h                         |   43 +
 include/linux/usb/ch9.h                   |   25 +-
 include/linux/usb/dwc3.h                  |    1 -
 include/linux/usb/gadget.h                |  529 ++----
 include/linux/usb/phy.h                   |   57 +
 include/reset.h                           |   16 +
 44 files changed, 1383 insertions(+), 4018 deletions(-)

-- 
2.53.0


^ permalink raw reply	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2026-11-12 13:21 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-07  7:21 [PATCH v11 00/30] usb: dwc3: part 2, make the resynced code work Anders Roxell
2026-11-07  7:21 ` [PATCH v11 01/30] x86: asm: io.h: add rmb() and wmb() Anders Roxell
2026-11-07  7:21 ` [PATCH v11 02/30] dm: add helpers needed by the resynced DWC3 code Anders Roxell
2026-11-08 16:24   ` Marek Vasut
2026-11-07  7:21 ` [PATCH v11 03/30] phy: cadence: use reset_control_assert() from reset.h Anders Roxell
2026-11-07  7:21 ` [PATCH v11 04/30] usb: phy: add the usb_phy helpers needed by the resynced DWC3 code Anders Roxell
2026-11-07  7:21 ` [PATCH v11 05/30] usb: gadget: adapt the gadget API after the resync Anders Roxell
2026-11-07  7:22 ` [PATCH v11 06/30] usb: gadget: udc: make udc-core build in U-Boot Anders Roxell
2026-11-07  7:22 ` [PATCH v11 07/30] usb: host: xhci: fix up after the resync Anders Roxell
2026-11-07  7:22 ` [PATCH v11 08/30] usb: dwc3: core: remove the code U-Boot does not use Anders Roxell
2026-11-07  7:22 ` [PATCH v11 09/30] usb: dwc3: core: bring back the U-Boot entry points Anders Roxell
2026-11-07  7:22 ` [PATCH v11 10/30] usb: dwc3: core: adapt to the U-Boot APIs Anders Roxell
2026-11-08 16:28   ` Marek Vasut
2026-11-07  7:22 ` [PATCH v11 11/30] usb: dwc3: adapt io.h, the Makefile and the TI glue Anders Roxell
2026-11-07  7:22 ` [PATCH v11 12/30] usb: dwc3: make gadget and ep0 build in U-Boot Anders Roxell
2026-11-07  7:22 ` [PATCH v11 13/30] usb: dwc3: ep0: flush and invalidate cache around ep0 transfers Anders Roxell
2026-11-07  7:22 ` [PATCH v11 14/30] usb: dwc3: gadget: flush and invalidate cache around transfers Anders Roxell
2026-11-07  7:22 ` [PATCH v11 15/30] usb: dwc3: core: flush the event buffer after allocation Anders Roxell
2026-11-07  7:22 ` [PATCH v11 16/30] usb: dwc3: make the am62 glue build in U-Boot Anders Roxell
2026-11-07  7:22 ` [PATCH v11 17/30] usb: gadget: ci_udc: move to the udc-core registration Anders Roxell
2026-11-07  7:22 ` [PATCH v11 18/30] usb: gadget: ci_udc: set endpoint capabilities Anders Roxell
2026-11-07  7:22 ` [PATCH v11 19/30] usb: gadget: dwc2_udc_otg: fix up after the resync Anders Roxell
2026-11-07  7:22 ` [PATCH v11 20/30] usb: gadget: fix up the function drivers " Anders Roxell
2026-11-07  7:22 ` [PATCH v11 21/30] usb: gadget: at91_udc: register with udc-core Anders Roxell
2026-11-07  7:22 ` [PATCH v11 22/30] usb: gadget: atmel_usba_udc: fix up after the resync Anders Roxell
2026-11-07  7:22 ` [PATCH v11 23/30] usb: gadget: atmel_usba_udc: set endpoint capabilities Anders Roxell
2026-11-07  7:22 ` [PATCH v11 24/30] usb: gadget: at91_udc: " Anders Roxell
2026-11-07  7:22 ` [PATCH v11 25/30] usb: musb-new: fix up after the resync Anders Roxell
2026-11-07  7:22 ` [PATCH v11 26/30] usb: musb-new: set endpoint capabilities Anders Roxell
2026-11-07  7:22 ` [PATCH v11 27/30] usb: mtu3: fix up after the resync Anders Roxell
2026-11-07  7:22 ` [PATCH v11 28/30] usb: mtu3: set endpoint capabilities Anders Roxell
2026-11-07  7:22 ` [PATCH v11 29/30] usb: cdns3: fix up after the resync Anders Roxell
2026-11-07  7:22 ` [PATCH v11 30/30] usb: dwc3: enable SUSPHY again after xhci is registered Anders Roxell
2026-11-09 14:03 ` [PATCH v11 00/30] usb: dwc3: part 2, make the resynced code work Quentin Schulz
2026-11-10 15:18 ` Marek Vasut
2026-11-11  7:13   ` Michal Simek
2026-11-11  9:57   ` Quentin Schulz
2026-11-11 13:08   ` Anders Roxell
2026-11-11 16:18     ` Marek Vasut
2026-11-12 12:20       ` Anders Roxell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox