summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorGraf Yang <graf.yang@analog.com>2010-03-08 03:01:35 +0000
committerMike Frysinger <vapier@gentoo.org>2010-03-09 00:30:53 -0500
commit7998a8787a8b35fede689c2bb716f65b231e7492 (patch)
tree07a9d6c0e27923cfdbe237aa0a0cfca6cb9f095c /arch
parentf2b0cd61cf635cbdc110472f6edc97328322cb8b (diff)
downloadblackbird-op-linux-7998a8787a8b35fede689c2bb716f65b231e7492.tar.gz
blackbird-op-linux-7998a8787a8b35fede689c2bb716f65b231e7492.zip
Blackfin: scale calibration when cpu freq changes
Need to make sure we update the loops_per_jiffy values when we start changing the core clock. Signed-off-by: Graf Yang <graf.yang@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/blackfin/mach-common/cpufreq.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/arch/blackfin/mach-common/cpufreq.c b/arch/blackfin/mach-common/cpufreq.c
index 5d7f8ab5509a..4391d03dc845 100644
--- a/arch/blackfin/mach-common/cpufreq.c
+++ b/arch/blackfin/mach-common/cpufreq.c
@@ -11,6 +11,7 @@
#include <linux/init.h>
#include <linux/cpufreq.h>
#include <linux/fs.h>
+#include <linux/delay.h>
#include <asm/blackfin.h>
#include <asm/time.h>
#include <asm/dpmc.h>
@@ -99,13 +100,15 @@ static unsigned int bfin_getfreq_khz(unsigned int cpu)
return get_cclk() / 1000;
}
-
static int bfin_target(struct cpufreq_policy *poli,
unsigned int target_freq, unsigned int relation)
{
unsigned int index, plldiv, cpu;
unsigned long flags, cclk_hz;
struct cpufreq_freqs freqs;
+ static unsigned long lpj_ref;
+ static unsigned int lpj_ref_freq;
+
#if defined(CONFIG_CYCLES_CLOCKSOURCE)
cycles_t cycles;
#endif
@@ -144,6 +147,14 @@ static int bfin_target(struct cpufreq_policy *poli,
(cycles << __bfin_cycles_mod) - (cycles << index);
__bfin_cycles_mod = index;
#endif
+ if (!lpj_ref_freq) {
+ lpj_ref = loops_per_jiffy;
+ lpj_ref_freq = freqs.old;
+ }
+ if (freqs.new != freqs.old) {
+ loops_per_jiffy = cpufreq_scale(lpj_ref,
+ lpj_ref_freq, freqs.new);
+ }
local_irq_restore_hw(flags);
}
/* TODO: just test case for cycles clock source, remove later */
OpenPOWER on IntegriCloud