Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 303847
b: refs/heads/master
c: f898ae0
h: refs/heads/master
i:
  303845: 042b46b
  303843: 52f9b80
  303839: d93e8b6
v: v3
  • Loading branch information
Paul Zimmerman authored and Felipe Balbi committed May 2, 2012
1 parent 2a5422f commit dbbbeab
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 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: c12a0d862a900707cdc683efad39d05697d9964d
refs/heads/master: f898ae09a043cf9c3c4be82c04e08fcf00fe82c1
45 changes: 28 additions & 17 deletions trunk/drivers/usb/dwc3/gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -957,10 +957,12 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep, u16 cmd_param,
}

dep->flags |= DWC3_EP_BUSY;
dep->res_trans_idx = dwc3_gadget_ep_get_transfer_index(dwc,
dep->number);

WARN_ON_ONCE(!dep->res_trans_idx);
if (start_new) {
dep->res_trans_idx = dwc3_gadget_ep_get_transfer_index(dwc,
dep->number);
WARN_ON_ONCE(!dep->res_trans_idx);
}

return 0;
}
Expand Down Expand Up @@ -994,28 +996,37 @@ 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->desc) && (dep->flags & DWC3_EP_BUSY))
dep->flags |= DWC3_EP_PENDING_REQUEST;

/*
* There is one special case: XferNotReady with
* empty list of requests. We need to kick the
* transfer here in that situation, otherwise
* we will be NAKing forever.
* There are two special cases:
*
* If we get XferNotReady before gadget driver
* has a chance to queue a request, we will ACK
* the IRQ but won't be able to receive the data
* until the next request is queued. The following
* code is handling exactly that.
* 1. XferNotReady with empty list of requests. We need to kick the
* transfer here in that situation, otherwise we will be NAKing
* forever. If we get XferNotReady before gadget driver has a
* chance to queue a request, we will ACK the IRQ but won't be
* 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;
int ret;
int start_trans = 1;
u8 trans_idx = dep->res_trans_idx;

start_trans = 1;
if (usb_endpoint_xfer_isoc(dep->desc) &&
(dep->flags & DWC3_EP_BUSY))
(dep->flags & DWC3_EP_BUSY)) {
start_trans = 0;
WARN_ON_ONCE(!trans_idx);
} else {
trans_idx = 0;
}

ret = __dwc3_gadget_kick_transfer(dep, 0, start_trans);
ret = __dwc3_gadget_kick_transfer(dep, trans_idx, start_trans);
if (ret && ret != -EBUSY) {
struct dwc3 *dwc = dep->dwc;

Expand Down

0 comments on commit dbbbeab

Please sign in to comment.