Commit 0e146028 authored by Felipe Balbi's avatar Felipe Balbi

usb: dwc3: gadget: issue ENDTRANSFER conditional on resource_index

Because of recent changes to transfer handling on
DWC3, we will not get XferComplete unless we
completely fill up our TRB ring. This means that we
might get a Reset or Disconnect without getting a
XferComplete first.

In order to correctly release our allocated Transfer
Resource, we must issue ENDTRANSFER command whenever
dep->resource_index is valid.
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent 32808237
...@@ -607,24 +607,14 @@ static void dwc3_stop_active_transfer(struct dwc3 *dwc, u32 epnum, bool force); ...@@ -607,24 +607,14 @@ static void dwc3_stop_active_transfer(struct dwc3 *dwc, u32 epnum, bool force);
static void dwc3_remove_requests(struct dwc3 *dwc, struct dwc3_ep *dep) static void dwc3_remove_requests(struct dwc3 *dwc, struct dwc3_ep *dep)
{ {
struct dwc3_request *req; struct dwc3_request *req;
struct dwc3_trb *current_trb;
unsigned transfer_in_flight;
if (dep->number > 1) dwc3_stop_active_transfer(dwc, dep->number, true);
current_trb = &dep->trb_pool[dep->trb_enqueue];
else
current_trb = &dwc->ep0_trb[dep->trb_enqueue];
transfer_in_flight = current_trb->ctrl & DWC3_TRB_CTRL_HWO;
if (transfer_in_flight && !list_empty(&dep->started_list)) {
dwc3_stop_active_transfer(dwc, dep->number, true);
/* - giveback all requests to gadget driver */ /* - giveback all requests to gadget driver */
while (!list_empty(&dep->started_list)) { while (!list_empty(&dep->started_list)) {
req = next_request(&dep->started_list); req = next_request(&dep->started_list);
dwc3_gadget_giveback(dep, req, -ESHUTDOWN); dwc3_gadget_giveback(dep, req, -ESHUTDOWN);
}
} }
while (!list_empty(&dep->pending_list)) { while (!list_empty(&dep->pending_list)) {
......
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