diff options
author | Will Deacon <will.deacon@arm.com> | 2013-03-28 06:17:55 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2013-04-03 11:45:50 -0400 |
commit | 6f3d90e55660ba42301b5e9c7eed332cc9f70fd7 (patch) | |
tree | 0f5ef09981f5322d80a79a12125d291adaab175b /arch/arm/lib | |
parent | 93dc68876b608da041fe40ed39424b0fcd5aa2fb (diff) |
ARM: 7685/1: delay: use private ticks_per_jiffy field for timer-based delay ops
Commit 70264367a243 ("ARM: 7653/2: do not scale loops_per_jiffy when
using a constant delay clock") fixed a problem with our timer-based
delay loop, where loops_per_jiffy is scaled by cpufreq yet used directly
by the timer delay ops.
This patch fixes the problem in a more elegant way by keeping a private
ticks_per_jiffy field in the delay ops, independent of loops_per_jiffy
and therefore not subject to scaling. The loop-based delay continues to
use loops_per_jiffy directly, as it should.
Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/lib')
-rw-r--r-- | arch/arm/lib/delay.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/arm/lib/delay.c b/arch/arm/lib/delay.c index 6b93f6a1a3c7..64dbfa57204a 100644 --- a/arch/arm/lib/delay.c +++ b/arch/arm/lib/delay.c | |||
@@ -58,7 +58,7 @@ static void __timer_delay(unsigned long cycles) | |||
58 | static void __timer_const_udelay(unsigned long xloops) | 58 | static void __timer_const_udelay(unsigned long xloops) |
59 | { | 59 | { |
60 | unsigned long long loops = xloops; | 60 | unsigned long long loops = xloops; |
61 | loops *= loops_per_jiffy; | 61 | loops *= arm_delay_ops.ticks_per_jiffy; |
62 | __timer_delay(loops >> UDELAY_SHIFT); | 62 | __timer_delay(loops >> UDELAY_SHIFT); |
63 | } | 63 | } |
64 | 64 | ||
@@ -73,11 +73,13 @@ void __init register_current_timer_delay(const struct delay_timer *timer) | |||
73 | pr_info("Switching to timer-based delay loop\n"); | 73 | pr_info("Switching to timer-based delay loop\n"); |
74 | delay_timer = timer; | 74 | delay_timer = timer; |
75 | lpj_fine = timer->freq / HZ; | 75 | lpj_fine = timer->freq / HZ; |
76 | loops_per_jiffy = lpj_fine; | 76 | |
77 | /* cpufreq may scale loops_per_jiffy, so keep a private copy */ | ||
78 | arm_delay_ops.ticks_per_jiffy = lpj_fine; | ||
77 | arm_delay_ops.delay = __timer_delay; | 79 | arm_delay_ops.delay = __timer_delay; |
78 | arm_delay_ops.const_udelay = __timer_const_udelay; | 80 | arm_delay_ops.const_udelay = __timer_const_udelay; |
79 | arm_delay_ops.udelay = __timer_udelay; | 81 | arm_delay_ops.udelay = __timer_udelay; |
80 | arm_delay_ops.const_clock = true; | 82 | |
81 | delay_calibrated = true; | 83 | delay_calibrated = true; |
82 | } else { | 84 | } else { |
83 | pr_info("Ignoring duplicate/late registration of read_current_timer delay\n"); | 85 | pr_info("Ignoring duplicate/late registration of read_current_timer delay\n"); |