linux-stable/drivers/usb/dwc3
Wesley Cheng d8a2bb4eb7 usb: dwc3: gadget: Add 1ms delay after end transfer command without IOC
Previously, there was a 100uS delay inserted after issuing an end transfer
command for specific controller revisions.  This was due to the fact that
there was a GUCTL2 bit field which enabled synchronous completion of the
end transfer command once the CMDACT bit was cleared in the DEPCMD
register.  Since this bit does not exist for all controller revisions and
the current implementation heavily relies on utizling the EndTransfer
command completion interrupt, add the delay back in for uses where the
interrupt on completion bit is not set, and increase the duration to 1ms
for the controller to complete the command.

An issue was seen where the USB request buffer was unmapped while the DWC3
controller was still accessing the TRB.  However, it was confirmed that the
end transfer command was successfully submitted. (no end transfer timeout)
In situations, such as dwc3_gadget_soft_disconnect() and
__dwc3_gadget_ep_disable(), the dwc3_remove_request() is utilized, which
will issue the end transfer command, and follow up with
dwc3_gadget_giveback().  At least for the USB ep disable path, it is
required for any pending and started requests to be completed and returned
to the function driver in the same context of the disable call.  Without
the GUCTL2 bit, it is not ensured that the end transfer is completed before
the buffers are unmapped.

Fixes: cf2f8b63f7 ("usb: dwc3: gadget: Remove END_TRANSFER delay")
Cc: stable <stable@kernel.org>
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/20230306200557.29387-1-quic_wcheng@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-09 14:54:46 +01:00
..
core.c usb: dwc3: core: defer probe on ulpi_read_id timeout 2022-12-08 16:48:07 +01:00
core.h usb: dwc3: Fix a typo in field name 2023-03-09 14:41:31 +01:00
debug.h USB: dwc3: fix memory leak with using debugfs_lookup() 2023-02-06 13:46:41 +01:00
debugfs.c USB: dwc3: fix memory leak with using debugfs_lookup() 2023-02-06 13:46:41 +01:00
drd.c usb: dwc3: Don't switch OTG -> peripheral if extcon is present 2022-10-22 12:29:43 +02:00
dwc3-am62.c usb: dwc3-am62: remove unnecesary clk_put() 2022-06-29 21:04:55 +02:00
dwc3-exynos.c usb: dwc3: exynos: Fix remove() function 2022-11-22 16:51:45 +01:00
dwc3-haps.c
dwc3-imx8mp.c usb: dwc3: imx8mp: Add support for setting SOC specific flags 2022-03-15 15:37:11 +01:00
dwc3-keystone.c
dwc3-meson-g12a.c
dwc3-of-simple.c
dwc3-omap.c usb: dwc3: omap: fix "unbalanced disables for smps10_out1" on omap5evm 2022-03-15 15:44:46 +01:00
dwc3-pci.c usb: dwc3: pci: add support for the Intel Meteor Lake-M 2023-02-15 19:00:16 +01:00
dwc3-qcom.c usb: dwc3: qcom: enable vbus override when in OTG dr-mode 2023-01-24 18:19:00 +01:00
dwc3-st.c usb: dwc3: st: Rely on child's compatible instead of name 2022-10-25 19:06:13 +02:00
dwc3-xilinx.c usb: dwc3: xilinx: Remove unused of_gpio,h 2023-02-16 12:45:30 +01:00
ep0.c usb: dwc3: Avoid unmapping USB requests if endxfer is not complete 2022-09-07 16:26:26 +02:00
gadget.c usb: dwc3: gadget: Add 1ms delay after end transfer command without IOC 2023-03-09 14:54:46 +01:00
gadget.h usb: dwc3: Fix ep0 handling when getting reset while doing control transfer 2022-05-19 18:14:16 +02:00
host.c Revert "usb: dwc3: disable USB core PHY management" 2022-11-08 16:45:12 +01:00
io.h
Kconfig usb: dwc3: fix extcon dependency 2023-01-19 14:19:49 +01:00
Makefile drivers: usb: dwc3: Add AM62 USB wrapper driver 2022-04-21 18:31:56 +02:00
trace.c
trace.h usb: dwc3: trace: add Start of Frame Number to trace event 2022-08-19 11:03:52 +02:00
ulpi.c