Commit 8d62cd65 authored by Paul Zimmerman's avatar Paul Zimmerman Committed by Felipe Balbi

usb: dwc3: gadget: don't wrap around the TRB poll on non-ISOC

If we have a non-ISOC endpoint, we will not have a Link TRB
pointing to the beginning of the TRB pool. On such endpoints,
we don't want to let the driver wrap around the TRB pool
otherwise controller will hang waiting for a valid TRB.

Cc: stable@vger.kernel.org
Signed-off-by: default avatarPaul Zimmerman <paulz@synopsys.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 075cd14d
...@@ -826,6 +826,7 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting) ...@@ -826,6 +826,7 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting)
{ {
struct dwc3_request *req, *n; struct dwc3_request *req, *n;
u32 trbs_left; u32 trbs_left;
u32 max;
unsigned int last_one = 0; unsigned int last_one = 0;
BUILD_BUG_ON_NOT_POWER_OF_2(DWC3_TRB_NUM); BUILD_BUG_ON_NOT_POWER_OF_2(DWC3_TRB_NUM);
...@@ -833,6 +834,13 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting) ...@@ -833,6 +834,13 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting)
/* the first request must not be queued */ /* the first request must not be queued */
trbs_left = (dep->busy_slot - dep->free_slot) & DWC3_TRB_MASK; trbs_left = (dep->busy_slot - dep->free_slot) & DWC3_TRB_MASK;
/* Can't wrap around on a non-isoc EP since there's no link TRB */
if (!usb_endpoint_xfer_isoc(dep->desc)) {
max = DWC3_TRB_NUM - (dep->free_slot & DWC3_TRB_MASK);
if (trbs_left > max)
trbs_left = max;
}
/* /*
* If busy & slot are equal than it is either full or empty. If we are * If busy & slot are equal than it is either full or empty. If we are
* starting to process requests then we are empty. Otherwise we are * starting to process requests then we are empty. Otherwise we are
......
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