linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 1/4] dt-bindings: usb: mtk-xhci: support property usb2-lpm-disable
@ 2021-03-31  9:05 Chunfeng Yun
  2021-03-31  9:05 ` [PATCH v4 2/4] dt-bindings: usb: mtk-xhci: remove redefinitions of usb3-lpm-capable Chunfeng Yun
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Chunfeng Yun @ 2021-03-31  9:05 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Mathias Nyman
  Cc: Chunfeng Yun, Rob Herring, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, devicetree, linux-kernel,
	Eddie Hung, Nicolas Boichat, Frank Wunderlich

Add support common property usb2-lpm-disable

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
v4: add acked-by Rob
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


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

* [PATCH v4 2/4] dt-bindings: usb: mtk-xhci: remove redefinitions of usb3-lpm-capable
  2021-03-31  9:05 [PATCH v4 1/4] dt-bindings: usb: mtk-xhci: support property usb2-lpm-disable Chunfeng Yun
@ 2021-03-31  9:05 ` Chunfeng Yun
  2021-03-31  9:05 ` [PATCH v4 3/4] usb: xhci-mtk: fix broken streams issue on 0.96 xHCI Chunfeng Yun
  2021-03-31  9:05 ` [PATCH v4 4/4] usb: xhci-mtk: support quirk to disable usb2 lpm Chunfeng Yun
  2 siblings, 0 replies; 4+ messages in thread
From: Chunfeng Yun @ 2021-03-31  9:05 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Mathias Nyman
  Cc: Chunfeng Yun, Rob Herring, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, devicetree, linux-kernel,
	Eddie Hung, Nicolas Boichat, Frank Wunderlich

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.

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
v4: add acked-by Rob
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


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

* [PATCH v4 3/4] usb: xhci-mtk: fix broken streams issue on 0.96 xHCI
  2021-03-31  9:05 [PATCH v4 1/4] dt-bindings: usb: mtk-xhci: support property usb2-lpm-disable Chunfeng Yun
  2021-03-31  9:05 ` [PATCH v4 2/4] dt-bindings: usb: mtk-xhci: remove redefinitions of usb3-lpm-capable Chunfeng Yun
@ 2021-03-31  9:05 ` Chunfeng Yun
  2021-03-31  9:05 ` [PATCH v4 4/4] usb: xhci-mtk: support quirk to disable usb2 lpm Chunfeng Yun
  2 siblings, 0 replies; 4+ messages in thread
From: Chunfeng Yun @ 2021-03-31  9:05 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Mathias Nyman
  Cc: Chunfeng Yun, Rob Herring, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, devicetree, linux-kernel,
	Eddie Hung, Nicolas Boichat, Frank Wunderlich, stable

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")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
v4: cc stable suggested by Frank
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


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

* [PATCH v4 4/4] usb: xhci-mtk: support quirk to disable usb2 lpm
  2021-03-31  9:05 [PATCH v4 1/4] dt-bindings: usb: mtk-xhci: support property usb2-lpm-disable Chunfeng Yun
  2021-03-31  9:05 ` [PATCH v4 2/4] dt-bindings: usb: mtk-xhci: remove redefinitions of usb3-lpm-capable Chunfeng Yun
  2021-03-31  9:05 ` [PATCH v4 3/4] usb: xhci-mtk: fix broken streams issue on 0.96 xHCI Chunfeng Yun
@ 2021-03-31  9:05 ` Chunfeng Yun
  2 siblings, 0 replies; 4+ messages in thread
From: Chunfeng Yun @ 2021-03-31  9:05 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Mathias Nyman
  Cc: Chunfeng Yun, Rob Herring, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, devicetree, linux-kernel,
	Eddie Hung, Nicolas Boichat, Frank Wunderlich

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~4: 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] 4+ messages in thread

end of thread, other threads:[~2021-03-31  9:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-31  9:05 [PATCH v4 1/4] dt-bindings: usb: mtk-xhci: support property usb2-lpm-disable Chunfeng Yun
2021-03-31  9:05 ` [PATCH v4 2/4] dt-bindings: usb: mtk-xhci: remove redefinitions of usb3-lpm-capable Chunfeng Yun
2021-03-31  9:05 ` [PATCH v4 3/4] usb: xhci-mtk: fix broken streams issue on 0.96 xHCI Chunfeng Yun
2021-03-31  9:05 ` [PATCH v4 4/4] usb: xhci-mtk: support quirk to disable usb2 lpm Chunfeng Yun

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