diff mbox series

[v3,3/4] usb: xhci-mtk: fix broken streams issue on 0.96 xHCI

Message ID 1617084157-18652-3-git-send-email-chunfeng.yun@mediatek.com (mailing list archive)
State New
Headers show
Series [v3,1/4] dt-bindings: usb: mtk-xhci: support property usb2-lpm-disable | expand

Commit Message

Chunfeng Yun March 30, 2021, 6:02 a.m. UTC
The MediaTek 0.96 xHCI controller on some platforms does not
support bulk stream even HCCPARAMS says supporting, due to MaxPSASize
is set a default value 1 by mistake, here use XHCI_BROKEN_STREAMS
quirk to fix it.

Fixes: 94a631d91ad3 ("usb: xhci-mtk: check hcc_params after adding primary hcd")
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
v2~3: no changes
---
 drivers/usb/host/xhci-mtk.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Frank Wunderlich March 30, 2021, 10:28 a.m. UTC | #1
Am 30. März 2021 08:02:36 MESZ schrieb Chunfeng Yun <chunfeng.yun@mediatek.com>:
>The MediaTek 0.96 xHCI controller on some platforms does not
>support bulk stream even HCCPARAMS says supporting, due to MaxPSASize
>is set a default value 1 by mistake, here use XHCI_BROKEN_STREAMS
>quirk to fix it.
>
>Fixes: 94a631d91ad3 ("usb: xhci-mtk: check hcc_params after adding
>primary hcd")
>Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
>---
>v2~3: no changes
>---
> drivers/usb/host/xhci-mtk.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
>index c1bc40289833..4e3d53cc24f4 100644
>--- a/drivers/usb/host/xhci-mtk.c
>+++ b/drivers/usb/host/xhci-mtk.c
>@@ -411,6 +411,13 @@ static void xhci_mtk_quirks(struct device *dev,
>struct xhci_hcd *xhci)
> 	xhci->quirks |= XHCI_SPURIOUS_SUCCESS;
> 	if (mtk->lpm_support)
> 		xhci->quirks |= XHCI_LPM_SUPPORT;
>+
>+	/*
>+	 * MTK xHCI 0.96: PSA is 1 by default even if doesn't support stream,
>+	 * and it's 3 when support it.
>+	 */
>+	if (xhci->hci_version < 0x100 && HCC_MAX_PSA(xhci->hcc_params) == 4)
>+		xhci->quirks |= XHCI_BROKEN_STREAMS;
> }
> 
> /* called during probe() after chip reset completes */
>@@ -572,7 +579,8 @@ static int xhci_mtk_probe(struct platform_device
>*pdev)
> 	if (ret)
> 		goto put_usb3_hcd;
> 
>-	if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
>+	if (HCC_MAX_PSA(xhci->hcc_params) >= 4 &&
>+	    !(xhci->quirks & XHCI_BROKEN_STREAMS))
> 		xhci->shared_hcd->can_do_streams = 1;
> 
> 	ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);

Hi,

Should this not be backported to stable?
The commit seems to be from 2017

How to reproduce the issue?
regards Frank
diff mbox series

Patch

diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index c1bc40289833..4e3d53cc24f4 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -411,6 +411,13 @@  static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci)
 	xhci->quirks |= XHCI_SPURIOUS_SUCCESS;
 	if (mtk->lpm_support)
 		xhci->quirks |= XHCI_LPM_SUPPORT;
+
+	/*
+	 * MTK xHCI 0.96: PSA is 1 by default even if doesn't support stream,
+	 * and it's 3 when support it.
+	 */
+	if (xhci->hci_version < 0x100 && HCC_MAX_PSA(xhci->hcc_params) == 4)
+		xhci->quirks |= XHCI_BROKEN_STREAMS;
 }
 
 /* called during probe() after chip reset completes */
@@ -572,7 +579,8 @@  static int xhci_mtk_probe(struct platform_device *pdev)
 	if (ret)
 		goto put_usb3_hcd;
 
-	if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
+	if (HCC_MAX_PSA(xhci->hcc_params) >= 4 &&
+	    !(xhci->quirks & XHCI_BROKEN_STREAMS))
 		xhci->shared_hcd->can_do_streams = 1;
 
 	ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);