From: Felipe Balbi Date: Wed, 11 Apr 2018 07:34:34 +0000 (+0300) Subject: usb: dwc3: gadget: always start isochronous aligned to dep->interval X-Git-Tag: v4.19~894^2~81^2~21 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f62afb4929a83cb7e81bd2ac411f2d4977716cf6;p=platform%2Fkernel%2Flinux-rpi.git 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 --- diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index e9e0e28..abdc3ac 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,