[PATCH 4/5] init/calibrate.c: allow for recalibration of loops per jiffy

Janusz Krzysztofik jkrzyszt at tis.icnet.pl
Sat Nov 26 22:32:30 EST 2011


This is required on ARM OMAP1 platform, after DPLL reprogramming has
been fixed by moving it from setup_arch() to kernel_init().

Created against linux-3.2-rc2.

Signed-off-by: Janusz Krzysztofik <jkrzyszt at tis.icnet.pl>
Cc: Andrew Morton <akpm at linux-foundation.org>
Cc: Sameer Nanda <snanda at chromium.org>
---
 include/linux/delay.h |    4 +++-
 init/calibrate.c      |    6 ++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/include/linux/delay.h b/include/linux/delay.h
index a6ecb34..ed0fbbe 100644
--- a/include/linux/delay.h
+++ b/include/linux/delay.h
@@ -42,7 +42,9 @@ static inline void ndelay(unsigned long x)
 #endif
 
 extern unsigned long lpj_fine;
-void calibrate_delay(void);
+void _calibrate_delay(bool redo);
+#define calibrate_delay() _calibrate_delay(0)
+#define recalibrate_delay() _calibrate_delay(1)
 void msleep(unsigned int msecs);
 unsigned long msleep_interruptible(unsigned int msecs);
 void usleep_range(unsigned long min, unsigned long max);
diff --git a/init/calibrate.c b/init/calibrate.c
index 24df797..f7c1593 100644
--- a/init/calibrate.c
+++ b/init/calibrate.c
@@ -246,13 +246,15 @@ recalibrate:
 
 static DEFINE_PER_CPU(unsigned long, cpu_loops_per_jiffy) = { 0 };
 
-void __cpuinit calibrate_delay(void)
+void __cpuinit _calibrate_delay(bool redo)
 {
 	unsigned long lpj;
 	static bool printed;
 	int this_cpu = smp_processor_id();
 
-	if (per_cpu(cpu_loops_per_jiffy, this_cpu)) {
+	if (redo)
+		printed = 0;
+	if (!redo && per_cpu(cpu_loops_per_jiffy, this_cpu)) {
 		lpj = per_cpu(cpu_loops_per_jiffy, this_cpu);
 		pr_info("Calibrating delay loop (skipped) "
 				"already calibrated this CPU");
-- 
1.7.3.4




More information about the linux-arm-kernel mailing list