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]/

v9 -> v10:
- Rebased on 8649a54d301a.
- dm helpers: reset_control_*() moved to include/reset.h and call
  reset_assert() and reset_deassert(). Kept Mattijs' Reviewed-by.
  (Marek)
- New patch: sierra and torrent use the reset.h helpers. Only build
  tested. (Marek)
- usb_phy helpers: x -> phy. (Marek)
- "usb: dwc3: make the core driver build in U-Boot" is split in four.
  The first only deletes, the second adds back the old U-Boot functions
  unchanged, and the third has the real changes. (Marek)
- Dropped the samsung usb phy patch, since part one keeps the file now.
  (Marek)
- udc-core: udc_bind_to_driver() is after the async callback helpers,
  so no forward declaration. (Marek)
- am62 glue: check dev_remap_addr_index() for NULL again. The rebase
  lost David's fix in 83abf9120071 without a conflict.
- New patch last: enable SUSPHY again after xhci is registered. Found
  while looking at Quentin's RK3588 Tiger report.
- am335x_evm SPL fits again, CI passes on v10.

Older changes are listed in v9 [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: 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: gadget: udc: enable async callbacks on bind
  usb: dwc3: ep0: flush and invalidate cache around ep0 transfers
  usb: dwc3: gadget: flush and invalidate cache around transfers
  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: fix up the last UDC drivers after the resync
  usb: gadget: atmel_usba_udc: set endpoint capabilities
  usb: gadget: at91_udc: register with udc-core
  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: host: xhci: fix up after the resync
  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                 |   16 +-
 drivers/usb/dwc3/core.c                   | 1762 +++++----------------
 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                 |  724 ++-------
 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       |  114 +-
 drivers/usb/gadget/ci_udc.c               |   86 +-
 drivers/usb/gadget/composite.c            |    2 +-
 drivers/usb/gadget/dwc2_udc_otg.c         |   86 +-
 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         |   39 -
 include/dm/device_compat.h                |   13 +
 include/dm/read.h                         |   51 +
 include/linux/compat.h                    |    2 +
 include/linux/usb/ch9.h                   |   25 +-
 include/linux/usb/gadget.h                |  529 ++-----
 include/linux/usb/phy.h                   |   57 +
 include/reset.h                           |   16 +
 44 files changed, 1354 insertions(+), 4030 deletions(-)

-- 
2.53.0

Reply via email to