[PATCH v6 00/87] usb: dwc3: sync code with Linux v6.16

Anders Roxell <[email protected]>
Newsgroups gmane.comp.boot-loaders.u-boot.general,gmane.comp.boot-loaders.u-boot
Message-ID <[email protected]>
Hi,

This series syncs the DWC3 USB driver with Linux v6.16.

The driver was forked from the kernel v3.19-rc1 eleven years ago, in
commit 85d5e7075f33 ("usb: dwc3: add dwc3 folder from linux kernel to
u-boot"). After that almost no kernel changes came back to U-Boot.

I split the work in four steps, so it is easy to follow:

1. Re-import xhci-ext-caps.h from v6.16. Marek asked for this one to come
   first, since the dwc3 imports build on it.

2. Restore drivers/usb/dwc3 to a clean v3.19-rc1 state.

3. Import the dwc3 directory once per major kernel version, from v3.19
   up to v6.16. Each commit is a raw snapshot from that kernel.

4. Add back the U-Boot glue, the XHCI/UDC updates and the build fixes.
   This part builds on Jerome's work [2].

The import commits are raw kernel snapshots. They do not build on their
own, only the full series builds. This is on purpose. It makes it easy
to see what comes from which kernel version, and to compare each import
with the matching kernel release. The commit messages say this too.

Build tested one board per driver: every DWC3 glue layer in the tree,
dwc2 with and without DM_USB_GADGET, at91_udc, atmel_usba_udc, ci_udc,
musb-new and mtu3. 17 boards in total.

DFU is tested on hardware on BeagleBoard-X15, and on BeaglePlay by
Anshul. ci_udc is tested on an i.MX93 board with ums. The rest is build
tested only.

The branch is also available at [4].

[1] v5: https://lore.kernel.org/u-boot/[email protected]/
[2] Jerome's adaptation work: https://lore.kernel.org/all/[email protected]/
[3] dwc2 prep: https://lore.kernel.org/all/[email protected]/
[4] https://github.com/roxell/u-boot/tree/usb_dwc3_sync_v6

v5 -> v6:
- Dropped the commits that only touch skipped or preserved files from
  the "Commits imported" lists. Mattijs asked for this on many patches,
  Marek on the v6.0 import.
- Removed a stray "Fixes: b1a3ed068869 (spl: make args file optional in
  falcon mode)" tag from the v4.14 import. Mattijs found it.
- Fixed the "accross" typo in the import commit messages.
- Collected the Reviewed-by tags, 59 from Mattijs and 24 from Simon. The
  code is unchanged on all of them, only the commit messages differ.
- Four imports have no tag from Mattijs: 18, 27, 33 and 34, which were
  17, 26, 32 and 33 in v5. He was right on all four. What he pointed at
  should not have been in those messages, and it is gone now.
- Moved the xhci-ext-caps.h re-import to the front, Marek asked for that
  on 61/64 in v4. The epautoconf.c and udc-core.c re-imports stayed where
  they were, he did not ask about those. Say if you want them moved too.
- Split the "add helpers" patch into a dm patch and a usb phy patch.
  Mattijs asked for this.
- Kept the U-Boot dwc3 Makefile instead of the kernel one. This is what
  Marek meant with glue drivers that are never compiled or used.
- Brought back samsung_usb_phy.c in an own commit. The restore commit
  deleted it and nothing added it back, so odroid-xu3 lost its USB 3.0
  phy setup.
- Stopped moving functions around in dwc3 gadget.c. Where a function
  still had to move, the commit message now says why. Mattijs said the
  last patches were hard to review because of this.
- Split "fix up musb-new and mtu3" and "fix up xhci and cdns3" into one
  patch per controller. David asked for this.
- Set endpoint capabilities in at91_udc, atmel_usba_udc, ci_udc, musb-new
  and mtu3. Mattijs asked for this on v4, after the VIM3 fastboot
  regression. Each patch sits next to the other fixup for that driver.
- at91_udc now calls usb_add_gadget_udc(). Without it udc-core never sees
  the controller.
- Enabled async callbacks on bind, and added a cache flush and invalidate
  around ep0 transfers. Without these no dwc3 gadget enumerates. Anshul
  found them on BeaglePlay, I hit them on BeagleBoard-X15. DFU works on
  both now.
- ci_udc got udc_start() and udc_stop(). udc-core calls udc_start() on
  bind, ci_udc did not have it, so the board crashed with a synchronous
  abort when ums started. Found on i.MX93, ums works there now.
- udc-core got two more fixes while I looked at that. It checks
  udc_start(), udc_stop() and get_frame() before calling them, they are
  mandatory in the kernel but not in u-boot. And it reports what
  usb_gadget_udc_bringup() returned, before it only said "No UDC
  available".
- Rebased on current mainline. The ci_udc patch shrank a lot: mainline
  gained three ci_udc fixes and the old patch deleted the functions they
  touch.
- Mattijs' dwc2 endpoint fixes [3] are in mainline now, so this series
  has no dependencies left.

Older changes are listed in v5 [1].

Cheers,
Anders

Anders Roxell (24):
  dm: add helpers needed by the resynced DWC3 code
  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: make the core driver build in u-boot
  usb: dwc3: bring back the samsung usb phy driver
  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: 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

Jens Wiklander (60):
  usb: dwc3: restore to original v3.19-rc1 kernel import
  usb: dwc3: import from kernel v3.19
  usb: dwc3: import from kernel v4.0
  usb: dwc3: import from kernel v4.1
  usb: dwc3: import from kernel v4.2
  usb: dwc3: import from kernel v4.3
  usb: dwc3: import from kernel v4.4
  usb: dwc3: import from kernel v4.5
  usb: dwc3: import from kernel v4.6
  usb: dwc3: import from kernel v4.7
  usb: dwc3: import from kernel v4.8
  usb: dwc3: import from kernel v4.9
  usb: dwc3: import from kernel v4.10
  usb: dwc3: import from kernel v4.11
  usb: dwc3: import from kernel v4.12
  usb: dwc3: import from kernel v4.13
  usb: dwc3: import from kernel v4.14
  usb: dwc3: import from kernel v4.15
  usb: dwc3: import from kernel v4.16
  usb: dwc3: import from kernel v4.17
  usb: dwc3: import from kernel v4.18
  usb: dwc3: import from kernel v4.19
  usb: dwc3: import from kernel v4.20
  usb: dwc3: import from kernel v5.0
  usb: dwc3: import from kernel v5.1
  usb: dwc3: import from kernel v5.2
  usb: dwc3: import from kernel v5.3
  usb: dwc3: import from kernel v5.4
  usb: dwc3: import from kernel v5.5
  usb: dwc3: import from kernel v5.6
  usb: dwc3: import from kernel v5.7
  usb: dwc3: import from kernel v5.8
  usb: dwc3: import from kernel v5.9
  usb: dwc3: import from kernel v5.10
  usb: dwc3: import from kernel v5.11
  usb: dwc3: import from kernel v5.12
  usb: dwc3: import from kernel v5.13
  usb: dwc3: import from kernel v5.14
  usb: dwc3: import from kernel v5.15
  usb: dwc3: import from kernel v5.16
  usb: dwc3: import from kernel v5.17
  usb: dwc3: import from kernel v5.18
  usb: dwc3: import from kernel v5.19
  usb: dwc3: import from kernel v6.0
  usb: dwc3: import from kernel v6.1
  usb: dwc3: import from kernel v6.2
  usb: dwc3: import from kernel v6.3
  usb: dwc3: import from kernel v6.4
  usb: dwc3: import from kernel v6.5
  usb: dwc3: import from kernel v6.6
  usb: dwc3: import from kernel v6.7
  usb: dwc3: import from kernel v6.8
  usb: dwc3: import from kernel v6.9
  usb: dwc3: import from kernel v6.10
  usb: dwc3: import from kernel v6.11
  usb: dwc3: import from kernel v6.12
  usb: dwc3: import from kernel v6.13
  usb: dwc3: import from kernel v6.14
  usb: dwc3: import from kernel v6.15
  usb: dwc3: import from kernel v6.16

Jerome Forissier (3):
  usb: host: re-import xhci-ext-caps.h from kernel v6.16
  usb: gadget: re-import epautoconf.c from kernel v6.16
  usb: udc: re-import udc-core.c from kernel v6.16

 drivers/usb/cdns3/ep0.c                |    8 +-
 drivers/usb/dwc3/Makefile              |   16 +-
 drivers/usb/dwc3/core.c                | 1710 ++++++----
 drivers/usb/dwc3/core.h                | 1060 ++++--
 drivers/usb/dwc3/debug.h               |  432 +++
 drivers/usb/dwc3/dwc3-omap.c           |    2 -
 drivers/usb/dwc3/ep0.c                 |  740 +++--
 drivers/usb/dwc3/gadget.c              | 4233 ++++++++++++++++--------
 drivers/usb/dwc3/gadget.h              |  112 +-
 drivers/usb/dwc3/glue.h                |   36 +
 drivers/usb/dwc3/io.h                  |   23 +-
 drivers/usb/dwc3/linux-compat.h        |   16 -
 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        |  290 +-
 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      | 1131 ++++++-
 drivers/usb/host/xhci-dwc3.c           |    4 +-
 drivers/usb/host/xhci-ext-caps.h       |  158 +
 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                 |   15 +
 include/linux/usb/ch9.h                |   25 +-
 include/linux/usb/gadget.h             |  529 +--
 include/linux/usb/phy.h                |   56 +
 41 files changed, 7646 insertions(+), 3596 deletions(-)
 create mode 100644 drivers/usb/dwc3/debug.h
 create mode 100644 drivers/usb/dwc3/glue.h
 delete mode 100644 drivers/usb/dwc3/linux-compat.h
 create mode 100644 drivers/usb/host/xhci-ext-caps.h

-- 
2.53.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.