Subject: [PATCH] pasemi: update ppc_proc_freq from cpufreq driver

From: [email-masked] (Olof Johansson)
Date: Thu, 3 May 2007 23:39:21 -0500

Update the global cpu speed variable according to current cpufreq speed,
/proc/cpuinfo reports the actual speed.

Signed-off-by: Olof Johansson <[email-masked]>

---

On Fri, May 04, 2007 at 02:00:36PM +1000, Paul Mackerras wrote:
> Olof Johansson writes:
> 
> > On other architectures, the frequency in /proc/cpuinfo moves with cpufreq
> > changes. It makes sense to do the same on powerpc to keep users from
> > getting confused.
> 
> Well, it does on powermac already, because ppc_proc_freq gets
> adjusted...  So at the very least, your patch description needs to be
> changed.
> 
> Do you have a situation where the CPUs in a system can have different
> clock frequencies?  If not, why not just set ppc_proc_freq when the
> frequency changes?

Sure. I'll let the cell guys do the equivalent change on their own.

Index: 2.6.21/arch/powerpc/platforms/pasemi/cpufreq.c
===================================================================
--- 2.6.21.orig/arch/powerpc/platforms/pasemi/cpufreq.c
+++ 2.6.21/arch/powerpc/platforms/pasemi/cpufreq.c
@@ -31,6 +31,7 @@
 #include <asm/hw_irq.h>
 #include <asm/io.h>
 #include <asm/prom.h>
+#include <asm/time.h>
 
 #define SDCASR_REG		0x0100
 #define SDCASR_REG_STRIDE	0x1000
@@ -204,6 +205,8 @@ static int pas_cpufreq_cpu_init(struct c
 	policy->cur = pas_freqs[cur_astate].frequency;
 	policy->cpus = cpu_online_map;
 
+	ppc_proc_freq = policy->cur * 1000ul;
+
 	cpufreq_frequency_table_get_attr(pas_freqs, policy->cpu);
 
 	/* this ensures that policy->cpuinfo_min and policy->cpuinfo_max
@@ -270,6 +273,7 @@ static int pas_cpufreq_target(struct cpu
 	cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
 	mutex_unlock(&pas_switch_mutex);
 
+	ppc_proc_freq = freqs.new * 1000ul;
 	return 0;
 }