public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: OMAP: fix default sys_ck.rate for boot-time DPLL detection
@ 2007-10-19 21:14 Kevin Hilman
  2007-10-22  0:11 ` Tony Lindgren
  2007-10-22  7:24 ` Igor Stoppa
  0 siblings, 2 replies; 6+ messages in thread
From: Kevin Hilman @ 2007-10-19 21:14 UTC (permalink / raw)
  To: linux-omap-open-source

In the clock init code, the DPLL value set by the bootloader is
queried, but always turns zero due it's parent clock (sys_ck) having
no default rate.  This results in the improper setting of the default
PRCM rate-table entry and any queries of virt_prcm_set rate to return 0.

Following the example of the TI kernel, set the default sys_ck rate to
13MHz.  Could then be overridden in board setup code.

Signed-off-by: Kevin Hilman <khilman@mvista.com>

---
 arch/arm/mach-omap2/clock24xx.h |    1 +
 1 file changed, 1 insertion(+)

Index: dev/arch/arm/mach-omap2/clock24xx.h
===================================================================
--- dev.orig/arch/arm/mach-omap2/clock24xx.h
+++ dev/arch/arm/mach-omap2/clock24xx.h
@@ -581,6 +581,7 @@ static struct clk osc_ck = {		/* (*12, *
 /* With out modem likely 12MHz, with modem likely 13MHz */
 static struct clk sys_ck = {		/* (*12, *13, 19.2, 26, 38.4)MHz */
 	.name		= "sys_ck",		/* ~ ref_clk also */
+	.rate           = 13000000,
 	.parent		= &osc_ck,
 	.flags		= CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X |
 				ALWAYS_ENABLED | RATE_PROPAGATES,
--

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

* Re: [PATCH] ARM: OMAP: fix default sys_ck.rate for boot-time DPLL detection
  2007-10-19 21:14 [PATCH] ARM: OMAP: fix default sys_ck.rate for boot-time DPLL detection Kevin Hilman
@ 2007-10-22  0:11 ` Tony Lindgren
  2007-10-22  7:24 ` Igor Stoppa
  1 sibling, 0 replies; 6+ messages in thread
From: Tony Lindgren @ 2007-10-22  0:11 UTC (permalink / raw)
  To: Kevin Hilman; +Cc: linux-omap-open-source

* Kevin Hilman <khilman@mvista.com> [071019 14:16]:
> In the clock init code, the DPLL value set by the bootloader is
> queried, but always turns zero due it's parent clock (sys_ck) having
> no default rate.  This results in the improper setting of the default
> PRCM rate-table entry and any queries of virt_prcm_set rate to return 0.
> 
> Following the example of the TI kernel, set the default sys_ck rate to
> 13MHz.  Could then be overridden in board setup code.
> 
> Signed-off-by: Kevin Hilman <khilman@mvista.com>
> 
> ---
>  arch/arm/mach-omap2/clock24xx.h |    1 +
>  1 file changed, 1 insertion(+)
> 
> Index: dev/arch/arm/mach-omap2/clock24xx.h
> ===================================================================
> --- dev.orig/arch/arm/mach-omap2/clock24xx.h
> +++ dev/arch/arm/mach-omap2/clock24xx.h
> @@ -581,6 +581,7 @@ static struct clk osc_ck = {		/* (*12, *
>  /* With out modem likely 12MHz, with modem likely 13MHz */
>  static struct clk sys_ck = {		/* (*12, *13, 19.2, 26, 38.4)MHz */
>  	.name		= "sys_ck",		/* ~ ref_clk also */
> +	.rate           = 13000000,
>  	.parent		= &osc_ck,
>  	.flags		= CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X |
>  				ALWAYS_ENABLED | RATE_PROPAGATES,

Pushing today.

Tony

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

* Re: [PATCH] ARM: OMAP: fix default sys_ck.rate for boot-time DPLL detection
  2007-10-19 21:14 [PATCH] ARM: OMAP: fix default sys_ck.rate for boot-time DPLL detection Kevin Hilman
  2007-10-22  0:11 ` Tony Lindgren
@ 2007-10-22  7:24 ` Igor Stoppa
  2007-10-22 12:37   ` [PATCH] ARM: OMAP: fix default sys_ck.rate for boot-time DPLLdetection Woodruff, Richard
  1 sibling, 1 reply; 6+ messages in thread
From: Igor Stoppa @ 2007-10-22  7:24 UTC (permalink / raw)
  To: ext Kevin Hilman; +Cc: linux-omap-open-source

Hi Kevin,
On Fri, 2007-10-19 at 14:14 -0700, ext Kevin Hilman wrote:
> In the clock init code, the DPLL value set by the bootloader is
> queried, but always turns zero due it's parent clock (sys_ck) having
> no default rate.  This results in the improper setting of the default
> PRCM rate-table entry and any queries of virt_prcm_set rate to return 0.
> 
> Following the example of the TI kernel, set the default sys_ck rate to
> 13MHz.  Could then be overridden in board setup code.

There should be an even cleaner way to handle that (but i have no code
to prove that it works =) since the boot rom already does auto-detection
of the oscillator to support serial flashing.

If it is possible to read the detected value then the code can be moved
to arch or even plat.

-- 
Cheers, Igor

Igor Stoppa <igor.stoppa@nokia.com>
(Nokia Multimedia - CP - OSSO / Helsinki, Finland)

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

* RE: [PATCH] ARM: OMAP: fix default sys_ck.rate for boot-time DPLLdetection
  2007-10-22  7:24 ` Igor Stoppa
@ 2007-10-22 12:37   ` Woodruff, Richard
  2007-10-22 16:52     ` Kevin Hilman
  0 siblings, 1 reply; 6+ messages in thread
From: Woodruff, Richard @ 2007-10-22 12:37 UTC (permalink / raw)
  To: Igor Stoppa, ext Kevin Hilman; +Cc: linux-omap-open-source

The TI code does this with init_osc_sys_clk_rates() function.  The
preset bit in structure likely isn't needed.

The APLLS field which is setup by the bootloader is used to know osc and
sys clk's rates.

A little while back Paul had patched some of this and the initial go did
result in a bad value for this.  After this was pointed out a subsequent
patch was pushed to fix this.  Perhaps yet another patch broke this or
perhaps the version you are using was missing this update.

Regards
Richard W.


> 
> Hi Kevin,
> On Fri, 2007-10-19 at 14:14 -0700, ext Kevin Hilman wrote:
> > In the clock init code, the DPLL value set by the bootloader is
> > queried, but always turns zero due it's parent clock (sys_ck) having
> > no default rate.  This results in the improper setting of the
default
> > PRCM rate-table entry and any queries of virt_prcm_set rate to
return 0.
> >
> > Following the example of the TI kernel, set the default sys_ck rate
to
> > 13MHz.  Could then be overridden in board setup code.
> 
> There should be an even cleaner way to handle that (but i have no code
> to prove that it works =) since the boot rom already does
auto-detection
> of the oscillator to support serial flashing.
> 
> If it is possible to read the detected value then the code can be
moved
> to arch or even plat.
> 
> --
> Cheers, Igor
> 
> Igor Stoppa <igor.stoppa@nokia.com>
> (Nokia Multimedia - CP - OSSO / Helsinki, Finland)
> _______________________________________________
> Linux-omap-open-source mailing list
> Linux-omap-open-source@linux.omap.com
> http://linux.omap.com/mailman/listinfo/linux-omap-open-source

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

* Re: [PATCH] ARM: OMAP: fix default sys_ck.rate for boot-time DPLLdetection
  2007-10-22 12:37   ` [PATCH] ARM: OMAP: fix default sys_ck.rate for boot-time DPLLdetection Woodruff, Richard
@ 2007-10-22 16:52     ` Kevin Hilman
  2007-10-22 21:46       ` Paul Walmsley
  0 siblings, 1 reply; 6+ messages in thread
From: Kevin Hilman @ 2007-10-22 16:52 UTC (permalink / raw)
  To: Woodruff, Richard; +Cc: linux-omap-open-source

Woodruff, Richard wrote:
> The TI code does this with init_osc_sys_clk_rates() function.  The
> preset bit in structure likely isn't needed.
> 
> The APLLS field which is setup by the bootloader is used to know osc and
> sys clk's rates.
> 
> A little while back Paul had patched some of this and the initial go did
> result in a bad value for this.  After this was pointed out a subsequent
> patch was pushed to fix this.  Perhaps yet another patch broke this or
> perhaps the version you are using was missing this update.

I was working from the head of OMAP git, and it was broken there.

It looks like the git tree has the equivalent funtion to the one you
mentioned from the TI tree (see omap2_osc_clk_recalc), but it doesn't
work for sys_ck.  The osc_ck is correctly being set, but it's not
propagating to sys_ck because it uses propagate_rate() which doesn't
work since none of the clocks are registered yet.

The simple fix I tried was to move the osc_clk_recalc() after all the
clk_registers, but then it no longer boots (didn't investigate too deeply.)

The easier fix is to simply add omap2_sys_clk_recalc() as in the
following patch (which also reverts my previous patch.)  If that seems
reasonable, I'll submit it.

Kevin

Index: dev/arch/arm/mach-omap2/clock24xx.c
===================================================================
--- dev.orig/arch/arm/mach-omap2/clock24xx.c
+++ dev/arch/arm/mach-omap2/clock24xx.c
@@ -475,6 +475,7 @@ int __init omap2_clk_init(void)
 	clk_init(&omap2_clk_functions);

 	omap2_osc_clk_recalc(&osc_ck);
+	omap2_sys_clk_recalc(&sys_ck);

 	for (clkp = onchip_24xx_clks;
 	     clkp < onchip_24xx_clks + ARRAY_SIZE(onchip_24xx_clks);
Index: dev/arch/arm/mach-omap2/clock24xx.h
===================================================================
--- dev.orig/arch/arm/mach-omap2/clock24xx.h
+++ dev/arch/arm/mach-omap2/clock24xx.h
@@ -581,7 +581,6 @@ static struct clk osc_ck = {		/* (*12, *
 /* With out modem likely 12MHz, with modem likely 13MHz */
 static struct clk sys_ck = {		/* (*12, *13, 19.2, 26, 38.4)MHz */
 	.name		= "sys_ck",		/* ~ ref_clk also */
-	.rate           = 13000000,
 	.parent		= &osc_ck,
 	.flags		= CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X |
 				ALWAYS_ENABLED | RATE_PROPAGATES,

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

* Re: [PATCH] ARM: OMAP: fix default sys_ck.rate for boot-time DPLLdetection
  2007-10-22 16:52     ` Kevin Hilman
@ 2007-10-22 21:46       ` Paul Walmsley
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Walmsley @ 2007-10-22 21:46 UTC (permalink / raw)
  To: Kevin Hilman; +Cc: linux-omap-open-source

On Mon, 22 Oct 2007, Kevin Hilman wrote:

> The easier fix is to simply add omap2_sys_clk_recalc() as in the
> following patch (which also reverts my previous patch.)  If that seems
> reasonable, I'll submit it.

I would prefer this second patch; it allows sys_ck to be calculated 
dynamically based on osc_ck.


- Paul

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

end of thread, other threads:[~2007-10-22 21:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-19 21:14 [PATCH] ARM: OMAP: fix default sys_ck.rate for boot-time DPLL detection Kevin Hilman
2007-10-22  0:11 ` Tony Lindgren
2007-10-22  7:24 ` Igor Stoppa
2007-10-22 12:37   ` [PATCH] ARM: OMAP: fix default sys_ck.rate for boot-time DPLLdetection Woodruff, Richard
2007-10-22 16:52     ` Kevin Hilman
2007-10-22 21:46       ` Paul Walmsley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox