aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Pitre <nicolas.pitre@linaro.org>2013-02-18 10:36:13 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2013-02-21 08:25:36 -0500
commit70264367a243a68b1d5636ffb570183449803cbe (patch)
treed5ab3e7434c916f97b2e22fee6dd48c7cc9c416c
parent7c4e9ced424be4d36df6a3e3825763e97ee97607 (diff)
ARM: 7653/2: do not scale loops_per_jiffy when using a constant delay clock
When udelay() is implemented using an architected timer, it is wrong to scale loops_per_jiffy when changing the CPU clock frequency since the timer clock remains constant. The lpj should probably become an implementation detail relevant to the CPU loop based delay routine only and more confined to it. In the mean time this is the minimal fix needed to have expected delays with the timer based implementation when cpufreq is also in use. Reported-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Nicolas Pitre <nico@linaro.org> Tested-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Liviu Dudau <Liviu.Dudau@arm.com> Cc: stable@vger.kernel.org Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/include/asm/delay.h1
-rw-r--r--arch/arm/kernel/smp.c3
-rw-r--r--arch/arm/lib/delay.c1
3 files changed, 5 insertions, 0 deletions
diff --git a/arch/arm/include/asm/delay.h b/arch/arm/include/asm/delay.h
index ab98fdd083bd..720799fd3a81 100644
--- a/arch/arm/include/asm/delay.h
+++ b/arch/arm/include/asm/delay.h
@@ -24,6 +24,7 @@ extern struct arm_delay_ops {
24 void (*delay)(unsigned long); 24 void (*delay)(unsigned long);
25 void (*const_udelay)(unsigned long); 25 void (*const_udelay)(unsigned long);
26 void (*udelay)(unsigned long); 26 void (*udelay)(unsigned long);
27 bool const_clock;
27} arm_delay_ops; 28} arm_delay_ops;
28 29
29#define __delay(n) arm_delay_ops.delay(n) 30#define __delay(n) arm_delay_ops.delay(n)
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 84f4cbf652e5..58af91c2a2f7 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -693,6 +693,9 @@ static int cpufreq_callback(struct notifier_block *nb,
693 if (freq->flags & CPUFREQ_CONST_LOOPS) 693 if (freq->flags & CPUFREQ_CONST_LOOPS)
694 return NOTIFY_OK; 694 return NOTIFY_OK;
695 695
696 if (arm_delay_ops.const_clock)
697 return NOTIFY_OK;
698
696 if (!per_cpu(l_p_j_ref, cpu)) { 699 if (!per_cpu(l_p_j_ref, cpu)) {
697 per_cpu(l_p_j_ref, cpu) = 700 per_cpu(l_p_j_ref, cpu) =
698 per_cpu(cpu_data, cpu).loops_per_jiffy; 701 per_cpu(cpu_data, cpu).loops_per_jiffy;
diff --git a/arch/arm/lib/delay.c b/arch/arm/lib/delay.c
index 0dc53854a5d8..6b93f6a1a3c7 100644
--- a/arch/arm/lib/delay.c
+++ b/arch/arm/lib/delay.c
@@ -77,6 +77,7 @@ void __init register_current_timer_delay(const struct delay_timer *timer)
77 arm_delay_ops.delay = __timer_delay; 77 arm_delay_ops.delay = __timer_delay;
78 arm_delay_ops.const_udelay = __timer_const_udelay; 78 arm_delay_ops.const_udelay = __timer_const_udelay;
79 arm_delay_ops.udelay = __timer_udelay; 79 arm_delay_ops.udelay = __timer_udelay;
80 arm_delay_ops.const_clock = true;
80 delay_calibrated = true; 81 delay_calibrated = true;
81 } else { 82 } else {
82 pr_info("Ignoring duplicate/late registration of read_current_timer delay\n"); 83 pr_info("Ignoring duplicate/late registration of read_current_timer delay\n");