linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/13] dt-bindings: usb: mtk-xhci: support property usb2-lpm-disable
@ 2021-03-22  3:13 Chunfeng Yun
  2021-03-22  3:13 ` [PATCH 02/13] dt-bindings: usb: mtk-xhci: add support wakeup for mt8183 and mt8192 Chunfeng Yun
                   ` (11 more replies)
  0 siblings, 12 replies; 22+ messages in thread
From: Chunfeng Yun @ 2021-03-22  3:13 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Mathias Nyman
  Cc: Chunfeng Yun, Matthias Brugger, linux-usb, linux-arm-kernel,
	linux-mediatek, devicetree, linux-kernel, Eddie Hung,
	Nicolas Boichat

Add support common property usb2-lpm-disable

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

diff --git a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml
index 14f40efb3b22..2246d29a5e4e 100644
--- a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml
+++ b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml
@@ -103,6 +103,10 @@ properties:
     description: supports USB3.0 LPM
     type: boolean
 
+  usb2-lpm-disable:
+    description: disable USB2 HW LPM
+    type: boolean
+
   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] 22+ messages in thread

* [PATCH 02/13] dt-bindings: usb: mtk-xhci: add support wakeup for mt8183 and mt8192
  2021-03-22  3:13 [PATCH 01/13] dt-bindings: usb: mtk-xhci: support property usb2-lpm-disable Chunfeng Yun
@ 2021-03-22  3:13 ` Chunfeng Yun
  2021-03-22  3:13 ` [PATCH 03/13] dt-bindings: usb: mtu3: " Chunfeng Yun
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 22+ messages in thread
From: Chunfeng Yun @ 2021-03-22  3:13 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Mathias Nyman
  Cc: Chunfeng Yun, Matthias Brugger, linux-usb, linux-arm-kernel,
	linux-mediatek, devicetree, linux-kernel, Eddie Hung,
	Nicolas Boichat

These two HW of wakeup don't follow MediaTek internal IPM rule,
both use a specific way, like as early revision of mt8173.

Due to the index 2 already used by many DTS, it's better to keep
it unchanged for backward compatible, treat specific ones without
following IPM rule as revision 1.x, meanwhile reserve 3~10 for
later revisions with following the IPM rule.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 .../devicetree/bindings/usb/mediatek,mtk-xhci.yaml     | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml
index 2246d29a5e4e..f5dff7fb5755 100644
--- a/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml
+++ b/Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml
@@ -30,6 +30,7 @@ properties:
           - mediatek,mt7629-xhci
           - mediatek,mt8173-xhci
           - mediatek,mt8183-xhci
+          - mediatek,mt8192-xhci
       - const: mediatek,mtk-xhci
 
   reg:
@@ -131,10 +132,13 @@ properties:
         - description:
             The second cell represents the register base address of the glue
             layer in syscon
-        - description:
+        - description: |
             The third cell represents the hardware version of the glue layer,
-            1 is used by mt8173 etc, 2 is used by mt2712 etc
-          enum: [1, 2]
+            1 - used by mt8173 etc, revision 1 without following IPM rule;
+            2 - used by mt2712 etc, revision 2 following IPM rule;
+            11 - used by mt8183, specific 1.1;
+            12 - used by mt8192, specific 1.2;
+          enum: [1, 2, 11, 12]
 
   mediatek,u3p-dis-msk:
     $ref: /schemas/types.yaml#/definitions/uint32
-- 
2.18.0


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

* [PATCH 03/13] dt-bindings: usb: mtu3: support wakeup for mt8183 and mt8192
  2021-03-22  3:13 [PATCH 01/13] dt-bindings: usb: mtk-xhci: support property usb2-lpm-disable Chunfeng Yun
  2021-03-22  3:13 ` [PATCH 02/13] dt-bindings: usb: mtk-xhci: add support wakeup for mt8183 and mt8192 Chunfeng Yun
@ 2021-03-22  3:13 ` Chunfeng Yun
  2021-03-22  3:13 ` [PATCH 04/13] usb: xhci-mtk: fix broken streams issue on 0.96 xHCI Chunfeng Yun
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 22+ messages in thread
From: Chunfeng Yun @ 2021-03-22  3:13 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Mathias Nyman
  Cc: Chunfeng Yun, Matthias Brugger, linux-usb, linux-arm-kernel,
	linux-mediatek, devicetree, linux-kernel, Eddie Hung,
	Nicolas Boichat

These two HW of wakeup don't follow MediaTek internal IPM rule,
and both use a specific way, like as early revision of mt8173.

Due to the index 2 already used by many DTS, it's better to keep
it unchanged for backward compatible, treat specific ones without
following IPM rule as revision 1.x, meanwhile reserve 3~10 for
later revision that following the IPM rule.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 .../devicetree/bindings/usb/mediatek,mtu3.yaml         | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/mediatek,mtu3.yaml b/Documentation/devicetree/bindings/usb/mediatek,mtu3.yaml
index f5c04b9d2de9..918f9d6447c6 100644
--- a/Documentation/devicetree/bindings/usb/mediatek,mtu3.yaml
+++ b/Documentation/devicetree/bindings/usb/mediatek,mtu3.yaml
@@ -24,6 +24,7 @@ properties:
           - mediatek,mt2712-mtu3
           - mediatek,mt8173-mtu3
           - mediatek,mt8183-mtu3
+          - mediatek,mt8192-mtu3
       - const: mediatek,mtu3
 
   reg:
@@ -152,10 +153,13 @@ properties:
         - description:
             The second cell represents the register base address of the glue
             layer in syscon
-        - description:
+        - description: |
             The third cell represents the hardware version of the glue layer,
-            1 is used by mt8173 etc, 2 is used by mt2712 etc
-          enum: [1, 2]
+            1 - used by mt8173 etc, revision 1 without following IPM rule;
+            2 - used by mt2712 etc, revision 2 with following IPM rule;
+            11 - used by mt8183, specific 1.1;
+            12 - used by mt8192, specific 1.2;
+          enum: [1, 2, 11, 12]
 
   mediatek,u3p-dis-msk:
     $ref: /schemas/types.yaml#/definitions/uint32
-- 
2.18.0


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

* [PATCH 04/13] usb: xhci-mtk: fix broken streams issue on 0.96 xHCI
  2021-03-22  3:13 [PATCH 01/13] dt-bindings: usb: mtk-xhci: support property usb2-lpm-disable Chunfeng Yun
  2021-03-22  3:13 ` [PATCH 02/13] dt-bindings: usb: mtk-xhci: add support wakeup for mt8183 and mt8192 Chunfeng Yun
  2021-03-22  3:13 ` [PATCH 03/13] dt-bindings: usb: mtu3: " Chunfeng Yun
@ 2021-03-22  3:13 ` Chunfeng Yun
  2021-03-22  3:13 ` [PATCH 05/13] usb: xhci-mtk: support quirk to disable usb2 lpm Chunfeng Yun
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 22+ messages in thread
From: Chunfeng Yun @ 2021-03-22  3:13 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Mathias Nyman
  Cc: Chunfeng Yun, Matthias Brugger, linux-usb, linux-arm-kernel,
	linux-mediatek, devicetree, linux-kernel, Eddie Hung,
	Nicolas Boichat

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>
---
 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 57bcfdfa0465..1b9f10048fe0 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -388,6 +388,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 */
@@ -549,7 +556,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] 22+ messages in thread

* [PATCH 05/13] usb: xhci-mtk: support quirk to disable usb2 lpm
  2021-03-22  3:13 [PATCH 01/13] dt-bindings: usb: mtk-xhci: support property usb2-lpm-disable Chunfeng Yun
                   ` (2 preceding siblings ...)
  2021-03-22  3:13 ` [PATCH 04/13] usb: xhci-mtk: fix broken streams issue on 0.96 xHCI Chunfeng Yun
@ 2021-03-22  3:13 ` Chunfeng Yun
  2021-03-22  3:13 ` [PATCH 06/13] usb: xhci-mtk: support ip-sleep wakeup for MT8183 Chunfeng Yun
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 22+ messages in thread
From: Chunfeng Yun @ 2021-03-22  3:13 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Mathias Nyman
  Cc: Chunfeng Yun, 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>
---
 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 1b9f10048fe0..09f2ddbfe8b9 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -388,6 +388,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,
@@ -470,6 +472,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] 22+ messages in thread

* [PATCH 06/13] usb: xhci-mtk: support ip-sleep wakeup for MT8183
  2021-03-22  3:13 [PATCH 01/13] dt-bindings: usb: mtk-xhci: support property usb2-lpm-disable Chunfeng Yun
                   ` (3 preceding siblings ...)
  2021-03-22  3:13 ` [PATCH 05/13] usb: xhci-mtk: support quirk to disable usb2 lpm Chunfeng Yun
@ 2021-03-22  3:13 ` Chunfeng Yun
  2021-03-22  8:54   ` Sergei Shtylyov
  2021-03-23  9:07   ` kernel test robot
  2021-03-22  3:13 ` [PATCH 07/13] usb: xhci-mtk: add support ip-sleep wakeup for mT8192 Chunfeng Yun
                   ` (6 subsequent siblings)
  11 siblings, 2 replies; 22+ messages in thread
From: Chunfeng Yun @ 2021-03-22  3:13 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Mathias Nyman
  Cc: Chunfeng Yun, Matthias Brugger, linux-usb, linux-arm-kernel,
	linux-mediatek, devicetree, linux-kernel, Eddie Hung,
	Nicolas Boichat

Add support ip-sleep wakeup for MT8183, it's similar to MT8173,
and it's also a specific one, but not follow IPM rule.
Due to the index 2 already used by many DTS, it's better to keep
it unchanged for backward compatible, treat specific ones without
following IPM rule as revision 1.x, meanwhile reserve 3~10 for
later revision that follows the IPM rule.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/host/xhci-mtk.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index 09f2ddbfe8b9..8ba1f914cb75 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -57,12 +57,19 @@
 #define CTRL_U2_FORCE_PLL_STB	BIT(28)
 
 /* usb remote wakeup registers in syscon */
+
 /* mt8173 etc */
 #define PERI_WK_CTRL1	0x4
 #define WC1_IS_C(x)	(((x) & 0xf) << 26)  /* cycle debounce */
 #define WC1_IS_EN	BIT(25)
 #define WC1_IS_P	BIT(6)  /* polarity for ip sleep */
 
+/* mt8183 */
+#define PERI_WK_CTRL0	0x0
+#define WC0_IS_C(x)	(((x) & 0xf) << 28)  /* cycle debounce */
+#define WC0_IS_P	BIT(12)	/* polarity */
+#define WC0_IS_EN	BIT(6)
+
 /* mt2712 etc */
 #define PERI_SSUSB_SPM_CTRL	0x0
 #define SSC_IP_SLEEP_EN	BIT(4)
@@ -71,6 +78,7 @@
 enum ssusb_uwk_vers {
 	SSUSB_UWK_V1 = 1,
 	SSUSB_UWK_V2,
+	SSUSB_UWK_V11 = 11,	/* specific revision 1.1 */
 };
 
 static int xhci_mtk_host_enable(struct xhci_hcd_mtk *mtk)
@@ -300,6 +308,11 @@ static void usb_wakeup_ip_sleep_set(struct xhci_hcd_mtk *mtk, bool enable)
 		msk = WC1_IS_EN | WC1_IS_C(0xf) | WC1_IS_P;
 		val = enable ? (WC1_IS_EN | WC1_IS_C(0x8)) : 0;
 		break;
+	case SSUSB_UWK_V11:
+		reg = mtk->uwk_reg_base + PERI_WK_CTRL0;
+		msk = WC0_IS_EN | WC0_IS_C(0xf) | WC0_IS_P;
+		val = enable ? (WC0_IS_EN | WC0_IS_C(0x8)) : 0;
+		break;
 	case SSUSB_UWK_V2:
 		reg = mtk->uwk_reg_base + PERI_SSUSB_SPM_CTRL;
 		msk = SSC_IP_SLEEP_EN | SSC_SPM_INT_EN;
-- 
2.18.0


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

* [PATCH 07/13] usb: xhci-mtk: add support ip-sleep wakeup for mT8192
  2021-03-22  3:13 [PATCH 01/13] dt-bindings: usb: mtk-xhci: support property usb2-lpm-disable Chunfeng Yun
                   ` (4 preceding siblings ...)
  2021-03-22  3:13 ` [PATCH 06/13] usb: xhci-mtk: support ip-sleep wakeup for MT8183 Chunfeng Yun
@ 2021-03-22  3:13 ` Chunfeng Yun
  2021-03-22  8:58   ` Sergei Shtylyov
  2021-03-22  3:13 ` [PATCH 08/13] usb: xhci-mtk: drop CONFIG_OF Chunfeng Yun
                   ` (5 subsequent siblings)
  11 siblings, 1 reply; 22+ messages in thread
From: Chunfeng Yun @ 2021-03-22  3:13 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Mathias Nyman
  Cc: Chunfeng Yun, Matthias Brugger, linux-usb, linux-arm-kernel,
	linux-mediatek, devicetree, linux-kernel, Eddie Hung,
	Nicolas Boichat

Add support ip-sleep wakeup for mT8192, it's a specific revision,
and not follow IPM rule.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/host/xhci-mtk.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index 8ba1f914cb75..1bfa28c9b5a2 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -70,6 +70,10 @@
 #define WC0_IS_P	BIT(12)	/* polarity */
 #define WC0_IS_EN	BIT(6)
 
+/* mt8192 */
+#define WC0_SSUSB0_CDEN		BIT(6)
+#define WC0_IS_SPM_EN		BIT(1)
+
 /* mt2712 etc */
 #define PERI_SSUSB_SPM_CTRL	0x0
 #define SSC_IP_SLEEP_EN	BIT(4)
@@ -79,6 +83,7 @@ enum ssusb_uwk_vers {
 	SSUSB_UWK_V1 = 1,
 	SSUSB_UWK_V2,
 	SSUSB_UWK_V11 = 11,	/* specific revision 1.1 */
+	SSUSB_UWK_V12,		/* specific revision 1.2 */
 };
 
 static int xhci_mtk_host_enable(struct xhci_hcd_mtk *mtk)
@@ -313,6 +318,11 @@ static void usb_wakeup_ip_sleep_set(struct xhci_hcd_mtk *mtk, bool enable)
 		msk = WC0_IS_EN | WC0_IS_C(0xf) | WC0_IS_P;
 		val = enable ? (WC0_IS_EN | WC0_IS_C(0x8)) : 0;
 		break;
+	case SSUSB_UWK_V12:
+		reg = mtk->uwk_reg_base + PERI_WK_CTRL0;
+		msk = WC0_SSUSB0_CDEN | WC0_IS_SPM_EN;
+		val = enable ? msk : 0;
+		break;
 	case SSUSB_UWK_V2:
 		reg = mtk->uwk_reg_base + PERI_SSUSB_SPM_CTRL;
 		msk = SSC_IP_SLEEP_EN | SSC_SPM_INT_EN;
-- 
2.18.0


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

* [PATCH 08/13] usb: xhci-mtk: drop CONFIG_OF
  2021-03-22  3:13 [PATCH 01/13] dt-bindings: usb: mtk-xhci: support property usb2-lpm-disable Chunfeng Yun
                   ` (5 preceding siblings ...)
  2021-03-22  3:13 ` [PATCH 07/13] usb: xhci-mtk: add support ip-sleep wakeup for mT8192 Chunfeng Yun
@ 2021-03-22  3:13 ` Chunfeng Yun
  2021-03-22  3:13 ` [PATCH 09/13] usb: xhci-mtk: remove MODULE_ALIAS Chunfeng Yun
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 22+ messages in thread
From: Chunfeng Yun @ 2021-03-22  3:13 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Mathias Nyman
  Cc: Chunfeng Yun, Matthias Brugger, linux-usb, linux-arm-kernel,
	linux-mediatek, devicetree, linux-kernel, Eddie Hung,
	Nicolas Boichat

The driver can match only the devices created by the OF core
via the DT table, so the table should be always used.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/host/xhci-mtk.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index 1bfa28c9b5a2..7b49064ae5d4 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -689,14 +689,12 @@ static const struct dev_pm_ops xhci_mtk_pm_ops = {
 };
 #define DEV_PM_OPS IS_ENABLED(CONFIG_PM) ? &xhci_mtk_pm_ops : NULL
 
-#ifdef CONFIG_OF
 static const struct of_device_id mtk_xhci_of_match[] = {
 	{ .compatible = "mediatek,mt8173-xhci"},
 	{ .compatible = "mediatek,mtk-xhci"},
 	{ },
 };
 MODULE_DEVICE_TABLE(of, mtk_xhci_of_match);
-#endif
 
 static struct platform_driver mtk_xhci_driver = {
 	.probe	= xhci_mtk_probe,
@@ -704,7 +702,7 @@ static struct platform_driver mtk_xhci_driver = {
 	.driver	= {
 		.name = "xhci-mtk",
 		.pm = DEV_PM_OPS,
-		.of_match_table = of_match_ptr(mtk_xhci_of_match),
+		.of_match_table = mtk_xhci_of_match,
 	},
 };
 MODULE_ALIAS("platform:xhci-mtk");
-- 
2.18.0


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

* [PATCH 09/13] usb: xhci-mtk: remove MODULE_ALIAS
  2021-03-22  3:13 [PATCH 01/13] dt-bindings: usb: mtk-xhci: support property usb2-lpm-disable Chunfeng Yun
                   ` (6 preceding siblings ...)
  2021-03-22  3:13 ` [PATCH 08/13] usb: xhci-mtk: drop CONFIG_OF Chunfeng Yun
@ 2021-03-22  3:13 ` Chunfeng Yun
  2021-03-22  3:13 ` [PATCH 10/13] usb: mtu3: support ip-sleep wakeup for MT8183 Chunfeng Yun
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 22+ messages in thread
From: Chunfeng Yun @ 2021-03-22  3:13 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Mathias Nyman
  Cc: Chunfeng Yun, Matthias Brugger, linux-usb, linux-arm-kernel,
	linux-mediatek, devicetree, linux-kernel, Eddie Hung,
	Nicolas Boichat

Since the driver only supports the devices created by the OF
core, seems no need MODULE_ALIAS() anymore.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/host/xhci-mtk.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
index 7b49064ae5d4..888666c9d7bc 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -705,7 +705,6 @@ static struct platform_driver mtk_xhci_driver = {
 		.of_match_table = mtk_xhci_of_match,
 	},
 };
-MODULE_ALIAS("platform:xhci-mtk");
 
 static int __init xhci_mtk_init(void)
 {
-- 
2.18.0


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

* [PATCH 10/13] usb: mtu3: support ip-sleep wakeup for MT8183
  2021-03-22  3:13 [PATCH 01/13] dt-bindings: usb: mtk-xhci: support property usb2-lpm-disable Chunfeng Yun
                   ` (7 preceding siblings ...)
  2021-03-22  3:13 ` [PATCH 09/13] usb: xhci-mtk: remove MODULE_ALIAS Chunfeng Yun
@ 2021-03-22  3:13 ` Chunfeng Yun
  2021-03-22  8:57   ` Sergei Shtylyov
                     ` (2 more replies)
  2021-03-22  3:13 ` [PATCH 11/13] usb: mtu3: add support ip-sleep wakeup for MT8192 Chunfeng Yun
                   ` (2 subsequent siblings)
  11 siblings, 3 replies; 22+ messages in thread
From: Chunfeng Yun @ 2021-03-22  3:13 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Mathias Nyman
  Cc: Chunfeng Yun, Matthias Brugger, linux-usb, linux-arm-kernel,
	linux-mediatek, devicetree, linux-kernel, Eddie Hung,
	Nicolas Boichat

Add support ip-sleep wakeup for MT8183, it's similar to MT8173,
and it's also a specific one, but not follow IPM rule.
Due to the index 2 already used by many DTS, it's better to keep
it unchanged for backward compatible, treat specific ones without
following IPM rule as revision 1.x, meanwhile reserve 3~10 for later
revision that follows the IPM rule.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/mtu3/mtu3_host.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/usb/mtu3/mtu3_host.c b/drivers/usb/mtu3/mtu3_host.c
index c871b94f3e6f..e35b17e5f58e 100644
--- a/drivers/usb/mtu3/mtu3_host.c
+++ b/drivers/usb/mtu3/mtu3_host.c
@@ -24,6 +24,12 @@
 #define WC1_IS_EN	BIT(25)
 #define WC1_IS_P	BIT(6)  /* polarity for ip sleep */
 
+/* mt8183 */
+#define PERI_WK_CTRL0	0x0
+#define WC0_IS_C(x)	(((x) & 0xf) << 28)  /* cycle debounce */
+#define WC0_IS_P	BIT(12)	/* polarity */
+#define WC0_IS_EN	BIT(6)
+
 /* mt2712 etc */
 #define PERI_SSUSB_SPM_CTRL	0x0
 #define SSC_IP_SLEEP_EN	BIT(4)
@@ -32,6 +38,7 @@
 enum ssusb_uwk_vers {
 	SSUSB_UWK_V1 = 1,
 	SSUSB_UWK_V2,
+	SSUSB_UWK_V11 = 11,	/* specific revision 1.1 */
 };
 
 /*
@@ -48,6 +55,11 @@ static void ssusb_wakeup_ip_sleep_set(struct ssusb_mtk *ssusb, bool enable)
 		msk = WC1_IS_EN | WC1_IS_C(0xf) | WC1_IS_P;
 		val = enable ? (WC1_IS_EN | WC1_IS_C(0x8)) : 0;
 		break;
+	case SSUSB_UWK_V11:
+		reg = ssusb->uwk_reg_base + PERI_WK_CTRL0;
+		msk = WC0_IS_EN | WC0_IS_C(0xf) | WC0_IS_P;
+		val = enable ? (WC0_IS_EN | WC0_IS_C(0x8)) : 0;
+		break;
 	case SSUSB_UWK_V2:
 		reg = ssusb->uwk_reg_base + PERI_SSUSB_SPM_CTRL;
 		msk = SSC_IP_SLEEP_EN | SSC_SPM_INT_EN;
-- 
2.18.0


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

* [PATCH 11/13] usb: mtu3: add support ip-sleep wakeup for MT8192
  2021-03-22  3:13 [PATCH 01/13] dt-bindings: usb: mtk-xhci: support property usb2-lpm-disable Chunfeng Yun
                   ` (8 preceding siblings ...)
  2021-03-22  3:13 ` [PATCH 10/13] usb: mtu3: support ip-sleep wakeup for MT8183 Chunfeng Yun
@ 2021-03-22  3:13 ` Chunfeng Yun
  2021-03-22  3:13 ` [PATCH 12/13] usb: mtu3: drop CONFIG_OF Chunfeng Yun
  2021-03-22  3:13 ` [PATCH 13/13] arm64: dts: mt8183: update wakeup register offset Chunfeng Yun
  11 siblings, 0 replies; 22+ messages in thread
From: Chunfeng Yun @ 2021-03-22  3:13 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Mathias Nyman
  Cc: Chunfeng Yun, Matthias Brugger, linux-usb, linux-arm-kernel,
	linux-mediatek, devicetree, linux-kernel, Eddie Hung,
	Nicolas Boichat

Add add support ip-sleep wakeup for MT8192, it's a specific
revision, not follow IP rule.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/mtu3/mtu3_host.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/usb/mtu3/mtu3_host.c b/drivers/usb/mtu3/mtu3_host.c
index e35b17e5f58e..601656f436a1 100644
--- a/drivers/usb/mtu3/mtu3_host.c
+++ b/drivers/usb/mtu3/mtu3_host.c
@@ -30,6 +30,10 @@
 #define WC0_IS_P	BIT(12)	/* polarity */
 #define WC0_IS_EN	BIT(6)
 
+/* mt8192 */
+#define WC0_SSUSB0_CDEN		BIT(6)
+#define WC0_IS_SPM_EN		BIT(1)
+
 /* mt2712 etc */
 #define PERI_SSUSB_SPM_CTRL	0x0
 #define SSC_IP_SLEEP_EN	BIT(4)
@@ -39,6 +43,7 @@ enum ssusb_uwk_vers {
 	SSUSB_UWK_V1 = 1,
 	SSUSB_UWK_V2,
 	SSUSB_UWK_V11 = 11,	/* specific revision 1.1 */
+	SSUSB_UWK_V12,		/* specific revision 1.2 */
 };
 
 /*
@@ -60,6 +65,11 @@ static void ssusb_wakeup_ip_sleep_set(struct ssusb_mtk *ssusb, bool enable)
 		msk = WC0_IS_EN | WC0_IS_C(0xf) | WC0_IS_P;
 		val = enable ? (WC0_IS_EN | WC0_IS_C(0x8)) : 0;
 		break;
+	case SSUSB_UWK_V12:
+		reg = ssusb->uwk_reg_base + PERI_WK_CTRL0;
+		msk = WC0_SSUSB0_CDEN | WC0_IS_SPM_EN;
+		val = enable ? msk : 0;
+		break;
 	case SSUSB_UWK_V2:
 		reg = ssusb->uwk_reg_base + PERI_SSUSB_SPM_CTRL;
 		msk = SSC_IP_SLEEP_EN | SSC_SPM_INT_EN;
-- 
2.18.0


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

* [PATCH 12/13] usb: mtu3: drop CONFIG_OF
  2021-03-22  3:13 [PATCH 01/13] dt-bindings: usb: mtk-xhci: support property usb2-lpm-disable Chunfeng Yun
                   ` (9 preceding siblings ...)
  2021-03-22  3:13 ` [PATCH 11/13] usb: mtu3: add support ip-sleep wakeup for MT8192 Chunfeng Yun
@ 2021-03-22  3:13 ` Chunfeng Yun
  2021-03-22  3:13 ` [PATCH 13/13] arm64: dts: mt8183: update wakeup register offset Chunfeng Yun
  11 siblings, 0 replies; 22+ messages in thread
From: Chunfeng Yun @ 2021-03-22  3:13 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Mathias Nyman
  Cc: Chunfeng Yun, Matthias Brugger, linux-usb, linux-arm-kernel,
	linux-mediatek, devicetree, linux-kernel, Eddie Hung,
	Nicolas Boichat

The driver can match only the devices created by the OF core
via the DT table, so the table should be always used.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/mtu3/mtu3_plat.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c
index d44d5417438d..7786a95a874e 100644
--- a/drivers/usb/mtu3/mtu3_plat.c
+++ b/drivers/usb/mtu3/mtu3_plat.c
@@ -502,25 +502,20 @@ static const struct dev_pm_ops mtu3_pm_ops = {
 
 #define DEV_PM_OPS (IS_ENABLED(CONFIG_PM) ? &mtu3_pm_ops : NULL)
 
-#ifdef CONFIG_OF
-
 static const struct of_device_id mtu3_of_match[] = {
 	{.compatible = "mediatek,mt8173-mtu3",},
 	{.compatible = "mediatek,mtu3",},
 	{},
 };
-
 MODULE_DEVICE_TABLE(of, mtu3_of_match);
 
-#endif
-
 static struct platform_driver mtu3_driver = {
 	.probe = mtu3_probe,
 	.remove = mtu3_remove,
 	.driver = {
 		.name = MTU3_DRIVER_NAME,
 		.pm = DEV_PM_OPS,
-		.of_match_table = of_match_ptr(mtu3_of_match),
+		.of_match_table = mtu3_of_match,
 	},
 };
 module_platform_driver(mtu3_driver);
-- 
2.18.0


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

* [PATCH 13/13] arm64: dts: mt8183: update wakeup register offset
  2021-03-22  3:13 [PATCH 01/13] dt-bindings: usb: mtk-xhci: support property usb2-lpm-disable Chunfeng Yun
                   ` (10 preceding siblings ...)
  2021-03-22  3:13 ` [PATCH 12/13] usb: mtu3: drop CONFIG_OF Chunfeng Yun
@ 2021-03-22  3:13 ` Chunfeng Yun
  11 siblings, 0 replies; 22+ messages in thread
From: Chunfeng Yun @ 2021-03-22  3:13 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Mathias Nyman
  Cc: Chunfeng Yun, Matthias Brugger, linux-usb, linux-arm-kernel,
	linux-mediatek, devicetree, linux-kernel, Eddie Hung,
	Nicolas Boichat

Use wakeup control register offset exactly, and update revision
number

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 arch/arm64/boot/dts/mediatek/mt8183.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
index 80519a145f13..9d18a938150c 100644
--- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi
@@ -874,7 +874,7 @@
 			clocks = <&infracfg CLK_INFRA_UNIPRO_SCK>,
 				 <&infracfg CLK_INFRA_USB>;
 			clock-names = "sys_ck", "ref_ck";
-			mediatek,syscon-wakeup = <&pericfg 0x400 0>;
+			mediatek,syscon-wakeup = <&pericfg 0x420 11>;
 			#address-cells = <2>;
 			#size-cells = <2>;
 			ranges;
-- 
2.18.0


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

* Re: [PATCH 06/13] usb: xhci-mtk: support ip-sleep wakeup for MT8183
  2021-03-22  3:13 ` [PATCH 06/13] usb: xhci-mtk: support ip-sleep wakeup for MT8183 Chunfeng Yun
@ 2021-03-22  8:54   ` Sergei Shtylyov
  2021-03-23  2:39     ` Chunfeng Yun
  2021-03-23  9:07   ` kernel test robot
  1 sibling, 1 reply; 22+ messages in thread
From: Sergei Shtylyov @ 2021-03-22  8:54 UTC (permalink / raw)
  To: Chunfeng Yun, Greg Kroah-Hartman, Rob Herring, Mathias Nyman
  Cc: Matthias Brugger, linux-usb, linux-arm-kernel, linux-mediatek,
	devicetree, linux-kernel, Eddie Hung, Nicolas Boichat

Hello!

On 22.03.2021 6:13, Chunfeng Yun wrote:

> Add support ip-sleep wakeup for MT8183, it's similar to MT8173,
              ^ for

> and it's also a specific one, but not follow IPM rule.

    Following?

> Due to the index 2 already used by many DTS, it's better to keep
> it unchanged for backward compatible, treat specific ones without

    Compatibility.

> following IPM rule as revision 1.x, meanwhile reserve 3~10 for
> later revision that follows the IPM rule.
> 
> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---
>   drivers/usb/host/xhci-mtk.c | 13 +++++++++++++
>   1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
> index 09f2ddbfe8b9..8ba1f914cb75 100644
> --- a/drivers/usb/host/xhci-mtk.c
> +++ b/drivers/usb/host/xhci-mtk.c
> @@ -57,12 +57,19 @@
>   #define CTRL_U2_FORCE_PLL_STB	BIT(28)
>   
>   /* usb remote wakeup registers in syscon */
> +
>   /* mt8173 etc */
>   #define PERI_WK_CTRL1	0x4
>   #define WC1_IS_C(x)	(((x) & 0xf) << 26)  /* cycle debounce */
>   #define WC1_IS_EN	BIT(25)
>   #define WC1_IS_P	BIT(6)  /* polarity for ip sleep */
>   
> +/* mt8183 */
> +#define PERI_WK_CTRL0	0x0
> +#define WC0_IS_C(x)	(((x) & 0xf) << 28)  /* cycle debounce */
> +#define WC0_IS_P	BIT(12)	/* polarity */
> +#define WC0_IS_EN	BIT(6)
> +
>   /* mt2712 etc */
>   #define PERI_SSUSB_SPM_CTRL	0x0
>   #define SSC_IP_SLEEP_EN	BIT(4)
> @@ -71,6 +78,7 @@
>   enum ssusb_uwk_vers {
>   	SSUSB_UWK_V1 = 1,
>   	SSUSB_UWK_V2,
> +	SSUSB_UWK_V11 = 11,	/* specific revision 1.1 */

    SSUSB_UWK_V1_1, maybe?

[...]

MBR, Sergei

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

* Re: [PATCH 10/13] usb: mtu3: support ip-sleep wakeup for MT8183
  2021-03-22  3:13 ` [PATCH 10/13] usb: mtu3: support ip-sleep wakeup for MT8183 Chunfeng Yun
@ 2021-03-22  8:57   ` Sergei Shtylyov
  2021-03-23  2:40     ` Chunfeng Yun
  2021-03-22 17:51   ` kernel test robot
  2021-03-23  9:14   ` kernel test robot
  2 siblings, 1 reply; 22+ messages in thread
From: Sergei Shtylyov @ 2021-03-22  8:57 UTC (permalink / raw)
  To: Chunfeng Yun, Greg Kroah-Hartman, Rob Herring, Mathias Nyman
  Cc: Matthias Brugger, linux-usb, linux-arm-kernel, linux-mediatek,
	devicetree, linux-kernel, Eddie Hung, Nicolas Boichat

Same comments as to the patch #6.

MBR, Sergei

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

* Re: [PATCH 07/13] usb: xhci-mtk: add support ip-sleep wakeup for mT8192
  2021-03-22  3:13 ` [PATCH 07/13] usb: xhci-mtk: add support ip-sleep wakeup for mT8192 Chunfeng Yun
@ 2021-03-22  8:58   ` Sergei Shtylyov
  2021-03-23  2:39     ` Chunfeng Yun
  0 siblings, 1 reply; 22+ messages in thread
From: Sergei Shtylyov @ 2021-03-22  8:58 UTC (permalink / raw)
  To: Chunfeng Yun, Greg Kroah-Hartman, Rob Herring, Mathias Nyman
  Cc: Matthias Brugger, linux-usb, linux-arm-kernel, linux-mediatek,
	devicetree, linux-kernel, Eddie Hung, Nicolas Boichat

On 22.03.2021 6:13, Chunfeng Yun wrote:

> Add support ip-sleep wakeup for mT8192, it's a specific revision,
              ^ for

> and not follow IPM rule.

    Following?

> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> ---
>   drivers/usb/host/xhci-mtk.c | 10 ++++++++++
>   1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
> index 8ba1f914cb75..1bfa28c9b5a2 100644
> --- a/drivers/usb/host/xhci-mtk.c
> +++ b/drivers/usb/host/xhci-mtk.c
> @@ -70,6 +70,10 @@
>   #define WC0_IS_P	BIT(12)	/* polarity */
>   #define WC0_IS_EN	BIT(6)
>   
> +/* mt8192 */
> +#define WC0_SSUSB0_CDEN		BIT(6)
> +#define WC0_IS_SPM_EN		BIT(1)
> +
>   /* mt2712 etc */
>   #define PERI_SSUSB_SPM_CTRL	0x0
>   #define SSC_IP_SLEEP_EN	BIT(4)
> @@ -79,6 +83,7 @@ enum ssusb_uwk_vers {
>   	SSUSB_UWK_V1 = 1,
>   	SSUSB_UWK_V2,
>   	SSUSB_UWK_V11 = 11,	/* specific revision 1.1 */
> +	SSUSB_UWK_V12,		/* specific revision 1.2 */

    SSUSB_UWK_V1_2, maybe?

[...]

MBR, Sergei

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

* Re: [PATCH 10/13] usb: mtu3: support ip-sleep wakeup for MT8183
  2021-03-22  3:13 ` [PATCH 10/13] usb: mtu3: support ip-sleep wakeup for MT8183 Chunfeng Yun
  2021-03-22  8:57   ` Sergei Shtylyov
@ 2021-03-22 17:51   ` kernel test robot
  2021-03-23  9:14   ` kernel test robot
  2 siblings, 0 replies; 22+ messages in thread
From: kernel test robot @ 2021-03-22 17:51 UTC (permalink / raw)
  To: Chunfeng Yun, Greg Kroah-Hartman, Rob Herring, Mathias Nyman
  Cc: kbuild-all, Chunfeng Yun, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, devicetree, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 3579 bytes --]

Hi Chunfeng,

I love your patch! Perhaps something to improve:

[auto build test WARNING on usb/usb-testing]
[also build test WARNING on robh/for-next linus/master v5.12-rc4 next-20210322]
[cannot apply to mediatek/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Chunfeng-Yun/dt-bindings-usb-mtk-xhci-support-property-usb2-lpm-disable/20210322-111651
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: ia64-randconfig-r002-20210322 (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/6c0e65b02daf53e661d1804f081cb75fda28b916
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Chunfeng-Yun/dt-bindings-usb-mtk-xhci-support-property-usb2-lpm-disable/20210322-111651
        git checkout 6c0e65b02daf53e661d1804f081cb75fda28b916
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=ia64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from arch/ia64/include/asm/pgtable.h:154,
                    from include/linux/pgtable.h:6,
                    from arch/ia64/include/asm/uaccess.h:40,
                    from include/linux/uaccess.h:11,
                    from arch/ia64/include/asm/sections.h:11,
                    from include/linux/interrupt.h:20,
                    from arch/ia64/include/asm/hw_irq.h:10,
                    from include/linux/irq.h:589,
                    from drivers/usb/mtu3/mtu3_host.c:12:
   arch/ia64/include/asm/mmu_context.h: In function 'reload_context':
   arch/ia64/include/asm/mmu_context.h:127:41: warning: variable 'old_rr4' set but not used [-Wunused-but-set-variable]
     127 |  unsigned long rr0, rr1, rr2, rr3, rr4, old_rr4;
         |                                         ^~~~~~~
   In file included from include/linux/bits.h:6,
                    from include/linux/bitops.h:6,
                    from include/linux/kernel.h:11,
                    from include/linux/clk.h:13,
                    from drivers/usb/mtu3/mtu3_host.c:10:
   drivers/usb/mtu3/mtu3_host.c: In function 'ssusb_wakeup_ip_sleep_set':
>> include/vdso/bits.h:7:19: warning: conversion from 'long unsigned int' to 'u32' {aka 'unsigned int'} changes value from '18446744073441120320' to '4026536000' [-Woverflow]
       7 | #define BIT(nr)   (UL(1) << (nr))
         |                   ^
   drivers/usb/mtu3/mtu3_host.c:31:19: note: in expansion of macro 'BIT'
      31 | #define WC0_IS_EN BIT(6)
         |                   ^~~
   drivers/usb/mtu3/mtu3_host.c:60:9: note: in expansion of macro 'WC0_IS_EN'
      60 |   msk = WC0_IS_EN | WC0_IS_C(0xf) | WC0_IS_P;
         |         ^~~~~~~~~


vim +7 include/vdso/bits.h

3945ff37d2f48d Vincenzo Frascino 2020-03-20  6  
3945ff37d2f48d Vincenzo Frascino 2020-03-20 @7  #define BIT(nr)			(UL(1) << (nr))
3945ff37d2f48d Vincenzo Frascino 2020-03-20  8  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 35207 bytes --]

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

* Re: [PATCH 06/13] usb: xhci-mtk: support ip-sleep wakeup for MT8183
  2021-03-22  8:54   ` Sergei Shtylyov
@ 2021-03-23  2:39     ` Chunfeng Yun
  0 siblings, 0 replies; 22+ messages in thread
From: Chunfeng Yun @ 2021-03-23  2:39 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Greg Kroah-Hartman, Rob Herring, Mathias Nyman, Matthias Brugger,
	linux-usb, linux-arm-kernel, linux-mediatek, devicetree,
	linux-kernel, Eddie Hung, Nicolas Boichat

On Mon, 2021-03-22 at 11:54 +0300, Sergei Shtylyov wrote:
> Hello!
> 
> On 22.03.2021 6:13, Chunfeng Yun wrote:
> 
> > Add support ip-sleep wakeup for MT8183, it's similar to MT8173,
>               ^ for
> 
> > and it's also a specific one, but not follow IPM rule.
> 
>     Following?
Ack
> 
> > Due to the index 2 already used by many DTS, it's better to keep
> > it unchanged for backward compatible, treat specific ones without
> 
>     Compatibility.
Ack
> 
> > following IPM rule as revision 1.x, meanwhile reserve 3~10 for
> > later revision that follows the IPM rule.
> > 
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > ---
> >   drivers/usb/host/xhci-mtk.c | 13 +++++++++++++
> >   1 file changed, 13 insertions(+)
> > 
> > diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
> > index 09f2ddbfe8b9..8ba1f914cb75 100644
> > --- a/drivers/usb/host/xhci-mtk.c
> > +++ b/drivers/usb/host/xhci-mtk.c
> > @@ -57,12 +57,19 @@
> >   #define CTRL_U2_FORCE_PLL_STB	BIT(28)
> >   
> >   /* usb remote wakeup registers in syscon */
> > +
> >   /* mt8173 etc */
> >   #define PERI_WK_CTRL1	0x4
> >   #define WC1_IS_C(x)	(((x) & 0xf) << 26)  /* cycle debounce */
> >   #define WC1_IS_EN	BIT(25)
> >   #define WC1_IS_P	BIT(6)  /* polarity for ip sleep */
> >   
> > +/* mt8183 */
> > +#define PERI_WK_CTRL0	0x0
> > +#define WC0_IS_C(x)	(((x) & 0xf) << 28)  /* cycle debounce */
> > +#define WC0_IS_P	BIT(12)	/* polarity */
> > +#define WC0_IS_EN	BIT(6)
> > +
> >   /* mt2712 etc */
> >   #define PERI_SSUSB_SPM_CTRL	0x0
> >   #define SSC_IP_SLEEP_EN	BIT(4)
> > @@ -71,6 +78,7 @@
> >   enum ssusb_uwk_vers {
> >   	SSUSB_UWK_V1 = 1,
> >   	SSUSB_UWK_V2,
> > +	SSUSB_UWK_V11 = 11,	/* specific revision 1.1 */
> 
>     SSUSB_UWK_V1_1, maybe?
Good point, will modify it.

Thanks a lot

> 
> [...]
> 
> MBR, Sergei


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

* Re: [PATCH 07/13] usb: xhci-mtk: add support ip-sleep wakeup for mT8192
  2021-03-22  8:58   ` Sergei Shtylyov
@ 2021-03-23  2:39     ` Chunfeng Yun
  0 siblings, 0 replies; 22+ messages in thread
From: Chunfeng Yun @ 2021-03-23  2:39 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Greg Kroah-Hartman, Rob Herring, Mathias Nyman, Matthias Brugger,
	linux-usb, linux-arm-kernel, linux-mediatek, devicetree,
	linux-kernel, Eddie Hung, Nicolas Boichat

On Mon, 2021-03-22 at 11:58 +0300, Sergei Shtylyov wrote:
> On 22.03.2021 6:13, Chunfeng Yun wrote:
> 
> > Add support ip-sleep wakeup for mT8192, it's a specific revision,
>               ^ for
> 
> > and not follow IPM rule.
> 
>     Following?
> 
> > Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
> > ---
> >   drivers/usb/host/xhci-mtk.c | 10 ++++++++++
> >   1 file changed, 10 insertions(+)
> > 
> > diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
> > index 8ba1f914cb75..1bfa28c9b5a2 100644
> > --- a/drivers/usb/host/xhci-mtk.c
> > +++ b/drivers/usb/host/xhci-mtk.c
> > @@ -70,6 +70,10 @@
> >   #define WC0_IS_P	BIT(12)	/* polarity */
> >   #define WC0_IS_EN	BIT(6)
> >   
> > +/* mt8192 */
> > +#define WC0_SSUSB0_CDEN		BIT(6)
> > +#define WC0_IS_SPM_EN		BIT(1)
> > +
> >   /* mt2712 etc */
> >   #define PERI_SSUSB_SPM_CTRL	0x0
> >   #define SSC_IP_SLEEP_EN	BIT(4)
> > @@ -79,6 +83,7 @@ enum ssusb_uwk_vers {
> >   	SSUSB_UWK_V1 = 1,
> >   	SSUSB_UWK_V2,
> >   	SSUSB_UWK_V11 = 11,	/* specific revision 1.1 */
> > +	SSUSB_UWK_V12,		/* specific revision 1.2 */
> 
>     SSUSB_UWK_V1_2, maybe?
Ok, will do it, thanks a lot

> 
> [...]
> 
> MBR, Sergei


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

* Re: [PATCH 10/13] usb: mtu3: support ip-sleep wakeup for MT8183
  2021-03-22  8:57   ` Sergei Shtylyov
@ 2021-03-23  2:40     ` Chunfeng Yun
  0 siblings, 0 replies; 22+ messages in thread
From: Chunfeng Yun @ 2021-03-23  2:40 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Greg Kroah-Hartman, Rob Herring, Mathias Nyman, Matthias Brugger,
	linux-usb, linux-arm-kernel, linux-mediatek, devicetree,
	linux-kernel, Eddie Hung, Nicolas Boichat

On Mon, 2021-03-22 at 11:57 +0300, Sergei Shtylyov wrote:
> Same comments as to the patch #6.
Ok, will check others, thanks a lot

> 
> MBR, Sergei


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

* Re: [PATCH 06/13] usb: xhci-mtk: support ip-sleep wakeup for MT8183
  2021-03-22  3:13 ` [PATCH 06/13] usb: xhci-mtk: support ip-sleep wakeup for MT8183 Chunfeng Yun
  2021-03-22  8:54   ` Sergei Shtylyov
@ 2021-03-23  9:07   ` kernel test robot
  1 sibling, 0 replies; 22+ messages in thread
From: kernel test robot @ 2021-03-23  9:07 UTC (permalink / raw)
  To: Chunfeng Yun, Greg Kroah-Hartman, Rob Herring, Mathias Nyman
  Cc: kbuild-all, Chunfeng Yun, Matthias Brugger, linux-usb,
	linux-arm-kernel, linux-mediatek, devicetree, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2743 bytes --]

Hi Chunfeng,

I love your patch! Perhaps something to improve:

[auto build test WARNING on usb/usb-testing]
[also build test WARNING on robh/for-next linus/master v5.12-rc4 next-20210323]
[cannot apply to mediatek/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Chunfeng-Yun/dt-bindings-usb-mtk-xhci-support-property-usb2-lpm-disable/20210322-111651
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: alpha-allyesconfig (attached as .config)
compiler: alpha-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/519248a4690ce1617790e13220fb52badd09b0c9
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Chunfeng-Yun/dt-bindings-usb-mtk-xhci-support-property-usb2-lpm-disable/20210322-111651
        git checkout 519248a4690ce1617790e13220fb52badd09b0c9
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=alpha 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from include/linux/bits.h:6,
                    from include/linux/bitops.h:6,
                    from include/linux/kernel.h:11,
                    from include/linux/clk.h:13,
                    from drivers/usb/host/xhci-mtk.c:10:
   drivers/usb/host/xhci-mtk.c: In function 'usb_wakeup_ip_sleep_set':
>> include/vdso/bits.h:7:19: warning: conversion from 'long unsigned int' to 'u32' {aka 'unsigned int'} changes value from '18446744073441120320' to '4026536000' [-Woverflow]
       7 | #define BIT(nr)   (UL(1) << (nr))
         |                   ^
   drivers/usb/host/xhci-mtk.c:71:19: note: in expansion of macro 'BIT'
      71 | #define WC0_IS_EN BIT(6)
         |                   ^~~
   drivers/usb/host/xhci-mtk.c:313:9: note: in expansion of macro 'WC0_IS_EN'
     313 |   msk = WC0_IS_EN | WC0_IS_C(0xf) | WC0_IS_P;
         |         ^~~~~~~~~


vim +7 include/vdso/bits.h

3945ff37d2f48d Vincenzo Frascino 2020-03-20  6  
3945ff37d2f48d Vincenzo Frascino 2020-03-20 @7  #define BIT(nr)			(UL(1) << (nr))
3945ff37d2f48d Vincenzo Frascino 2020-03-20  8  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 67681 bytes --]

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

* Re: [PATCH 10/13] usb: mtu3: support ip-sleep wakeup for MT8183
  2021-03-22  3:13 ` [PATCH 10/13] usb: mtu3: support ip-sleep wakeup for MT8183 Chunfeng Yun
  2021-03-22  8:57   ` Sergei Shtylyov
  2021-03-22 17:51   ` kernel test robot
@ 2021-03-23  9:14   ` kernel test robot
  2 siblings, 0 replies; 22+ messages in thread
From: kernel test robot @ 2021-03-23  9:14 UTC (permalink / raw)
  To: Chunfeng Yun, Greg Kroah-Hartman, Rob Herring, Mathias Nyman
  Cc: kbuild-all, clang-built-linux, Chunfeng Yun, Matthias Brugger,
	linux-usb, linux-arm-kernel, linux-mediatek, devicetree,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 3525 bytes --]

Hi Chunfeng,

I love your patch! Perhaps something to improve:

[auto build test WARNING on usb/usb-testing]
[also build test WARNING on robh/for-next linus/master v5.12-rc4 next-20210323]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Chunfeng-Yun/dt-bindings-usb-mtk-xhci-support-property-usb2-lpm-disable/20210322-111651
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: arm64-randconfig-r031-20210322 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 14696baaf4c43fe53f738bc292bbe169eed93d5d)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://github.com/0day-ci/linux/commit/6c0e65b02daf53e661d1804f081cb75fda28b916
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Chunfeng-Yun/dt-bindings-usb-mtk-xhci-support-property-usb2-lpm-disable/20210322-111651
        git checkout 6c0e65b02daf53e661d1804f081cb75fda28b916
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/usb/mtu3/mtu3_host.c:60:35: warning: implicit conversion from 'unsigned long' to 'u32' (aka 'unsigned int') changes value from 18446744073441120320 to 4026536000 [-Wconstant-conversion]
                   msk = WC0_IS_EN | WC0_IS_C(0xf) | WC0_IS_P;
                       ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
   drivers/usb/mtu3/mtu3_host.c:61:29: warning: implicit conversion from 'unsigned long' to 'u32' (aka 'unsigned int') changes value from 18446744071562068032 to 2147483712 [-Wconstant-conversion]
                   val = enable ? (WC0_IS_EN | WC0_IS_C(0x8)) : 0;
                       ~           ~~~~~~~~~~^~~~~~~~~~~~~~~
   2 warnings generated.


vim +60 drivers/usb/mtu3/mtu3_host.c

    43	
    44	/*
    45	 * ip-sleep wakeup mode:
    46	 * all clocks can be turn off, but power domain should be kept on
    47	 */
    48	static void ssusb_wakeup_ip_sleep_set(struct ssusb_mtk *ssusb, bool enable)
    49	{
    50		u32 reg, msk, val;
    51	
    52		switch (ssusb->uwk_vers) {
    53		case SSUSB_UWK_V1:
    54			reg = ssusb->uwk_reg_base + PERI_WK_CTRL1;
    55			msk = WC1_IS_EN | WC1_IS_C(0xf) | WC1_IS_P;
    56			val = enable ? (WC1_IS_EN | WC1_IS_C(0x8)) : 0;
    57			break;
    58		case SSUSB_UWK_V11:
    59			reg = ssusb->uwk_reg_base + PERI_WK_CTRL0;
  > 60			msk = WC0_IS_EN | WC0_IS_C(0xf) | WC0_IS_P;
    61			val = enable ? (WC0_IS_EN | WC0_IS_C(0x8)) : 0;
    62			break;
    63		case SSUSB_UWK_V2:
    64			reg = ssusb->uwk_reg_base + PERI_SSUSB_SPM_CTRL;
    65			msk = SSC_IP_SLEEP_EN | SSC_SPM_INT_EN;
    66			val = enable ? msk : 0;
    67			break;
    68		default:
    69			return;
    70		}
    71		regmap_update_bits(ssusb->uwk, reg, msk, val);
    72	}
    73	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 36904 bytes --]

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

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

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-22  3:13 [PATCH 01/13] dt-bindings: usb: mtk-xhci: support property usb2-lpm-disable Chunfeng Yun
2021-03-22  3:13 ` [PATCH 02/13] dt-bindings: usb: mtk-xhci: add support wakeup for mt8183 and mt8192 Chunfeng Yun
2021-03-22  3:13 ` [PATCH 03/13] dt-bindings: usb: mtu3: " Chunfeng Yun
2021-03-22  3:13 ` [PATCH 04/13] usb: xhci-mtk: fix broken streams issue on 0.96 xHCI Chunfeng Yun
2021-03-22  3:13 ` [PATCH 05/13] usb: xhci-mtk: support quirk to disable usb2 lpm Chunfeng Yun
2021-03-22  3:13 ` [PATCH 06/13] usb: xhci-mtk: support ip-sleep wakeup for MT8183 Chunfeng Yun
2021-03-22  8:54   ` Sergei Shtylyov
2021-03-23  2:39     ` Chunfeng Yun
2021-03-23  9:07   ` kernel test robot
2021-03-22  3:13 ` [PATCH 07/13] usb: xhci-mtk: add support ip-sleep wakeup for mT8192 Chunfeng Yun
2021-03-22  8:58   ` Sergei Shtylyov
2021-03-23  2:39     ` Chunfeng Yun
2021-03-22  3:13 ` [PATCH 08/13] usb: xhci-mtk: drop CONFIG_OF Chunfeng Yun
2021-03-22  3:13 ` [PATCH 09/13] usb: xhci-mtk: remove MODULE_ALIAS Chunfeng Yun
2021-03-22  3:13 ` [PATCH 10/13] usb: mtu3: support ip-sleep wakeup for MT8183 Chunfeng Yun
2021-03-22  8:57   ` Sergei Shtylyov
2021-03-23  2:40     ` Chunfeng Yun
2021-03-22 17:51   ` kernel test robot
2021-03-23  9:14   ` kernel test robot
2021-03-22  3:13 ` [PATCH 11/13] usb: mtu3: add support ip-sleep wakeup for MT8192 Chunfeng Yun
2021-03-22  3:13 ` [PATCH 12/13] usb: mtu3: drop CONFIG_OF Chunfeng Yun
2021-03-22  3:13 ` [PATCH 13/13] arm64: dts: mt8183: update wakeup register offset 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).