summaryrefslogtreecommitdiff
path: root/arch/arm/kernel
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2010-09-21 23:12:19 -0700
committerColin Cross <ccross@android.com>2010-10-06 16:28:46 -0700
commit0d2beae1042fcc080e6e172598cf9d1dd863befe (patch)
tree264df29b1826617e05846e233daa597d2817bebb /arch/arm/kernel
parent97460a796b3d9c60652c4e1a1ed86e4766f67faf (diff)
[ARM] twd: Always calibrate local timer
Change-Id: I075f883739d0eeea3b6b10da003119431cf3c2d2 Signed-off-by: Colin Cross <ccross@android.com>
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r--arch/arm/kernel/smp_twd.c59
1 files changed, 30 insertions, 29 deletions
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index c05e88a75354..014862ae170c 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -112,48 +112,49 @@ static void __cpuinit twd_calibrate_rate(unsigned long target_rate,
* If this is the first time round, we need to work out how fast
* the timer ticks
*/
- if (twd_timer_rate == 0) {
- printk(KERN_INFO "Calibrating local timer... ");
+ printk(KERN_INFO "Calibrating local timer... ");
- /* Wait for a tick to start */
- waitjiffies = get_jiffies_64() + 1;
+ /* Wait for a tick to start */
+ waitjiffies = get_jiffies_64() + 1;
- while (get_jiffies_64() < waitjiffies)
- udelay(10);
+ while (get_jiffies_64() < waitjiffies)
+ udelay(10);
- /* OK, now the tick has started, let's get the timer going */
- waitjiffies += 5;
+ /* OK, now the tick has started, let's get the timer going */
+ waitjiffies += 5;
- /* enable, no interrupt or reload */
- __raw_writel(0x1, twd_base + TWD_TIMER_CONTROL);
+ /* enable, no interrupt or reload */
+ __raw_writel(0x1, twd_base + TWD_TIMER_CONTROL);
- /* maximum value */
- __raw_writel(0xFFFFFFFFU, twd_base + TWD_TIMER_COUNTER);
+ /* maximum value */
+ __raw_writel(0xFFFFFFFFU, twd_base + TWD_TIMER_COUNTER);
- while (get_jiffies_64() < waitjiffies)
- udelay(10);
+ while (get_jiffies_64() < waitjiffies)
+ udelay(10);
- count = __raw_readl(twd_base + TWD_TIMER_COUNTER);
+ count = __raw_readl(twd_base + TWD_TIMER_COUNTER);
- twd_timer_rate = (0xFFFFFFFFU - count) * (HZ / 5);
+ twd_timer_rate = (0xFFFFFFFFU - count) * (HZ / 5);
- /*
- * If a target rate has been requested, adjust the TWD prescaler
- * to get the closest lower frequency.
- */
- if (target_rate) {
- twd_periphclk_prescaler = periphclk_prescaler;
- twd_target_rate = target_rate;
-
- cpu_rate = twd_timer_rate * periphclk_prescaler;
- twd_timer_rate = twd_target_rate;
- twd_recalc_prescaler(cpu_rate);
- }
+ /*
+ * If a target rate has been requested, adjust the TWD prescaler
+ * to get the closest lower frequency.
+ */
+ if (target_rate) {
+ twd_periphclk_prescaler = periphclk_prescaler;
+ twd_target_rate = target_rate;
- printk("%lu.%02luMHz.\n", twd_timer_rate / 1000000,
+ printk("%lu.%02luMHz, setting to ",
+ twd_timer_rate / 1000000,
(twd_timer_rate / 10000) % 100);
+ cpu_rate = twd_timer_rate * periphclk_prescaler;
+ twd_timer_rate = twd_target_rate;
+ twd_recalc_prescaler(cpu_rate);
}
+ printk("%lu.%02luMHz.\n", twd_timer_rate / 1000000,
+ (twd_timer_rate / 10000) % 100);
+
load = twd_timer_rate / HZ;
__raw_writel(load, twd_base + TWD_TIMER_LOAD);