Patchwork ARM i.MX25: clk: parent per5_clk to AHB clock

login
register
mail settings
Submitter Steffen Trumtrar
Date Jan. 30, 2013, 9:33 a.m.
Message ID <1359538435-21304-1-git-send-email-s.trumtrar@pengutronix.de>
Download mbox | patch
Permalink /patch/216798/
State New
Headers show

Comments

Steffen Trumtrar - Jan. 30, 2013, 9:33 a.m.
The mxc-timer on the imx25 needs to be derived from the AHB clock.
If a bootloader reparents this clock to the ipg_clk_highfreq, which according
to the datasheet is a valid operation, the system can/will produce lockups/
freezes after some time [1].

This can be forced with code like
	while(1)
                syscall(SYS_clock_gettime, CLOCK_REALTIME, &tp);

This was already fixed with the commit
	 "i.MX25 GPT clock fix: ensure correct the clock source" [2],
but it seems, that it got lost. So, re-add this to have a correct gpt.

[1]: http://lists.arm.linux.org.uk/lurker/message/20130129.161230.229bda17.en.html
[2]: 2012d9ca2a1381ae3e733330a7f0d1d2f1988bba

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Cc: stable@vger.kernel.org
---
 arch/arm/mach-imx/clk-imx25.c |    3 +++
 1 file changed, 3 insertions(+)
Uwe Kleine-König - Jan. 30, 2013, 9:53 a.m.
On Wed, Jan 30, 2013 at 10:33:55AM +0100, Steffen Trumtrar wrote:
> The mxc-timer on the imx25 needs to be derived from the AHB clock.
> If a bootloader reparents this clock to the ipg_clk_highfreq, which according
> to the datasheet is a valid operation, the system can/will produce lockups/
> freezes after some time [1].
> 
> This can be forced with code like
> 	while(1)
>                 syscall(SYS_clock_gettime, CLOCK_REALTIME, &tp);
> 
> This was already fixed with the commit
> 	 "i.MX25 GPT clock fix: ensure correct the clock source" [2],
> but it seems, that it got lost. So, re-add this to have a correct gpt.
> 
> [1]: http://lists.arm.linux.org.uk/lurker/message/20130129.161230.229bda17.en.html
> [2]: 2012d9ca2a1381ae3e733330a7f0d1d2f1988bba
Instead of the last paragraph I'd write:

	This problem was already fixed with commit

		2012d9c (i.MX25 GPT clock fix: ensure correct the clock source)

	for v3.1-rc2 but this was lost when i.MX was converted to the common
	clock framework (commit 6bbaec5; ARM i.MX25: implement clocks using
	common clock framework).

> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> Cc: stable@vger.kernel.org

Cc: stable@vger.kernel.org # v3.5+

Best regards
Uwe
Steffen Trumtrar - Jan. 30, 2013, 1:10 p.m.
On Wed, Jan 30, 2013 at 10:53:53AM +0100, Uwe Kleine-König wrote:
> On Wed, Jan 30, 2013 at 10:33:55AM +0100, Steffen Trumtrar wrote:
> > The mxc-timer on the imx25 needs to be derived from the AHB clock.
> > If a bootloader reparents this clock to the ipg_clk_highfreq, which according
> > to the datasheet is a valid operation, the system can/will produce lockups/
> > freezes after some time [1].
> > 
> > This can be forced with code like
> > 	while(1)
> >                 syscall(SYS_clock_gettime, CLOCK_REALTIME, &tp);
> > 
> > This was already fixed with the commit
> > 	 "i.MX25 GPT clock fix: ensure correct the clock source" [2],
> > but it seems, that it got lost. So, re-add this to have a correct gpt.
> > 
> > [1]: http://lists.arm.linux.org.uk/lurker/message/20130129.161230.229bda17.en.html
> > [2]: 2012d9ca2a1381ae3e733330a7f0d1d2f1988bba
> Instead of the last paragraph I'd write:
> 
> 	This problem was already fixed with commit
> 
> 		2012d9c (i.MX25 GPT clock fix: ensure correct the clock source)
> 
> 	for v3.1-rc2 but this was lost when i.MX was converted to the common
> 	clock framework (commit 6bbaec5; ARM i.MX25: implement clocks using
> 	common clock framework).
> 
> > Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> > Cc: stable@vger.kernel.org
> 
> Cc: stable@vger.kernel.org # v3.5+
> 

That is better. I will resend my patch in a sec with a new commit message.

Thanks,
Steffen

Patch

diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c
index 5d34f67..0e6dde6 100644
--- a/arch/arm/mach-imx/clk-imx25.c
+++ b/arch/arm/mach-imx/clk-imx25.c
@@ -177,6 +177,9 @@  static int __init __mx25_clocks_init(unsigned long osc_rate)
 			pr_err("i.MX25 clk %d: register failed with %ld\n",
 				i, PTR_ERR(clk[i]));
 
+	/* Clock source for gpt must be derived from AHB */
+	clk_set_parent(clk[per5_sel], clk[ahb]);
+
 	clk_register_clkdev(clk[ipg], "ipg", "imx-gpt.0");
 	clk_register_clkdev(clk[gpt_ipg_per], "per", "imx-gpt.0");