devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: xhci: fix TDS for MTK xHCI1.1
@ 2017-12-06  6:42 Chunfeng Yun
  2017-12-07  6:55 ` Mathias Nyman
  0 siblings, 1 reply; 2+ messages in thread
From: Chunfeng Yun @ 2017-12-06  6:42 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: Greg Kroah-Hartman, Matthias Brugger, Felipe Balbi, Chunfeng Yun,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA

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).

Signed-off-by: Chunfeng Yun <chunfeng.yun-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
---
 drivers/usb/host/xhci-ring.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index c239c68..0619869 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -3108,7 +3108,7 @@ static u32 xhci_td_remainder(struct xhci_hcd *xhci, int transferred,
 {
 	u32 maxp, total_packet_count;
 
-	/* MTK xHCI is mostly 0.97 but contains some features from 1.0 */
+	/* MTK xHCI 0.96 contains some features from 1.0 */
 	if (xhci->hci_version < 0x100 && !(xhci->quirks & XHCI_MTK_HOST))
 		return ((td_total_len - transferred) >> 10);
 
@@ -3117,8 +3117,8 @@ static u32 xhci_td_remainder(struct xhci_hcd *xhci, int transferred,
 	    trb_buff_len == td_total_len)
 		return 0;
 
-	/* for MTK xHCI, TD size doesn't include this TRB */
-	if (xhci->quirks & XHCI_MTK_HOST)
+	/* for MTK xHCI 0.96, TD size include this TRB, but not in 1.x */
+	if ((xhci->quirks & XHCI_MTK_HOST) && (xhci->hci_version < 0x100))
 		trb_buff_len = 0;
 
 	maxp = usb_endpoint_maxp(&urb->ep->desc);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] usb: xhci: fix TDS for MTK xHCI1.1
  2017-12-06  6:42 [PATCH] usb: xhci: fix TDS for MTK xHCI1.1 Chunfeng Yun
@ 2017-12-07  6:55 ` Mathias Nyman
  0 siblings, 0 replies; 2+ messages in thread
From: Mathias Nyman @ 2017-12-07  6:55 UTC (permalink / raw)
  To: Chunfeng Yun, Mathias Nyman
  Cc: Greg Kroah-Hartman, Matthias Brugger, Felipe Balbi, linux-kernel,
	linux-arm-kernel, linux-usb, linux-mediatek, devicetree

On 06.12.2017 08:42, Chunfeng Yun wrote:
> 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).
> 
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---
>   drivers/usb/host/xhci-ring.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
> index c239c68..0619869 100644
> --- a/drivers/usb/host/xhci-ring.c
> +++ b/drivers/usb/host/xhci-ring.c
> @@ -3108,7 +3108,7 @@ static u32 xhci_td_remainder(struct xhci_hcd *xhci, int transferred,
>   {
>   	u32 maxp, total_packet_count;
>   
> -	/* MTK xHCI is mostly 0.97 but contains some features from 1.0 */
> +	/* MTK xHCI 0.96 contains some features from 1.0 */
>   	if (xhci->hci_version < 0x100 && !(xhci->quirks & XHCI_MTK_HOST))
>   		return ((td_total_len - transferred) >> 10);
>   
> @@ -3117,8 +3117,8 @@ static u32 xhci_td_remainder(struct xhci_hcd *xhci, int transferred,
>   	    trb_buff_len == td_total_len)
>   		return 0;
>   
> -	/* for MTK xHCI, TD size doesn't include this TRB */
> -	if (xhci->quirks & XHCI_MTK_HOST)
> +	/* for MTK xHCI 0.96, TD size include this TRB, but not in 1.x */
> +	if ((xhci->quirks & XHCI_MTK_HOST) && (xhci->hci_version < 0x100))
>   		trb_buff_len = 0;
>   
>   	maxp = usb_endpoint_maxp(&urb->ep->desc);
> 

Thanks, adding.
Adding stable tag as well

-Mathias

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-12-07  6:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-06  6:42 [PATCH] usb: xhci: fix TDS for MTK xHCI1.1 Chunfeng Yun
2017-12-07  6:55 ` Mathias Nyman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).