diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/dwc3/gadget.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index d121e73d89ae..48b2d0d14481 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -826,6 +826,7 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting) | |||
826 | { | 826 | { |
827 | struct dwc3_request *req, *n; | 827 | struct dwc3_request *req, *n; |
828 | u32 trbs_left; | 828 | u32 trbs_left; |
829 | u32 max; | ||
829 | unsigned int last_one = 0; | 830 | unsigned int last_one = 0; |
830 | 831 | ||
831 | BUILD_BUG_ON_NOT_POWER_OF_2(DWC3_TRB_NUM); | 832 | 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 | /* the first request must not be queued */ | 834 | /* the first request must not be queued */ |
834 | trbs_left = (dep->busy_slot - dep->free_slot) & DWC3_TRB_MASK; | 835 | trbs_left = (dep->busy_slot - dep->free_slot) & DWC3_TRB_MASK; |
835 | 836 | ||
837 | /* Can't wrap around on a non-isoc EP since there's no link TRB */ | ||
838 | if (!usb_endpoint_xfer_isoc(dep->desc)) { | ||
839 | max = DWC3_TRB_NUM - (dep->free_slot & DWC3_TRB_MASK); | ||
840 | if (trbs_left > max) | ||
841 | trbs_left = max; | ||
842 | } | ||
843 | |||
836 | /* | 844 | /* |
837 | * If busy & slot are equal than it is either full or empty. If we are | 845 | * If busy & slot are equal than it is either full or empty. If we are |
838 | * starting to process requests then we are empty. Otherwise we are | 846 | * starting to process requests then we are empty. Otherwise we are |