diff mbox

[U-Boot] arm: pxa: config option for PXA270 turbo mode

Message ID 1369086285-25838-1-git-send-email-ynvich@gmail.com
State Superseded
Delegated to: Marek Vasut
Headers show

Commit Message

Sergey Yanovich May 20, 2013, 9:44 p.m. UTC
PXA270 CPU has turbo mode. The mode is 2.5 times faster than the
default run mode. Activating the mode early significantly speeds
up boot process.

Signed-off-by: Sergey Yanovich <ynvich@gmail.com>
---
 arch/arm/cpu/pxa/pxa2xx.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Marek Vasut May 21, 2013, 10:35 a.m. UTC | #1
Dear Sergey Yanovich,

> PXA270 CPU has turbo mode. The mode is 2.5 times faster than the
> default run mode. Activating the mode early significantly speeds
> up boot process.
> 
> Signed-off-by: Sergey Yanovich <ynvich@gmail.com>

What's the difference? Where does this macro get used ?

> ---
>  arch/arm/cpu/pxa/pxa2xx.c |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/cpu/pxa/pxa2xx.c b/arch/arm/cpu/pxa/pxa2xx.c
> index 09e8177..6c918ac 100644
> --- a/arch/arm/cpu/pxa/pxa2xx.c
> +++ b/arch/arm/cpu/pxa/pxa2xx.c
> @@ -32,6 +32,10 @@
>  #include <common.h>
>  #include <asm/arch/pxa-regs.h>
> 
> +#ifndef CONFIG_SYS_CLKCFG
> +#define CONFIG_SYS_CLKCFG	0x00000002
> +#endif
> +
>  /* Flush I/D-cache */
>  static void cache_flush(void)
>  {
> @@ -244,7 +248,8 @@ void pxa_clock_setup(void)
>  {
>  	writel(CONFIG_SYS_CKEN, CKEN);
>  	writel(CONFIG_SYS_CCCR, CCCR);
> -	asm volatile("mcr	p14, 0, %0, c6, c0, 0" : : "r"(2));
> +	asm volatile("mcr	p14, 0, %0, c6, c0, 0" : :
> +			"r"(CONFIG_SYS_CLKCFG));
> 
>  	/* enable the 32Khz oscillator for RTC and PowerManager */
>  	writel(OSCC_OON, OSCC);

Best regards,
Marek Vasut
Sergey Yanovich May 21, 2013, 10:51 a.m. UTC | #2
Dear Marek Vasut,

On Tue, 2013-05-21 at 12:35 +0200, Marek Vasut wrote:
> > PXA270 CPU has turbo mode. The mode is 2.5 times faster than the
> > default run mode. Activating the mode early significantly speeds
> > up boot process.

> What's the difference? Where does this macro get used ?

Difference -- approx. 2.5 times faster system.

Who uses it -- ex. LP-8x4x board, support for which I am trying to merge
in a separate patch. Any PXA27X board can use it.
Marek Vasut May 21, 2013, 10:55 a.m. UTC | #3
Dear Sergey Yanovich,

> Dear Marek Vasut,
> 
> On Tue, 2013-05-21 at 12:35 +0200, Marek Vasut wrote:
> > > PXA270 CPU has turbo mode. The mode is 2.5 times faster than the
> > > default run mode. Activating the mode early significantly speeds
> > > up boot process.
> > 
> > What's the difference? Where does this macro get used ?
> 
> Difference -- approx. 2.5 times faster system.
> 
> Who uses it -- ex. LP-8x4x board, support for which I am trying to merge
> in a separate patch. Any PXA27X board can use it.

Why don't you enable it globally then ?

Best regards,
Marek Vasut
Sergey Yanovich May 21, 2013, 11:14 a.m. UTC | #4
Dear Marek Vasut,

On Tue, 2013-05-21 at 12:55 +0200, Marek Vasut wrote:
> > Difference -- approx. 2.5 times faster system.
> > 
> > Who uses it -- ex. LP-8x4x board, support for which I am trying to merge
> > in a separate patch. Any PXA27X board can use it.
> 
> Why don't you enable it globally then ?

It increases power consumption proportionally. Not everyone would agree
with this. Especially those with portable devices may rightfully object.

It is up to you to enable it globally. I could alter the patch to switch
turbo mode on by default and provide an option to disable it.
Marek Vasut May 21, 2013, 11:22 a.m. UTC | #5
Dear Sergey Yanovich,

> Dear Marek Vasut,
> 
> On Tue, 2013-05-21 at 12:55 +0200, Marek Vasut wrote:
> > > Difference -- approx. 2.5 times faster system.
> > > 
> > > Who uses it -- ex. LP-8x4x board, support for which I am trying to
> > > merge in a separate patch. Any PXA27X board can use it.
> > 
> > Why don't you enable it globally then ?
> 
> It increases power consumption proportionally. Not everyone would agree
> with this. Especially those with portable devices may rightfully object.
> 
> It is up to you to enable it globally. I could alter the patch to switch
> turbo mode on by default and provide an option to disable it.

Actually, I wonder if Linux's cpufreq still does depend on bootloader speed 
settings. Especially the turbo bit. Can you please check that? It'd be 
interesting to know ...

I'd say enable it by default ... I probably have all the PXA devices supported 
in U-Boot and I'm quite sure none of them will mind ;-)

Best regards,
Marek Vasut
Marek Vasut May 21, 2013, 11:22 a.m. UTC | #6
[..]

> Actually, I wonder if Linux's cpufreq still does depend on bootloader speed
> settings. Especially the turbo bit. Can you please check that? It'd be
> interesting to know ...
> 
> I'd say enable it by default ... I probably have all the PXA devices
> supported in U-Boot and I'm quite sure none of them will mind ;-)

Still, I'm surprised it wasn't enabled. I recall seeing it enabled. Weird ...

Best regards,
Marek Vasut
Sergey Yanovich May 21, 2013, 4:23 p.m. UTC | #7
On Tue, 2013-05-21 at 13:22 +0200, Marek Vasut wrote:
> > Actually, I wonder if Linux's cpufreq still does depend on bootloader speed
> > settings. Especially the turbo bit. Can you please check that? It'd be
> > interesting to know ...
> > 
> > I'd say enable it by default ... I probably have all the PXA devices
> > supported in U-Boot and I'm quite sure none of them will mind ;-)
> 
> Still, I'm surprised it wasn't enabled. I recall seeing it enabled. Weird ...

Yes, you are right. Linux's cpufreq-pxa2xx.c always sets the turbo bit.

However, if CONFIG_CPU_FREQ is not set (my case), bootloader's settings
are used.

I work on a system that has focus on low latency (industrial controller)
rather than battery life (since it has no battery).
Marek Vasut May 21, 2013, 7:25 p.m. UTC | #8
Dear Sergey Yanovich,

> On Tue, 2013-05-21 at 13:22 +0200, Marek Vasut wrote:
> > > Actually, I wonder if Linux's cpufreq still does depend on bootloader
> > > speed settings. Especially the turbo bit. Can you please check that?
> > > It'd be interesting to know ...
> > > 
> > > I'd say enable it by default ... I probably have all the PXA devices
> > > supported in U-Boot and I'm quite sure none of them will mind ;-)
> > 
> > Still, I'm surprised it wasn't enabled. I recall seeing it enabled. Weird
> > ...
> 
> Yes, you are right. Linux's cpufreq-pxa2xx.c always sets the turbo bit.
> 
> However, if CONFIG_CPU_FREQ is not set (my case), bootloader's settings
> are used.
> 
> I work on a system that has focus on low latency (industrial controller)
> rather than battery life (since it has no battery).

So why not just make this patch into

-(2)
+(0xb)

instead of adding new (and undocumented ...) macro?

Best regards,
Marek Vasut
Sergey Yanovich May 21, 2013, 7:45 p.m. UTC | #9
Dear Marek Vasut,

On Tue, 2013-05-21 at 21:25 +0200,  wrote:
> So why not just make this patch into
> 
> -(2)
> +(0xb)
> 
> instead of adding new (and undocumented ...) macro?

Point taken. Looks like I am too careful in this case.
diff mbox

Patch

diff --git a/arch/arm/cpu/pxa/pxa2xx.c b/arch/arm/cpu/pxa/pxa2xx.c
index 09e8177..6c918ac 100644
--- a/arch/arm/cpu/pxa/pxa2xx.c
+++ b/arch/arm/cpu/pxa/pxa2xx.c
@@ -32,6 +32,10 @@ 
 #include <common.h>
 #include <asm/arch/pxa-regs.h>
 
+#ifndef CONFIG_SYS_CLKCFG
+#define CONFIG_SYS_CLKCFG	0x00000002
+#endif
+
 /* Flush I/D-cache */
 static void cache_flush(void)
 {
@@ -244,7 +248,8 @@  void pxa_clock_setup(void)
 {
 	writel(CONFIG_SYS_CKEN, CKEN);
 	writel(CONFIG_SYS_CCCR, CCCR);
-	asm volatile("mcr	p14, 0, %0, c6, c0, 0" : : "r"(2));
+	asm volatile("mcr	p14, 0, %0, c6, c0, 0" : :
+			"r"(CONFIG_SYS_CLKCFG));
 
 	/* enable the 32Khz oscillator for RTC and PowerManager */
 	writel(OSCC_OON, OSCC);