aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChunfeng Yun <chunfeng.yun@mediatek.com>2017-12-08 11:10:06 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-12-08 12:26:34 -0500
commit72b663a99c074a8d073e7ecdae446cfb024ef551 (patch)
treeebf7f1fb721c33c05d207a0de089ccefdb46cc86
parent5d9b70f7d52eb14bb37861c663bae44de9521c35 (diff)
usb: xhci: fix TDS for MTK xHCI1.1
For MTK's xHCI 1.0 or latter, TD size is the number of max packet sized packets remaining in the TD, not including this TRB (following spec). For MTK's xHCI 0.96 and older, TD size is the number of max packet sized packets remaining in the TD, including this TRB (not following spec). Cc: stable <stable@vger.kernel.org> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/host/xhci-ring.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 6eb87c6e4d24..c5cbc685c691 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -3112,7 +3112,7 @@ static u32 xhci_td_remainder(struct xhci_hcd *xhci, int transferred,
3112{ 3112{
3113 u32 maxp, total_packet_count; 3113 u32 maxp, total_packet_count;
3114 3114
3115 /* MTK xHCI is mostly 0.97 but contains some features from 1.0 */ 3115 /* MTK xHCI 0.96 contains some features from 1.0 */
3116 if (xhci->hci_version < 0x100 && !(xhci->quirks & XHCI_MTK_HOST)) 3116 if (xhci->hci_version < 0x100 && !(xhci->quirks & XHCI_MTK_HOST))
3117 return ((td_total_len - transferred) >> 10); 3117 return ((td_total_len - transferred) >> 10);
3118 3118
@@ -3121,8 +3121,8 @@ static u32 xhci_td_remainder(struct xhci_hcd *xhci, int transferred,
3121 trb_buff_len == td_total_len) 3121 trb_buff_len == td_total_len)
3122 return 0; 3122 return 0;
3123 3123
3124 /* for MTK xHCI, TD size doesn't include this TRB */ 3124 /* for MTK xHCI 0.96, TD size include this TRB, but not in 1.x */
3125 if (xhci->quirks & XHCI_MTK_HOST) 3125 if ((xhci->quirks & XHCI_MTK_HOST) && (xhci->hci_version < 0x100))
3126 trb_buff_len = 0; 3126 trb_buff_len = 0;
3127 3127
3128 maxp = usb_endpoint_maxp(&urb->ep->desc); 3128 maxp = usb_endpoint_maxp(&urb->ep->desc);