diff mbox

ARM: imx: correct usecount of IPG, ARM and MMDC clk on i.mx6sl

Message ID 1390214690-13564-1-git-send-email-b20788@freescale.com
State New
Headers show

Commit Message

Anson Huang Jan. 20, 2014, 10:44 a.m. UTC
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 <b20788@freescale.com>
---
 arch/arm/mach-imx/clk-imx6sl.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Lucas Stach Jan. 21, 2014, 10:05 a.m. UTC | #1
Am Montag, den 20.01.2014, 18:44 +0800 schrieb 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 <b20788@freescale.com>
> ---
>  arch/arm/mach-imx/clk-imx6sl.c |   15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/arch/arm/mach-imx/clk-imx6sl.c b/arch/arm/mach-imx/clk-imx6sl.c
> index 78f3bd6..8d720f9 100644
> --- a/arch/arm/mach-imx/clk-imx6sl.c
> +++ b/arch/arm/mach-imx/clk-imx6sl.c
> @@ -291,6 +291,21 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
>  		pr_warn("%s: failed to set AHB clock rate %d!\n",
>  			__func__, ret);
>  
> +	/* Correct usecount of IPG clk */

You don't really correct anything here, so this comment is misleading.
If those are always on clocks, like you suggest in the commit message,
please put this in the comment instead.

Regards,
Lucas

> +	ret = clk_prepare_enable(clks[IMX6SL_CLK_IPG]);
> +	if (ret)
> +		pr_warn("%s: failed to enable IPG clock %d\n", __func__, ret);
> +
> +	/* Correct usecount of ARM clk */
> +	ret = clk_prepare_enable(clks[IMX6SL_CLK_ARM]);
> +	if (ret)
> +		pr_warn("%s: failed to enable ARM clock %d\n", __func__, ret);
> +
> +	/* Correct usecount of MMDC clk */
> +	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]);
Anson.Huang@freescale.com Jan. 21, 2014, 10:52 a.m. UTC | #2
Hi, Lucas
	Thanks for the comment, already improved the comment in V2 patch.

Best Regards.
Anson huang 黄勇才
 
Freescale Semiconductor Shanghai
上海浦东新区亮景路192号A座2楼
201203
Tel:021-28937058


>-----Original Message-----

>From: Lucas Stach [mailto:l.stach@pengutronix.de]

>Sent: Tuesday, January 21, 2014 6:05 PM

>To: Huang Yongcai-B20788

>Cc: shawn.guo@linaro.org; kernel@pengutronix.de; linux-arm-

>kernel@lists.infradead.org

>Subject: Re: [PATCH] ARM: imx: correct usecount of IPG, ARM and MMDC clk on

>i.mx6sl

>

>Am Montag, den 20.01.2014, 18:44 +0800 schrieb 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 <b20788@freescale.com>

>> ---

>>  arch/arm/mach-imx/clk-imx6sl.c |   15 +++++++++++++++

>>  1 file changed, 15 insertions(+)

>>

>> diff --git a/arch/arm/mach-imx/clk-imx6sl.c

>> b/arch/arm/mach-imx/clk-imx6sl.c index 78f3bd6..8d720f9 100644

>> --- a/arch/arm/mach-imx/clk-imx6sl.c

>> +++ b/arch/arm/mach-imx/clk-imx6sl.c

>> @@ -291,6 +291,21 @@ static void __init imx6sl_clocks_init(struct

>device_node *ccm_node)

>>  		pr_warn("%s: failed to set AHB clock rate %d!\n",

>>  			__func__, ret);

>>

>> +	/* Correct usecount of IPG clk */

>

>You don't really correct anything here, so this comment is misleading.

>If those are always on clocks, like you suggest in the commit message, please

>put this in the comment instead.

>

>Regards,

>Lucas

>

>> +	ret = clk_prepare_enable(clks[IMX6SL_CLK_IPG]);

>> +	if (ret)

>> +		pr_warn("%s: failed to enable IPG clock %d\n", __func__, ret);

>> +

>> +	/* Correct usecount of ARM clk */

>> +	ret = clk_prepare_enable(clks[IMX6SL_CLK_ARM]);

>> +	if (ret)

>> +		pr_warn("%s: failed to enable ARM clock %d\n", __func__, ret);

>> +

>> +	/* Correct usecount of MMDC clk */

>> +	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]);

>

>--

>Pengutronix e.K.                           | Lucas Stach                 |

>Industrial Linux Solutions                 | http://www.pengutronix.de/  |

>Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-5076 |

>Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

>

>
diff mbox

Patch

diff --git a/arch/arm/mach-imx/clk-imx6sl.c b/arch/arm/mach-imx/clk-imx6sl.c
index 78f3bd6..8d720f9 100644
--- a/arch/arm/mach-imx/clk-imx6sl.c
+++ b/arch/arm/mach-imx/clk-imx6sl.c
@@ -291,6 +291,21 @@  static void __init imx6sl_clocks_init(struct device_node *ccm_node)
 		pr_warn("%s: failed to set AHB clock rate %d!\n",
 			__func__, ret);
 
+	/* Correct usecount of IPG clk */
+	ret = clk_prepare_enable(clks[IMX6SL_CLK_IPG]);
+	if (ret)
+		pr_warn("%s: failed to enable IPG clock %d\n", __func__, ret);
+
+	/* Correct usecount of ARM clk */
+	ret = clk_prepare_enable(clks[IMX6SL_CLK_ARM]);
+	if (ret)
+		pr_warn("%s: failed to enable ARM clock %d\n", __func__, ret);
+
+	/* Correct usecount of MMDC clk */
+	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]);