Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 316960
b: refs/heads/master
c: b511e5e
h: refs/heads/master
v: v3
  • Loading branch information
Felipe Balbi committed Jun 25, 2012
1 parent 4684d5d commit bc11db2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3daf74d78dfcd552445c35f1b82a271ca305ceb9
refs/heads/master: b511e5e76bf488cd3eec1048483a3898393a4dca
50 changes: 28 additions & 22 deletions trunk/drivers/usb/dwc3/gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -1075,17 +1075,8 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)

list_add_tail(&req->list, &dep->request_list);

if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) {
if (dep->flags & DWC3_EP_BUSY) {
dep->flags |= DWC3_EP_PENDING_REQUEST;
} else if (dep->flags & DWC3_EP_MISSED_ISOC) {
__dwc3_gadget_start_isoc(dwc, dep, dep->current_uf);
dep->flags &= ~DWC3_EP_MISSED_ISOC;
}
}

/*
* There are two special cases:
* There are a few special cases:
*
* 1. XferNotReady with empty list of requests. We need to kick the
* transfer here in that situation, otherwise we will be NAKing
Expand All @@ -1094,24 +1085,29 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
* able to receive the data until the next request is queued.
* The following code is handling exactly that.
*
* 2. XferInProgress on Isoc EP with an active transfer. We need to
* kick the transfer here after queuing a request, otherwise the
* core may not see the modified TRB(s).
*/
if (dep->flags & DWC3_EP_PENDING_REQUEST) {
int ret;
int start_trans = 1;
u8 trans_idx = dep->res_trans_idx;

if (usb_endpoint_xfer_isoc(dep->endpoint.desc) &&
(dep->flags & DWC3_EP_BUSY)) {
start_trans = 0;
WARN_ON_ONCE(!trans_idx);
} else {
trans_idx = 0;
ret = __dwc3_gadget_kick_transfer(dep, 0, true);
if (ret && ret != -EBUSY) {
struct dwc3 *dwc = dep->dwc;

dev_dbg(dwc->dev, "%s: failed to kick transfers\n",
dep->name);
}
}

ret = __dwc3_gadget_kick_transfer(dep, trans_idx, start_trans);
/*
* 2. XferInProgress on Isoc EP with an active transfer. We need to
* kick the transfer here after queuing a request, otherwise the
* core may not see the modified TRB(s).
*/
if (usb_endpoint_xfer_isoc(dep->endpoint.desc) &&
(dep->flags & DWC3_EP_BUSY)) {
WARN_ON_ONCE(!dep->res_trans_idx);
ret = __dwc3_gadget_kick_transfer(dep, dep->res_trans_idx,
false);
if (ret && ret != -EBUSY) {
struct dwc3 *dwc = dep->dwc;

Expand All @@ -1120,6 +1116,16 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
}
}

/*
* 3. Missed ISOC Handling. We need to start isoc transfer on the saved
* uframe number.
*/
if (usb_endpoint_xfer_isoc(dep->endpoint.desc) &&
(dep->flags & DWC3_EP_MISSED_ISOC)) {
__dwc3_gadget_start_isoc(dwc, dep, dep->current_uf);
dep->flags &= ~DWC3_EP_MISSED_ISOC;
}

return 0;
}

Expand Down

0 comments on commit bc11db2

Please sign in to comment.