usb: dwc3: gadget: Store resource index of start cmd
authorThinh Nguyen <Thinh.Nguyen@synopsys.com>
Sun, 29 Mar 2020 23:13:04 +0000 (16:13 -0700)
committerFelipe Balbi <balbi@kernel.org>
Tue, 5 May 2020 08:00:13 +0000 (11:00 +0300)
As long as the START_TRANSFER command completes, it provides the
resource index of the endpoint. Use this when we need to issue
END_TRANSFER command to an isoc endpoint to retry with a new
XferNotReady event.

Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
drivers/usb/dwc3/gadget.c

index 2322850..a6aebe5 100644 (file)
@@ -387,9 +387,12 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned cmd,
 
        trace_dwc3_gadget_ep_cmd(dep, cmd, params, cmd_status);
 
-       if (ret == 0 && DWC3_DEPCMD_CMD(cmd) == DWC3_DEPCMD_STARTTRANSFER) {
-               dep->flags |= DWC3_EP_TRANSFER_STARTED;
-               dwc3_gadget_ep_get_transfer_index(dep);
+       if (DWC3_DEPCMD_CMD(cmd) == DWC3_DEPCMD_STARTTRANSFER) {
+               if (ret == 0)
+                       dep->flags |= DWC3_EP_TRANSFER_STARTED;
+
+               if (ret != -ETIMEDOUT)
+                       dwc3_gadget_ep_get_transfer_index(dep);
        }
 
        if (saved_config) {