summaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3/gadget.c
diff options
context:
space:
mode:
authorFelipe Balbi <felipe.balbi@linux.intel.com>2018-04-11 09:34:34 +0200
committerFelipe Balbi <felipe.balbi@linux.intel.com>2018-05-21 09:01:00 +0200
commitf62afb4929a83cb7e81bd2ac411f2d4977716cf6 (patch)
tree4545eddc81623a57023edf8b2ad94819c10ce6bd /drivers/usb/dwc3/gadget.c
parentusb: dwc3: gadget: don't issue End Transfer if we have started reqs (diff)
downloadlinux-f62afb4929a83cb7e81bd2ac411f2d4977716cf6.tar.xz
linux-f62afb4929a83cb7e81bd2ac411f2d4977716cf6.zip
usb: dwc3: gadget: always start isochronous aligned to dep->interval
We will *always* start transfer to the next uFrame number aligned to dep->interval. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb/dwc3/gadget.c')
-rw-r--r--drivers/usb/dwc3/gadget.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index e9e0e2805431..abdc3ac24cc6 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -27,6 +27,9 @@
#include "gadget.h"
#include "io.h"
+#define DWC3_ALIGN_FRAME(d) (((d)->frame_number + (d)->interval) \
+ & ~((d)->interval - 1))
+
/**
* dwc3_gadget_set_test_mode - enables usb2 test modes
* @dwc: pointer to our context structure
@@ -1267,11 +1270,7 @@ static void __dwc3_gadget_start_isoc(struct dwc3_ep *dep)
return;
}
- /*
- * Schedule the first trb for one interval in the future or at
- * least 4 microframes.
- */
- dep->frame_number += max_t(u32, 4, dep->interval);
+ dep->frame_number = DWC3_ALIGN_FRAME(dep);
__dwc3_gadget_kick_transfer(dep);
}
@@ -2377,11 +2376,7 @@ static void dwc3_gadget_ep_cleanup_completed_requests(struct dwc3_ep *dep,
static void dwc3_gadget_endpoint_frame_from_event(struct dwc3_ep *dep,
const struct dwc3_event_depevt *event)
{
- u32 cur_uf, mask;
-
- mask = ~(dep->interval - 1);
- cur_uf = event->parameters & mask;
- dep->frame_number = cur_uf;
+ dep->frame_number = event->parameters;
}
static void dwc3_gadget_endpoint_transfer_in_progress(struct dwc3_ep *dep,