Skip to content

Commit 1d26ba0

Browse files
Prashanth Kgregkh
authored andcommitted
usb: dwc3: Wait unconditionally after issuing EndXfer command
Currently all controller IP/revisions except DWC3_usb3 >= 310a wait 1ms unconditionally for ENDXFER completion when IOC is not set. This is because DWC_usb3 controller revisions >= 3.10a supports GUCTL2[14: Rst_actbitlater] bit which allows polling CMDACT bit to know whether ENDXFER command is completed. Consider a case where an IN request was queued, and parallelly soft_disconnect was called (due to ffs_epfile_release). This eventually calls stop_active_transfer with IOC cleared, hence send_gadget_ep_cmd() skips waiting for CMDACT cleared during EndXfer. For DWC3 controllers with revisions >= 310a, we don't forcefully wait for 1ms either, and we proceed by unmapping the requests. If ENDXFER didn't complete by this time, it leads to SMMU faults since the controller would still be accessing those requests. Fix this by ensuring ENDXFER completion by adding 1ms delay in __dwc3_stop_active_transfer() unconditionally. Cc: [email protected] Fixes: b353eb6 ("usb: dwc3: gadget: Skip waiting for CMDACT cleared during endxfer") Signed-off-by: Prashanth K <[email protected]> Acked-by: Thinh Nguyen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent e430611 commit 1d26ba0

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/usb/dwc3/gadget.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,7 +1699,6 @@ static int __dwc3_gadget_get_frame(struct dwc3 *dwc)
16991699
*/
17001700
static int __dwc3_stop_active_transfer(struct dwc3_ep *dep, bool force, bool interrupt)
17011701
{
1702-
struct dwc3 *dwc = dep->dwc;
17031702
struct dwc3_gadget_ep_cmd_params params;
17041703
u32 cmd;
17051704
int ret;
@@ -1724,8 +1723,7 @@ static int __dwc3_stop_active_transfer(struct dwc3_ep *dep, bool force, bool int
17241723
dep->resource_index = 0;
17251724

17261725
if (!interrupt) {
1727-
if (!DWC3_IP_IS(DWC3) || DWC3_VER_IS_PRIOR(DWC3, 310A))
1728-
mdelay(1);
1726+
mdelay(1);
17291727
dep->flags &= ~DWC3_EP_TRANSFER_STARTED;
17301728
} else if (!ret) {
17311729
dep->flags |= DWC3_EP_END_TRANSFER_PENDING;

0 commit comments

Comments
 (0)