Commit 5828cada authored by Felipe Balbi's avatar Felipe Balbi

usb: dwc3: gadget: always use frame number from XferNotReady

The core requires the extra two bits of information for properly
scheduling Isochronous transfers. This means that we can't rely on
__dwc3_gadget_get_frame(). Let's always cache uFrame number from
XferNotReady instead.
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent 8f608e8a
...@@ -1275,7 +1275,7 @@ static int __dwc3_gadget_get_frame(struct dwc3 *dwc) ...@@ -1275,7 +1275,7 @@ static int __dwc3_gadget_get_frame(struct dwc3 *dwc)
return DWC3_DSTS_SOFFN(reg); return DWC3_DSTS_SOFFN(reg);
} }
static void __dwc3_gadget_start_isoc(struct dwc3_ep *dep, u32 cur_uf) static void __dwc3_gadget_start_isoc(struct dwc3_ep *dep)
{ {
if (list_empty(&dep->pending_list)) { if (list_empty(&dep->pending_list)) {
dev_info(dep->dwc->dev, "%s: ran out of requests\n", dev_info(dep->dwc->dev, "%s: ran out of requests\n",
...@@ -1288,7 +1288,7 @@ static void __dwc3_gadget_start_isoc(struct dwc3_ep *dep, u32 cur_uf) ...@@ -1288,7 +1288,7 @@ static void __dwc3_gadget_start_isoc(struct dwc3_ep *dep, u32 cur_uf)
* Schedule the first trb for one interval in the future or at * Schedule the first trb for one interval in the future or at
* least 4 microframes. * least 4 microframes.
*/ */
dep->frame_number = cur_uf + max_t(u32, 4, dep->interval); dep->frame_number += max_t(u32, 4, dep->interval);
__dwc3_gadget_kick_transfer(dep); __dwc3_gadget_kick_transfer(dep);
} }
...@@ -1331,10 +1331,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) ...@@ -1331,10 +1331,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
dwc3_stop_active_transfer(dep, true); dwc3_stop_active_transfer(dep, true);
dep->flags = DWC3_EP_ENABLED; dep->flags = DWC3_EP_ENABLED;
} else { } else {
u32 cur_uf; __dwc3_gadget_start_isoc(dep);
cur_uf = __dwc3_gadget_get_frame(dwc);
__dwc3_gadget_start_isoc(dep, cur_uf);
dep->flags &= ~DWC3_EP_PENDING_REQUEST; dep->flags &= ~DWC3_EP_PENDING_REQUEST;
} }
return 0; return 0;
...@@ -2469,8 +2466,9 @@ static void dwc3_gadget_endpoint_transfer_not_ready(struct dwc3_ep *dep, ...@@ -2469,8 +2466,9 @@ static void dwc3_gadget_endpoint_transfer_not_ready(struct dwc3_ep *dep,
mask = ~(dep->interval - 1); mask = ~(dep->interval - 1);
cur_uf = event->parameters & mask; cur_uf = event->parameters & mask;
dep->frame_number = cur_uf;
__dwc3_gadget_start_isoc(dep, cur_uf); __dwc3_gadget_start_isoc(dep);
} }
static void dwc3_endpoint_interrupt(struct dwc3 *dwc, static void dwc3_endpoint_interrupt(struct dwc3 *dwc,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment