Skip to content

Commit

Permalink
usb: dwc3: gadget: don't clear EP_BUSY too early
Browse files Browse the repository at this point in the history
In case of non-Isochronous transfers, we don't
want to clear DWC3_EP_BUSY flag until XferComplete
event. That's because XferInProgress was only enabled
so we can recycle TRBs and usb_requests quicker, but
there are still other pending requests being transferred.

In order to make sure we don't allow for another StartTransfer
command while the HW is still processing other transfers,
we must keep DWC3_EP_BUSY flag set and this what this patch
does.

Fixes: f3af365 (usb: dwc3: gadget: always enable IOC on
	bulk/interrupt transfers)
Cc: <[email protected]> # v3.15+
Reported-by: sundeep subbaraya <[email protected]>
Tested-by: sundeep subbaraya <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
  • Loading branch information
Felipe Balbi committed May 29, 2015
1 parent 307c858 commit e18b797
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/usb/dwc3/gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -1906,12 +1906,16 @@ static void dwc3_endpoint_transfer_complete(struct dwc3 *dwc,
{
unsigned status = 0;
int clean_busy;
u32 is_xfer_complete;

is_xfer_complete = (event->endpoint_event == DWC3_DEPEVT_XFERCOMPLETE);

if (event->status & DEPEVT_STATUS_BUSERR)
status = -ECONNRESET;

clean_busy = dwc3_cleanup_done_reqs(dwc, dep, event, status);
if (clean_busy)
if (clean_busy && (is_xfer_complete ||
usb_endpoint_xfer_isoc(dep->endpoint.desc)))
dep->flags &= ~DWC3_EP_BUSY;

/*
Expand Down

0 comments on commit e18b797

Please sign in to comment.