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

From: Janusz Krzysztofik
Date: Sat Nov 26 2011 - 22:41:59 EST


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@xxxxxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Sameer Nanda <snanda@xxxxxxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/