Skip to contentSkip to conversation

dt-bindings: clocks: imx8mp: Add ID for usb suspend clock

PATCH Superseded Li Jun 4 participants 6 messages Sep 7, 2022 – Sep 13, 2022

Subsystems (4)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Li Jun

author
#0 lore raw

PATCH v2 1/2 dt-bindings: clocks: imx8mp: Add ID for usb suspend clock

usb suspend clock has a gate shared with usb_root_clk.

Fixes 9c140d9926761 ("clk: imx: Add support for i.MX8MP clock driver")
Cc [email protected] # v5.19+
---
 include/dt-bindings/clock/imx8mp-clock.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/dt-bindings/clock/imx8mp-clock.h +2 -1
index 9d5cc2ddde89..1417b7b1b7df 100644
@@ -324,8 +324,9 @@
 #define IMX8MP_CLK_CLKOUT2_SEL			317
 #define IMX8MP_CLK_CLKOUT2_DIV			318
 #define IMX8MP_CLK_CLKOUT2			319
+#define IMX8MP_CLK_USB_SUSP			320
 
-#define IMX8MP_CLK_END				320
+#define IMX8MP_CLK_END				321
 
 #define IMX8MP_CLK_AUDIOMIX_SAI1_IPG		0
 #define IMX8MP_CLK_AUDIOMIX_SAI1_MCLK1		1
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v2 2/2 clk: imx: imx8mp: add shared clk gate for usb suspend clk

32K usb suspend clock gate is shared with usb_root_clk.

Fixes 9c140d9926761 ("clk: imx: Add support for i.MX8MP clock driver")
Cc [email protected] # v5.19+
---
 drivers/clk/imx/clk-imx8mp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/imx/clk-imx8mp.c +3 -1
index e89db568f5a8..5b66514bdd0c 100644
@@ -17,6 +17,7 @@
 
 static u32 share_count_nand;
 static u32 share_count_media;
+static u32 share_count_usb;
 
 static const char * const pll_ref_sels[] = { "osc_24m", "dummy", "dummy", "dummy", };
 static const char * const audio_pll1_bypass_sels[] = {"audio_pll1", "audio_pll1_ref_sel", };
@@ -673,7 +674,8 @@ static int imx8mp_clocks_probe(struct platform_device *pdev)
 	hws[IMX8MP_CLK_UART2_ROOT] = imx_clk_hw_gate4("uart2_root_clk", "uart2", ccm_base + 0x44a0, 0);
 	hws[IMX8MP_CLK_UART3_ROOT] = imx_clk_hw_gate4("uart3_root_clk", "uart3", ccm_base + 0x44b0, 0);
 	hws[IMX8MP_CLK_UART4_ROOT] = imx_clk_hw_gate4("uart4_root_clk", "uart4", ccm_base + 0x44c0, 0);
-	hws[IMX8MP_CLK_USB_ROOT] = imx_clk_hw_gate4("usb_root_clk", "hsio_axi", ccm_base + 0x44d0, 0);
+	hws[IMX8MP_CLK_USB_ROOT] = imx_clk_hw_gate2_shared2("usb_root_clk", "hsio_axi", ccm_base + 0x44d0, 0, &share_count_usb);
+	hws[IMX8MP_CLK_USB_SUSP] = imx_clk_hw_gate2_shared2("usb_suspend_clk", "osc_32k", ccm_base + 0x44d0, 0, &share_count_usb);
 	hws[IMX8MP_CLK_USB_PHY_ROOT] = imx_clk_hw_gate4("usb_phy_root_clk", "usb_phy_ref", ccm_base + 0x44f0, 0);
 	hws[IMX8MP_CLK_USDHC1_ROOT] = imx_clk_hw_gate4("usdhc1_root_clk", "usdhc1", ccm_base + 0x4510, 0);
 	hws[IMX8MP_CLK_USDHC2_ROOT] = imx_clk_hw_gate4("usdhc2_root_clk", "usdhc2", ccm_base + 0x4520, 0);
Signature · 1 line
2.34.1
maintainer
#2 lore raw

Re: [PATCH v2 2/2] clk: imx: imx8mp: add shared clk gate for usb suspend clk

Quoted 1 line · Li Jun

32K usb suspend clock gate is shared with usb_root_clk.

So? What is the impact of not having this change? Why is it stable material? The commit message needs to answer those questions.

Quoted 39 lines
Fixes 9c140d9926761 ("clk: imx: Add support for i.MX8MP clock driver")
Cc [email protected] # v5.19+
---
 drivers/clk/imx/clk-imx8mp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/imx/clk-imx8mp.c +3 -1
index e89db568f5a8..5b66514bdd0c 100644
@@ -17,6 +17,7 @@
 
 static u32 share_count_nand;
 static u32 share_count_media;
+static u32 share_count_usb;
 
 static const char * const pll_ref_sels[] = { "osc_24m", "dummy", "dummy", "dummy", };
 static const char * const audio_pll1_bypass_sels[] = {"audio_pll1", "audio_pll1_ref_sel", };
@@ -673,7 +674,8 @@ static int imx8mp_clocks_probe(struct platform_device *pdev)
 	hws[IMX8MP_CLK_UART2_ROOT] = imx_clk_hw_gate4("uart2_root_clk", "uart2", ccm_base + 0x44a0, 0);
 	hws[IMX8MP_CLK_UART3_ROOT] = imx_clk_hw_gate4("uart3_root_clk", "uart3", ccm_base + 0x44b0, 0);
 	hws[IMX8MP_CLK_UART4_ROOT] = imx_clk_hw_gate4("uart4_root_clk", "uart4", ccm_base + 0x44c0, 0);
-	hws[IMX8MP_CLK_USB_ROOT] = imx_clk_hw_gate4("usb_root_clk", "hsio_axi", ccm_base + 0x44d0, 0);
+	hws[IMX8MP_CLK_USB_ROOT] = imx_clk_hw_gate2_shared2("usb_root_clk", "hsio_axi", ccm_base + 0x44d0, 0, &share_count_usb);
+	hws[IMX8MP_CLK_USB_SUSP] = imx_clk_hw_gate2_shared2("usb_suspend_clk", "osc_32k", ccm_base + 0x44d0, 0, &share_count_usb);
 	hws[IMX8MP_CLK_USB_PHY_ROOT] = imx_clk_hw_gate4("usb_phy_root_clk", "usb_phy_ref", ccm_base + 0x44f0, 0);
 	hws[IMX8MP_CLK_USDHC1_ROOT] = imx_clk_hw_gate4("usdhc1_root_clk", "usdhc1", ccm_base + 0x4510, 0);
 	hws[IMX8MP_CLK_USDHC2_ROOT] = imx_clk_hw_gate4("usdhc2_root_clk", "usdhc2", ccm_base + 0x4520, 0);
Signature · 7 lines
2.34.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author
#3 lore raw

RE: [PATCH v2 2/2] clk: imx: imx8mp: add shared clk gate for usb suspend clk

Quoted 14 lines

-----Original Message-----
From: Rob Herring <[email protected]>
Sent: Friday, September 9, 2022 12:38 AM
To: Jun Li <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; dl-linux-imx <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v2 2/2] clk: imx: imx8mp: add shared clk gate for usb suspend clk

Quoted 4 lines
Quoted 1 line · Li Jun

32K usb suspend clock gate is shared with usb_root_clk.

So? What is the impact of not having this change? Why is it stable material?

The history is this clock gate initially was defined to be only for usb suspend clk, usb suspend clk is never off while system is active or system sleep with usb wakeup enabled, so usb root clock is always fine.

On v5.19 a clock fix patch cf7f3f4fa9e5 ("clk: imx8mp: fix usb_root_clk parent") switched this clock gate to be only for usb root clock, this caused the problem, as usb root clk may be off when there is no USB data transfer, this cause the USB wakeup cannot work because the usb suspend clock is also gated off.

Quoted 1 line

The commit message needs to answer those questions.

Okay, I will improve the commit message for this.

Li Jun

Quoted 65 lines
Quoted 21 lines
Fixes 9c140d9926761 ("clk: imx: Add support for i.MX8MP clock

driver")

---
 drivers/clk/imx/clk-imx8mp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/clk/imx/clk-imx8mp.c index e89db568f5a8..5b66514bdd0c 100644

drivers/clk/imx/clk-imx8mp.c +1 -0
@@ -17,6 +17,7 @@
 
 static u32 share_count_nand;
 static u32 share_count_media;
+static u32 share_count_usb;
 
 static const char * const pll_ref_sels[] = { "osc_24m", "dummy",
Quoted 2 lines

"dummy", "dummy", }; static const char * const audio_pll1_bypass_sels[] = {"audio_pll1", "audio_pll1_ref_sel", }; @@

-673,7 +674,8 @@ static int imx8mp_clocks_probe(struct platform_device *pdev)

Quoted 1 line

hws[IMX8MP_CLK_UART2_ROOT] = imx_clk_hw_gate4("uart2_root_clk",

"uart2", ccm_base + 0x44a0, 0);

Quoted 1 line

hws[IMX8MP_CLK_UART3_ROOT] = imx_clk_hw_gate4("uart3_root_clk",

"uart3", ccm_base + 0x44b0, 0);

Quoted 1 line

hws[IMX8MP_CLK_UART4_ROOT] = imx_clk_hw_gate4("uart4_root_clk",

"uart4", ccm_base + 0x44c0, 0);

drivers/clk/imx/clk-imx8mp.c

Quoted 1 line
drivers/clk/imx/clk-imx8mp.c +0 -1
-	hws[IMX8MP_CLK_USB_ROOT] = imx_clk_hw_gate4("usb_root_clk",

"hsio_axi", ccm_base + 0x44d0, 0);

drivers/clk/imx/clk-imx8mp.c

Quoted 1 line
drivers/clk/imx/clk-imx8mp.c +1 -0
+	hws[IMX8MP_CLK_USB_ROOT] = imx_clk_hw_gate2_shared2("usb_root_clk",

"hsio_axi", ccm_base + 0x44d0, 0, &share_count_usb);

drivers/clk/imx/clk-imx8mp.c

Quoted 4 lines
drivers/clk/imx/clk-imx8mp.c +3 -0
+	hws[IMX8MP_CLK_USB_SUSP] =
+imx_clk_hw_gate2_shared2("usb_suspend_clk", "osc_32k", ccm_base +
+0x44d0, 0, &share_count_usb);
 	hws[IMX8MP_CLK_USB_PHY_ROOT] = imx_clk_hw_gate4("usb_phy_root_clk",

"usb_phy_ref", ccm_base + 0x44f0, 0);

Quoted 1 line

hws[IMX8MP_CLK_USDHC1_ROOT] = imx_clk_hw_gate4("usdhc1_root_clk",

"usdhc1", ccm_base + 0x4510, 0);

Quoted 10 lines

hws[IMX8MP_CLK_USDHC2_ROOT] = imx_clk_hw_gate4("usdhc2_root_clk",
"usdhc2", ccm_base + 0x4520, 0);
--
2.34.1

_______________________________________________
linux-arm-kernel mailing list
[email protected]

https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists

Quoted 1 line

.infradead.org%2Fmailman%2Flistinfo%2Flinux-arm-kernel&amp;data=05%7C

0

Quoted 1 line

1%7Cjun.li%40nxp.com%7C0b734c6a464d48a1d5f208da91b88a61%7C686ea1d3bc2b

Quoted 1 line

4c6fa92cd99c5c301635%7C0%7C0%7C637982519075609799%7CUnknown%7CTWFpbGZs

Quoted 1 line

b3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D

Quoted 1 line

%7C3000%7C%7C%7C&amp;sdata=XT8llTcoNGJ3pHH4uDn9tOFfKbRyQSJTJEC6lqycE7

o

Quoted 2 lines

%3D&amp;reserved=0

Tested-by on v2 1/2
#5 lore raw
In reply to Li Jun

Am Mittwoch, 7. September 2022, 12:37:07 CEST schrieb Li Jun:

Quoted 15 lines

usb suspend clock has a gate shared with usb_root_clk.

Fixes 9c140d9926761 ("clk: imx: Add support for i.MX8MP clock driver")
Cc [email protected] # v5.19+
---
 include/dt-bindings/clock/imx8mp-clock.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/include/dt-bindings/clock/imx8mp-clock.h index 9d5cc2ddde89..1417b7b1b7df 100644

include/dt-bindings/clock/imx8mp-clock.h line 332

Quoted 10 lines
include/dt-bindings/clock/imx8mp-clock.h +2 -1
@@ -324,8 +324,9 @@
 #define IMX8MP_CLK_CLKOUT2_SEL			317
 #define IMX8MP_CLK_CLKOUT2_DIV			318
 #define IMX8MP_CLK_CLKOUT2			319
+#define IMX8MP_CLK_USB_SUSP			320
 
-#define IMX8MP_CLK_END				320
+#define IMX8MP_CLK_END				321
 
 #define IMX8MP_CLK_AUDIOMIX_SAI1_IPG		0
 #define IMX8MP_CLK_AUDIOMIX_SAI1_MCLK1		1

Together with the series [1] & [2] this fixes devices detection when the onboard hub is in runtime suspend. For both patches:

[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/