usb: dwc3: gadget: issue Update Transfer command after queuing isoc request
Issue an Update Transfer command after queuing a request to an isoc EP with an active transfer. This is required according to the dwc3 databook. Pratyush Anand reports that this fixes a problem he was having with Isoc IN transfers. Tested-by: Pratyush Anand<pratyush.anand@st.com> Signed-off-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
parent
c12a0d862a
commit
f898ae09a0
1 changed files with 28 additions and 17 deletions
|
@ -957,10 +957,12 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep, u16 cmd_param,
|
||||||
}
|
}
|
||||||
|
|
||||||
dep->flags |= DWC3_EP_BUSY;
|
dep->flags |= DWC3_EP_BUSY;
|
||||||
|
|
||||||
|
if (start_new) {
|
||||||
dep->res_trans_idx = dwc3_gadget_ep_get_transfer_index(dwc,
|
dep->res_trans_idx = dwc3_gadget_ep_get_transfer_index(dwc,
|
||||||
dep->number);
|
dep->number);
|
||||||
|
|
||||||
WARN_ON_ONCE(!dep->res_trans_idx);
|
WARN_ON_ONCE(!dep->res_trans_idx);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -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);
|
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
|
* There are two special cases:
|
||||||
* 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
|
* 1. XferNotReady with empty list of requests. We need to kick the
|
||||||
* has a chance to queue a request, we will ACK
|
* transfer here in that situation, otherwise we will be NAKing
|
||||||
* the IRQ but won't be able to receive the data
|
* forever. If we get XferNotReady before gadget driver has a
|
||||||
* until the next request is queued. The following
|
* chance to queue a request, we will ACK the IRQ but won't be
|
||||||
* code is handling exactly that.
|
* 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) {
|
if (dep->flags & DWC3_EP_PENDING_REQUEST) {
|
||||||
int ret;
|
int ret;
|
||||||
int start_trans;
|
int start_trans = 1;
|
||||||
|
u8 trans_idx = dep->res_trans_idx;
|
||||||
|
|
||||||
start_trans = 1;
|
|
||||||
if (usb_endpoint_xfer_isoc(dep->desc) &&
|
if (usb_endpoint_xfer_isoc(dep->desc) &&
|
||||||
(dep->flags & DWC3_EP_BUSY))
|
(dep->flags & DWC3_EP_BUSY)) {
|
||||||
start_trans = 0;
|
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) {
|
if (ret && ret != -EBUSY) {
|
||||||
struct dwc3 *dwc = dep->dwc;
|
struct dwc3 *dwc = dep->dwc;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue