All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/4] dt-bindings: usb: mtk-xhci: support property usb2-lpm-disable
@ 2021-03-30  6:02 Chunfeng Yun
  2021-03-30  6:02 ` [PATCH v3 2/4] dt-bindings: usb: mtk-xhci: remove redefinitions of usb3-lpm-capable Chunfeng Yun
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Chunfeng Yun @ 2021-03-30  6:02 UTC (permalink / raw)
  To: Chunfeng Yun; +Cc: linux-mediatek

Add support common property usb2-lpm-disable

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
v3: remove redefinition of type and description suggested by Rob
v2: no changes
---
 Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml
index 45bf4ea00c9e..291749f49f35 100644
--- a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml
+++ b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml
@@ -104,6 +104,8 @@ properties:
     description: supports USB3.0 LPM
     type: boolean
 
+  usb2-lpm-disable: true
+
   imod-interval-ns:
     description:
       Interrupt moderation interval value, it is 8 times as much as that
-- 
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* [PATCH v3 2/4] dt-bindings: usb: mtk-xhci: remove redefinitions of usb3-lpm-capable
  2021-03-30  6:02 [PATCH v3 1/4] dt-bindings: usb: mtk-xhci: support property usb2-lpm-disable Chunfeng Yun
@ 2021-03-30  6:02 ` Chunfeng Yun
  2021-03-30  6:02 ` [PATCH v3 3/4] usb: xhci-mtk: fix broken streams issue on 0.96 xHCI Chunfeng Yun
  2021-03-30  6:02 ` [PATCH v3 4/4] usb: xhci-mtk: support quirk to disable usb2 lpm Chunfeng Yun
  2 siblings, 0 replies; 6+ messages in thread
From: Chunfeng Yun @ 2021-03-30  6:02 UTC (permalink / raw)
  To: Chunfeng Yun; +Cc: linux-mediatek

The property usb3-lpm-capable is defined in usb-xhci.yaml which is
already referenced in this file, so no need 'description' and 'type'
anymore.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
v3: new patch
---
 Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml
index 291749f49f35..69c3e7d0f9dd 100644
--- a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml
+++ b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml
@@ -100,9 +100,7 @@ properties:
   vbus-supply:
     description: Regulator of USB VBUS5v
 
-  usb3-lpm-capable:
-    description: supports USB3.0 LPM
-    type: boolean
+  usb3-lpm-capable: true
 
   usb2-lpm-disable: true
 
-- 
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* [PATCH v3 3/4] usb: xhci-mtk: fix broken streams issue on 0.96 xHCI
  2021-03-30  6:02 [PATCH v3 1/4] dt-bindings: usb: mtk-xhci: support property usb2-lpm-disable Chunfeng Yun
  2021-03-30  6:02 ` [PATCH v3 2/4] dt-bindings: usb: mtk-xhci: remove redefinitions of usb3-lpm-capable Chunfeng Yun
@ 2021-03-30  6:02 ` Chunfeng Yun
  2021-03-30 10:28   ` Frank Wunderlich
  2021-03-30  6:02 ` [PATCH v3 4/4] usb: xhci-mtk: support quirk to disable usb2 lpm Chunfeng Yun
  2 siblings, 1 reply; 6+ messages in thread
From: Chunfeng Yun @ 2021-03-30  6:02 UTC (permalink / raw)
  To: Chunfeng Yun; +Cc: linux-mediatek

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);
-- 
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* [PATCH v3 4/4] usb: xhci-mtk: support quirk to disable usb2 lpm
  2021-03-30  6:02 [PATCH v3 1/4] dt-bindings: usb: mtk-xhci: support property usb2-lpm-disable Chunfeng Yun
  2021-03-30  6:02 ` [PATCH v3 2/4] dt-bindings: usb: mtk-xhci: remove redefinitions of usb3-lpm-capable Chunfeng Yun
  2021-03-30  6:02 ` [PATCH v3 3/4] usb: xhci-mtk: fix broken streams issue on 0.96 xHCI Chunfeng Yun
@ 2021-03-30  6:02 ` Chunfeng Yun
  2 siblings, 0 replies; 6+ messages in thread
From: Chunfeng Yun @ 2021-03-30  6:02 UTC (permalink / raw)
  To: Chunfeng Yun; +Cc: linux-mediatek

The xHCI driver support usb2 HW LPM by default, here add support
XHCI_HW_LPM_DISABLE quirk, then we can disable usb2 lpm when
need it.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
v2~3: no changes
---
 drivers/usb/host/xhci-mtk.c | 3 +++
 drivers/usb/host/xhci-mtk.h | 1 +
 2 files changed, 4 insertions(+)

diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index 4e3d53cc24f4..744639d23fa8 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -411,6 +411,8 @@ 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;
+	if (mtk->u2_lpm_disable)
+		xhci->quirks |= XHCI_HW_LPM_DISABLE;
 
 	/*
 	 * MTK xHCI 0.96: PSA is 1 by default even if doesn't support stream,
@@ -493,6 +495,7 @@ static int xhci_mtk_probe(struct platform_device *pdev)
 		return ret;
 
 	mtk->lpm_support = of_property_read_bool(node, "usb3-lpm-capable");
+	mtk->u2_lpm_disable = of_property_read_bool(node, "usb2-lpm-disable");
 	/* optional property, ignore the error if it does not exist */
 	of_property_read_u32(node, "mediatek,u3p-dis-msk",
 			     &mtk->u3p_dis_msk);
diff --git a/drivers/usb/host/xhci-mtk.h b/drivers/usb/host/xhci-mtk.h
index 621ec1a85009..4ccd08e20a15 100644
--- a/drivers/usb/host/xhci-mtk.h
+++ b/drivers/usb/host/xhci-mtk.h
@@ -149,6 +149,7 @@ struct xhci_hcd_mtk {
 	struct phy **phys;
 	int num_phys;
 	bool lpm_support;
+	bool u2_lpm_disable;
 	/* usb remote wakeup */
 	bool uwk_en;
 	struct regmap *uwk;
-- 
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [PATCH v3 3/4] usb: xhci-mtk: fix broken streams issue on 0.96 xHCI
  2021-03-30  6:02 ` [PATCH v3 3/4] usb: xhci-mtk: fix broken streams issue on 0.96 xHCI Chunfeng Yun
@ 2021-03-30 10:28   ` Frank Wunderlich
  0 siblings, 0 replies; 6+ messages in thread
From: Frank Wunderlich @ 2021-03-30 10:28 UTC (permalink / raw)
  To: linux-mediatek

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

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* [PATCH v3 4/4] usb: xhci-mtk: support quirk to disable usb2 lpm
  2021-03-29  7:20 [PATCH v3 1/4] dt-bindings: usb: mtk-xhci: support property usb2-lpm-disable Chunfeng Yun
@ 2021-03-29  7:20 ` Chunfeng Yun
  0 siblings, 0 replies; 6+ messages in thread
From: Chunfeng Yun @ 2021-03-29  7:20 UTC (permalink / raw)
  To: Rob Herring, Mathias Nyman
  Cc: Chunfeng Yun, Greg Kroah-Hartman, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, devicetree, linux-kernel,
	Eddie Hung, Nicolas Boichat

The xHCI driver support usb2 HW LPM by default, here add support
XHCI_HW_LPM_DISABLE quirk, then we can disable usb2 lpm when
need it.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
v2~3: no changes
---
 drivers/usb/host/xhci-mtk.c | 3 +++
 drivers/usb/host/xhci-mtk.h | 1 +
 2 files changed, 4 insertions(+)

diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index 4e3d53cc24f4..744639d23fa8 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -411,6 +411,8 @@ 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;
+	if (mtk->u2_lpm_disable)
+		xhci->quirks |= XHCI_HW_LPM_DISABLE;
 
 	/*
 	 * MTK xHCI 0.96: PSA is 1 by default even if doesn't support stream,
@@ -493,6 +495,7 @@ static int xhci_mtk_probe(struct platform_device *pdev)
 		return ret;
 
 	mtk->lpm_support = of_property_read_bool(node, "usb3-lpm-capable");
+	mtk->u2_lpm_disable = of_property_read_bool(node, "usb2-lpm-disable");
 	/* optional property, ignore the error if it does not exist */
 	of_property_read_u32(node, "mediatek,u3p-dis-msk",
 			     &mtk->u3p_dis_msk);
diff --git a/drivers/usb/host/xhci-mtk.h b/drivers/usb/host/xhci-mtk.h
index 621ec1a85009..4ccd08e20a15 100644
--- a/drivers/usb/host/xhci-mtk.h
+++ b/drivers/usb/host/xhci-mtk.h
@@ -149,6 +149,7 @@ struct xhci_hcd_mtk {
 	struct phy **phys;
 	int num_phys;
 	bool lpm_support;
+	bool u2_lpm_disable;
 	/* usb remote wakeup */
 	bool uwk_en;
 	struct regmap *uwk;
-- 
2.18.0


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

end of thread, other threads:[~2021-03-30 10:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-30  6:02 [PATCH v3 1/4] dt-bindings: usb: mtk-xhci: support property usb2-lpm-disable Chunfeng Yun
2021-03-30  6:02 ` [PATCH v3 2/4] dt-bindings: usb: mtk-xhci: remove redefinitions of usb3-lpm-capable Chunfeng Yun
2021-03-30  6:02 ` [PATCH v3 3/4] usb: xhci-mtk: fix broken streams issue on 0.96 xHCI Chunfeng Yun
2021-03-30 10:28   ` Frank Wunderlich
2021-03-30  6:02 ` [PATCH v3 4/4] usb: xhci-mtk: support quirk to disable usb2 lpm Chunfeng Yun
  -- strict thread matches above, loose matches on Subject: below --
2021-03-29  7:20 [PATCH v3 1/4] dt-bindings: usb: mtk-xhci: support property usb2-lpm-disable Chunfeng Yun
2021-03-29  7:20 ` [PATCH v3 4/4] usb: xhci-mtk: support quirk to disable usb2 lpm Chunfeng Yun

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.