linux/drivers/usb
William Wu 49b5c0d29f usb: dwc3: gadget: fix ep init for unequal num of in/out eps
Some SoCs have different number of endpoints between the EP-IN
and EP-OUT (e.g. RK3399/RV1126 have 7 in endpoints and 6 out
endpoints), it will fail to init all of the endpoints.

In my test case, I use RV1126 dwc3 to support 3 UVC functions
at the same time, and each UVC function need one in endpoint
for control interface and one in endpoint for streaming interface,
so it needs to init 7 in endpoints (include ep0-in) in this case.
Without this patch, it will fail to init the ep7-in because
it set the wrong DWC3_DEP_BASE for ep7-in.

According to dwc3 databook, the register DALEPENA and the "USB
Endpoint Number" field of Parameter1 are doing 1:1 mapping for
endpoints, meaning physical endpoints 2 maps to logical endpoint
2:
Bit[0]: USB EP0-OUT
Bit[1]: USB EP0-IN
Bit[2]: USB EP1-OUT
Bit[3]: USB EP1-IN
...
Bit[13]: USB EP7-IN

The dwc3 driver use dep->number to index endpoint number and init
the DALEPENA and the "USB Endpoint Number" field of Parameter1.
For RV1126, it should set dep->number to 13 for EP7-IN.

But the registers DEPCMDPAR2(#n),DEPCMDPAR1(#n), DEPCMDPAR0(#n),
and DEPCMD(#n) don't 1:1 mapping for endpoints. For RV1126, it
should set #n to 12 for EP7-IN. And the event->endpoint_number
in the dwc3_endpoint_interrupt() is equal to 12 for EP7-IN.

Fixes: c2185009e2 ("usb: dwc3: gadget: fix init endpoints and resize tx fifos")
Change-Id: I0898306196f4dacf09b0de3cf4d76d9026b6315c
Signed-off-by: William Wu <william.wu@rock-chips.com>
2020-07-30 18:06:39 +08:00
..
atm Merge tag 'ASB-2020-02-05_4.19' of https://android.googlesource.com/kernel/common 2020-02-17 16:00:29 +08:00
c67x00
chipidea Merge tag 'ASB-2020-02-05_4.19' of https://android.googlesource.com/kernel/common 2020-02-17 16:00:29 +08:00
class Merge tag 'ASB-2020-02-05_4.19' of https://android.googlesource.com/kernel/common 2020-02-17 16:00:29 +08:00
common
core UPSTREAM: USB: hub: Fix handling of connect changes during sleep 2020-06-01 14:27:31 +08:00
dwc2 usb: dwc2: hcd: fix isoc out transfer with unaligned dma address 2020-04-26 22:04:39 +08:00
dwc3 usb: dwc3: gadget: fix ep init for unequal num of in/out eps 2020-07-30 18:06:39 +08:00
early
gadget usb: gadget: u_audio: add uevent for set_alt and set_srate 2020-07-15 09:31:34 +08:00
host usb: xhci: support warm port reset quirk 2020-06-03 11:25:45 +08:00
image
isp1760
misc Merge remote branch 'android-4.19' of https://android.googlesource.com/kernel/common 2020-03-21 19:46:46 +08:00
mon Merge tag 'ASB-2020-02-05_4.19' of https://android.googlesource.com/kernel/common 2020-02-17 16:00:29 +08:00
mtu3 Merge tag 'ASB-2020-02-05_4.19' of https://android.googlesource.com/kernel/common 2020-02-17 16:00:29 +08:00
musb Merge remote branch 'android-4.19' of https://android.googlesource.com/kernel/common 2020-03-21 19:46:46 +08:00
phy Merge tag 'ASB-2020-02-05_4.19' of https://android.googlesource.com/kernel/common 2020-02-17 16:00:29 +08:00
renesas_usbhs usb: renesas_usbhs: add suspend event support in gadget mode 2019-12-31 16:34:54 +01:00
roles Merge tag 'ASB-2020-02-05_4.19' of https://android.googlesource.com/kernel/common 2020-02-17 16:00:29 +08:00
serial Merge tag 'ASB-2020-02-05_4.19' of https://android.googlesource.com/kernel/common 2020-02-17 16:00:29 +08:00
storage Merge remote branch 'android-4.19' of https://android.googlesource.com/kernel/common 2020-03-21 19:46:46 +08:00
typec UPSTREAM: usb: typec: fusb302: 2 small misc. fixes 2020-06-19 20:00:50 +08:00
usbip Merge tag 'ASB-2020-02-05_4.19' of https://android.googlesource.com/kernel/common 2020-02-17 16:00:29 +08:00
wusbcore
Kconfig
Makefile
README
usb-skeleton.c

To understand all the Linux-USB framework, you'll use these resources:

    * This source code.  This is necessarily an evolving work, and
      includes kerneldoc that should help you get a current overview.
      ("make pdfdocs", and then look at "usb.pdf" for host side and
      "gadget.pdf" for peripheral side.)  Also, Documentation/usb has
      more information.

    * The USB 2.0 specification (from www.usb.org), with supplements
      such as those for USB OTG and the various device classes.
      The USB specification has a good overview chapter, and USB
      peripherals conform to the widely known "Chapter 9".

    * Chip specifications for USB controllers.  Examples include
      host controllers (on PCs, servers, and more); peripheral
      controllers (in devices with Linux firmware, like printers or
      cell phones); and hard-wired peripherals like Ethernet adapters.

    * Specifications for other protocols implemented by USB peripheral
      functions.  Some are vendor-specific; others are vendor-neutral
      but just standardized outside of the www.usb.org team.

Here is a list of what each subdirectory here is, and what is contained in
them.

core/		- This is for the core USB host code, including the
		  usbfs files and the hub class driver ("hub_wq").

host/		- This is for USB host controller drivers.  This
		  includes UHCI, OHCI, EHCI, and others that might
		  be used with more specialized "embedded" systems.

gadget/		- This is for USB peripheral controller drivers and
		  the various gadget drivers which talk to them.


Individual USB driver directories.  A new driver should be added to the
first subdirectory in the list below that it fits into.

image/		- This is for still image drivers, like scanners or
		  digital cameras.
../input/	- This is for any driver that uses the input subsystem,
		  like keyboard, mice, touchscreens, tablets, etc.
../media/	- This is for multimedia drivers, like video cameras,
		  radios, and any other drivers that talk to the v4l
		  subsystem.
../net/		- This is for network drivers.
serial/		- This is for USB to serial drivers.
storage/	- This is for USB mass-storage drivers.
class/		- This is for all USB device drivers that do not fit
		  into any of the above categories, and work for a range
		  of USB Class specified devices. 
misc/		- This is for all USB device drivers that do not fit
		  into any of the above categories.