]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
usb: dwc3: gadget: check for Missed Isoc from event status
authorFelipe Balbi <felipe.balbi@linux.intel.com>
Thu, 29 Mar 2018 09:49:28 +0000 (12:49 +0300)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 21 May 2018 07:00:53 +0000 (10:00 +0300)
In case we get an event with status set to Missed Isoc, this means we
have missed an isochronous interval and should issue End Transfer
command and wait for the following XferNotReady.

Let's do that early, rather than late.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/dwc3/core.h
drivers/usb/dwc3/gadget.c

index 310b6435673ca447ae04ddb974c2c00481f83f5d..499e08636ce440cfab060aa8ebbdf51936879e7e 100644 (file)
@@ -1204,11 +1204,12 @@ struct dwc3_event_depevt {
 /* Within XferNotReady */
 #define DEPEVT_STATUS_TRANSFER_ACTIVE  BIT(3)
 
-/* Within XferComplete */
+/* Within XferComplete or XferInProgress */
 #define DEPEVT_STATUS_BUSERR   BIT(0)
 #define DEPEVT_STATUS_SHORT    BIT(1)
 #define DEPEVT_STATUS_IOC      BIT(2)
-#define DEPEVT_STATUS_LST      BIT(3)
+#define DEPEVT_STATUS_LST      BIT(3) /* XferComplete */
+#define DEPEVT_STATUS_MISSED_ISOC BIT(3) /* XferInProgress */
 
 /* Stream event only */
 #define DEPEVT_STREAMEVT_FOUND         1
index 4e2bef990c50d696701c0be4d3224c7afc42c805..d378f3e92e188169aee2439e4d6e8fdcd0ca295c 100644 (file)
@@ -2396,9 +2396,6 @@ static void dwc3_gadget_ep_cleanup_completed_requests(struct dwc3_ep *dep,
                         * entry is added into request list.
                         */
                        dep->flags = DWC3_EP_PENDING_REQUEST;
-               } else {
-                       dwc3_stop_active_transfer(dep, true);
-                       dep->flags = DWC3_EP_ENABLED;
                }
        }
 }
@@ -2418,14 +2415,25 @@ static void dwc3_gadget_endpoint_transfer_in_progress(struct dwc3_ep *dep,
 {
        struct dwc3             *dwc = dep->dwc;
        unsigned                status = 0;
+       bool                    stop = false;
 
        dwc3_gadget_endpoint_frame_from_event(dep, event);
 
        if (event->status & DEPEVT_STATUS_BUSERR)
                status = -ECONNRESET;
 
+       if (event->status & DEPEVT_STATUS_MISSED_ISOC) {
+               status = -EXDEV;
+               stop = true;
+       }
+
        dwc3_gadget_ep_cleanup_completed_requests(dep, event, status);
 
+       if (stop) {
+               dwc3_stop_active_transfer(dep, true);
+               dep->flags = DWC3_EP_ENABLED;
+       }
+
        /*
         * WORKAROUND: This is the 2nd half of U1/U2 -> U0 workaround.
         * See dwc3_gadget_linksts_change_interrupt() for 1st half.