ARM: imx: correct usecount of IPG, ARM and MMDC clk on i.mx6sl
Subsystems (3)
PATCH v2 1/1 ARM: imx: correct usecount of IPG, ARM and MMDC clk on i.mx6sl
IPG, ARM and MMDC's clock should be enabled during kernel boot up, so we need to maintain their use count, otherwise, they may be disabled unexpectedly if their children's clock are turned off, which is not allowed.
--- arch/arm/mach-imx/clk-imx6sl.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
arch/arm/mach-imx/clk-imx6sl.c +16 -0
@@ -291,6 +291,22 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)pr_warn ("%s: failed to set AHB clock rate %d!\n" , __func__, ret); +/* +* Make sure those always on clocks are enabled to maintain the correct +* usecount and enabling/disabling of parent PLLs. +*/ + ret =clk_prepare_enable (clks[IMX6SL_CLK_IPG ]); +if (ret) +pr_warn ("%s: failed to enable IPG clock %d\n" , __func__, ret); + + ret =clk_prepare_enable (clks[IMX6SL_CLK_ARM ]); +if (ret) +pr_warn ("%s: failed to enable ARM clock %d\n" , __func__, ret); + + ret =clk_prepare_enable (clks[IMX6SL_CLK_MMDC_ROOT ]); +if (ret) +pr_warn ("%s: failed to enable MMDC clock %d\n" , __func__, ret); +if (IS_ENABLED (CONFIG_USB_MXS_PHY )) {clk_prepare_enable (clks[IMX6SL_CLK_USBPHY1_GATE ]);clk_prepare_enable (clks[IMX6SL_CLK_USBPHY2_GATE ]);
Signature · 1 line
1.7.9.5
Fabio Estevam
reviewerPATCH v2 1/1 ARM: imx: correct usecount of IPG, ARM and MMDC clk on i.mx6sl
Quoted 15 lines · Anson Huang
IPG, ARM and MMDC's clock should be enabled during kernel boot up, so we need to maintain their use count, otherwise, they may be disabled unexpectedly if their children's clock are turned off, which is not allowed.
Signed-off-by Anson Huang <[email protected]>--- arch/arm/mach-imx/clk-imx6sl.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)arch/arm/mach-imx/clk-imx6sl.c +0
-0
arch/arm/mach-imx/clk-imx6sl.c static void __init imx6sl_clocks_init(struct device_node *ccm_node) · line 300
Quoted 10 lines
arch/arm/mach-imx/clk-imx6sl.c +7
-0@@ -291,6 +291,22 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)pr_warn ("%s: failed to set AHB clock rate %d!\n" , __func__, ret); +/* +* Make sure those always on clocks are enabled to maintain the correct +* usecount and enabling/disabling of parent PLLs. +*/ + ret =clk_prepare_enable (clks[IMX6SL_CLK_IPG ]); +if (ret) +pr_warn ("%s: failed to enable IPG clock %d\n" , __func__, ret);
What about adding WARN_ON(!ret ) ?
Regards,
Fabio Estevam
Sascha Hauer
maintainerPATCH v2 1/1 ARM: imx: correct usecount of IPG, ARM and MMDC clk on i.mx6sl
In reply to Anson HuangQuoted 24 lines · Anson Huang
IPG, ARM and MMDC's clock should be enabled during kernel boot up, so we need to maintain their use count, otherwise, they may be disabled unexpectedly if their children's clock are turned off, which is not allowed.
Signed-off-by Anson Huang <[email protected]>--- arch/arm/mach-imx/clk-imx6sl.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)arch/arm/mach-imx/clk-imx6sl.c +6
-0@@ -291,6 +291,22 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)pr_warn ("%s: failed to set AHB clock rate %d!\n" , __func__, ret); +/* +* Make sure those always on clocks are enabled to maintain the correct +* usecount and enabling/disabling of parent PLLs. +*/ + ret =clk_prepare_enable (clks[IMX6SL_CLK_IPG ]); +if (ret)
arch/arm/mach-imx/clk-imx6sl.c static void __init imx6sl_clocks_init(struct device_node *ccm_node) · line 309
Quoted 10 lines
arch/arm/mach-imx/clk-imx6sl.c +10
-0+pr_warn ("%s: failed to enable IPG clock %d\n" , __func__, ret); + + ret =clk_prepare_enable (clks[IMX6SL_CLK_ARM ]); +if (ret) +pr_warn ("%s: failed to enable ARM clock %d\n" , __func__, ret); + + ret =clk_prepare_enable (clks[IMX6SL_CLK_MMDC_ROOT ]); +if (ret) +pr_warn ("%s: failed to enable MMDC clock %d\n" , __func__, ret); +
Consider using a clk_init_on array like we have in clk-imx6q.c
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
PATCH v2 1/1 ARM: imx: correct usecount of IPG, ARM and MMDC clk on i.mx6sl
Quoted 38 lines · Sascha Hauer
Quoted 24 lines · Anson Huang
IPG, ARM and MMDC's clock should be enabled during kernel boot up, so we need to maintain their use count, otherwise, they may be disabled unexpectedly if their children's clock are turned off, which is not allowed.
Signed-off-by Anson Huang <[email protected]>--- arch/arm/mach-imx/clk-imx6sl.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)arch/arm/mach-imx/clk-imx6sl.c +6
-0@@ -291,6 +291,22 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)pr_warn ("%s: failed to set AHB clock rate %d!\n" , __func__, ret); +/* +* Make sure those always on clocks are enabled to maintain the correct +* usecount and enabling/disabling of parent PLLs. +*/ + ret =clk_prepare_enable (clks[IMX6SL_CLK_IPG ]); +if (ret)arch/arm/mach-imx/clk-imx6sl.c static void __init imx6sl_clocks_init(struct device_node *ccm_node) · line 309
Quoted 10 lines
arch/arm/mach-imx/clk-imx6sl.c +10
-0+pr_warn ("%s: failed to enable IPG clock %d\n" , __func__, ret); + + ret =clk_prepare_enable (clks[IMX6SL_CLK_ARM ]); +if (ret) +pr_warn ("%s: failed to enable ARM clock %d\n" , __func__, ret); + + ret =clk_prepare_enable (clks[IMX6SL_CLK_MMDC_ROOT ]); +if (ret) +pr_warn ("%s: failed to enable MMDC clock %d\n" , __func__, ret); +Consider using a
clk_init_onarray like we have inclk-imx6q.c
Quoted 2 lines
Sascha
Right, that can make code more clean, thanks for the comment, please help review V3 patch.
Anson.
Quoted 7 lines
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |