Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: dwc3: gadget: fix 'endpoint always busy' bug

If a USB transfer has already been started, meaning
we have already issued StartTransfer command to that
particular endpoint, DWC3_EP_BUSY flag has also
already been set.

When we try to cancel this transfer which is already
in controller's cache, we will not receive XferComplete
event and we must clear DWC3_EP_BUSY in order to allow
subsequent requests to be properly started.

The best place to clear that flag is right after issuing
DWC3_DEPCMD_ENDTRANSFER.

Cc: stable@vger.kernel.org # v3.4 v3.5 v3.6
Reported-by: Moiz Sonasath <m-sonasath@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>

+1 -1
+1 -1
drivers/usb/dwc3/gadget.c
··· 1904 1904 ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, cmd, &params); 1905 1905 WARN_ON_ONCE(ret); 1906 1906 dep->resource_index = 0; 1907 - 1907 + dep->flags &= ~DWC3_EP_BUSY; 1908 1908 udelay(100); 1909 1909 } 1910 1910