diff options
author | Zhuang Jin Can <jin.can.zhuang@intel.com> | 2014-05-15 17:57:57 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2014-06-19 09:51:07 -0400 |
commit | 5cd8c48d95c10f729090c89757727e090719fd83 (patch) | |
tree | b413d6182b8ac1892bd9f8f4a4f941b7c2964175 | |
parent | 7171511eaec5bf23fb06078f59784a3a0626b38f (diff) |
usb: dwc3: gadget: check link trb after free_slot is increased
In ISOC transfers, when free_slot points to the last TRB (i.e. Link
TRB), and all queued requests meet Missed Interval Isoc error, busy_slot
points to trb0.
busy_slot->trb0
trb1
...
free_slot->trb31(Link TRB)
After end transfer and receiving the XferNotReady event, trb_left is
caculated as 1 which is wrong, and no TRB will be primed to the
endpoint.
The root cause is free_slot is not increased the same way as busy_slot.
When busy_slot is increased by one, it checks if points to a link TRB
after increasement, but free_slot checks it before increasement.
free_slot should behave the same as busy_slot to make the trb_left
caculation correct.
Reviewed-by: Pratyush Anand <pratyush.anand@st.com>
Signed-off-by: Zhuang Jin Can <jin.can.zhuang@intel.com>
Signed-off-by: Jiebing Li <jiebing.li@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r-- | drivers/usb/dwc3/gadget.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 9d64dd02c57e..dab7927d1009 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -828,10 +828,6 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep, | |||
828 | length, last ? " last" : "", | 828 | length, last ? " last" : "", |
829 | chain ? " chain" : ""); | 829 | chain ? " chain" : ""); |
830 | 830 | ||
831 | /* Skip the LINK-TRB on ISOC */ | ||
832 | if (((dep->free_slot & DWC3_TRB_MASK) == DWC3_TRB_NUM - 1) && | ||
833 | usb_endpoint_xfer_isoc(dep->endpoint.desc)) | ||
834 | dep->free_slot++; | ||
835 | 831 | ||
836 | trb = &dep->trb_pool[dep->free_slot & DWC3_TRB_MASK]; | 832 | trb = &dep->trb_pool[dep->free_slot & DWC3_TRB_MASK]; |
837 | 833 | ||
@@ -843,6 +839,10 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep, | |||
843 | } | 839 | } |
844 | 840 | ||
845 | dep->free_slot++; | 841 | dep->free_slot++; |
842 | /* Skip the LINK-TRB on ISOC */ | ||
843 | if (((dep->free_slot & DWC3_TRB_MASK) == DWC3_TRB_NUM - 1) && | ||
844 | usb_endpoint_xfer_isoc(dep->endpoint.desc)) | ||
845 | dep->free_slot++; | ||
846 | 846 | ||
847 | trb->size = DWC3_TRB_SIZE_LENGTH(length); | 847 | trb->size = DWC3_TRB_SIZE_LENGTH(length); |
848 | trb->bpl = lower_32_bits(dma); | 848 | trb->bpl = lower_32_bits(dma); |