summaryrefslogtreecommitdiff
path: root/arch/arm/include/asm
diff options
context:
space:
mode:
authorMartin Persson <martin.persson@stericsson.com>2010-12-21 08:30:18 +0100
committerUlf Hansson <ulf.hansson@stericsson.com>2011-09-19 15:14:34 +0200
commit433955b4c2b9ce6ff3d2459d9e4c87b913ab4583 (patch)
treee86d5250d78800c34b7ee1e25340cb697c4b5526 /arch/arm/include/asm
parent02b40de1867fb2b6bdbc6004b8cfcae7310a6ce0 (diff)
ARM: twd: Adjust localtimer frequency with cpufreq notifiers
The clock to the ARM TWD local timer scales with the cpu frequency. To allow the cpu frequency to change while maintaining a constant TWD frequency, pick a lower target frequency for the TWD and use the prescaler to divide down to the closest lower frequency. This patch provides a new initialization function that takes a target TWD frequency and the ratio between the cpu clock and the TWD clock, specified as an integer divider >= 2 in the Cortex A9 MPCore TRM, and 2 in the ARM11 MPCore TRM. It also registers a cpufreq notifier that adjusts the prescaler when the cpu frequency changes. ST-Ericsson Linux next: Colin is driving this ST-Ericsson ID: 279802 ST-Ericsson FOSS-OUT ID: Trivial Change-Id: Ieec17963da8d7d37d935782633406bc1a0484dc9 Signed-off-by: Colin Cross <ccross@android.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/11532 Tested-by: Martin PERSSON <martin.persson@stericsson.com> Reviewed-by: QATOOLS Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'arch/arm/include/asm')
-rw-r--r--arch/arm/include/asm/smp_twd.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/arm/include/asm/smp_twd.h b/arch/arm/include/asm/smp_twd.h
index fed9981fba0..859be20c38b 100644
--- a/arch/arm/include/asm/smp_twd.h
+++ b/arch/arm/include/asm/smp_twd.h
@@ -17,6 +17,7 @@
#define TWD_TIMER_CONTROL_ONESHOT (0 << 1)
#define TWD_TIMER_CONTROL_PERIODIC (1 << 1)
#define TWD_TIMER_CONTROL_IT_ENABLE (1 << 2)
+#define TWD_TIMER_CONTROL_PRESCALE_MASK (0xFF << 8)
struct clock_event_device;
@@ -25,4 +26,14 @@ extern void __iomem *twd_base;
int twd_timer_ack(void);
void twd_timer_setup(struct clock_event_device *);
+/*
+ * Use this setup function on systems that support cpufreq.
+ * periphclk_prescaler is the fixed divider value between the cpu
+ * clock and the PERIPHCLK clock that feeds the TWD. target_rate should be
+ * low enough that the prescaler can accurately reach the target rate from the
+ * lowest cpu frequency, but high enough to give a reasonable timer accuracy.
+ */
+void twd_timer_setup_scalable(struct clock_event_device *,
+ unsigned long target_rate, unsigned int periphclk_prescaler);
+
#endif