aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-nomadik
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2011-05-08 10:33:30 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2011-05-23 13:04:51 -0400
commitbfe45e0be88d8a2e408226d473bff60da4a97d1f (patch)
tree4586e8933a35af1599f314adb73f2bae504b49b5 /arch/arm/plat-nomadik
parent234b6ceddb4fc2a4bc5b9a7670f070f6e69e0868 (diff)
clocksource: convert ARM 32-bit down counting clocksources
Convert SP804, MXC, Nomadik and Orion 32-bit down-counting clocksources to generic mmio clocksource infrastructure. Acked-by: Catalin Marinas <catalin.marinas@arm.com> Cc: Sascha Hauer <kernel@pengutronix.de> Cc: Alessandro Rubini <rubini@unipv.it> Acked-by: Linus Walleij <linus.walleij@linaro.org> Cc: Lennert Buytenhek <kernel@wantstofly.org> Acked-by: Nicolas Pitre <nico@fluxnic.net> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/plat-nomadik')
-rw-r--r--arch/arm/plat-nomadik/Kconfig1
-rw-r--r--arch/arm/plat-nomadik/timer.c31
2 files changed, 4 insertions, 28 deletions
diff --git a/arch/arm/plat-nomadik/Kconfig b/arch/arm/plat-nomadik/Kconfig
index 187f4e84bb22..18296ee68802 100644
--- a/arch/arm/plat-nomadik/Kconfig
+++ b/arch/arm/plat-nomadik/Kconfig
@@ -5,6 +5,7 @@
5config PLAT_NOMADIK 5config PLAT_NOMADIK
6 bool 6 bool
7 depends on ARCH_NOMADIK || ARCH_U8500 7 depends on ARCH_NOMADIK || ARCH_U8500
8 select CLKSRC_MMIO
8 default y 9 default y
9 help 10 help
10 Common platform code for Nomadik and other ST-Ericsson 11 Common platform code for Nomadik and other ST-Ericsson
diff --git a/arch/arm/plat-nomadik/timer.c b/arch/arm/plat-nomadik/timer.c
index 41723402006b..ef74e157a9d5 100644
--- a/arch/arm/plat-nomadik/timer.c
+++ b/arch/arm/plat-nomadik/timer.c
@@ -26,29 +26,6 @@
26void __iomem *mtu_base; /* Assigned by machine code */ 26void __iomem *mtu_base; /* Assigned by machine code */
27 27
28/* 28/*
29 * Kernel assumes that sched_clock can be called early
30 * but the MTU may not yet be initialized.
31 */
32static cycle_t nmdk_read_timer_dummy(struct clocksource *cs)
33{
34 return 0;
35}
36
37/* clocksource: MTU decrements, so we negate the value being read. */
38static cycle_t nmdk_read_timer(struct clocksource *cs)
39{
40 return -readl(mtu_base + MTU_VAL(0));
41}
42
43static struct clocksource nmdk_clksrc = {
44 .name = "mtu_0",
45 .rating = 200,
46 .read = nmdk_read_timer_dummy,
47 .mask = CLOCKSOURCE_MASK(32),
48 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
49};
50
51/*
52 * Override the global weak sched_clock symbol with this 29 * Override the global weak sched_clock symbol with this
53 * local implementation which uses the clocksource to get some 30 * local implementation which uses the clocksource to get some
54 * better resolution when scheduling the kernel. 31 * better resolution when scheduling the kernel.
@@ -172,12 +149,10 @@ void __init nmdk_timer_init(void)
172 writel(0, mtu_base + MTU_BGLR(0)); 149 writel(0, mtu_base + MTU_BGLR(0));
173 writel(cr | MTU_CRn_ENA, mtu_base + MTU_CR(0)); 150 writel(cr | MTU_CRn_ENA, mtu_base + MTU_CR(0));
174 151
175 /* Now the clock source is ready */ 152 if (clocksource_mmio_init(mtu_base + MTU_VAL(0), "mtu_0",
176 nmdk_clksrc.read = nmdk_read_timer; 153 rate, 200, 32, clocksource_mmio_readl_down))
177
178 if (clocksource_register_hz(&nmdk_clksrc, rate))
179 pr_err("timer: failed to initialize clock source %s\n", 154 pr_err("timer: failed to initialize clock source %s\n",
180 nmdk_clksrc.name); 155 "mtu_0");
181 156
182 init_sched_clock(&cd, nomadik_update_sched_clock, 32, rate); 157 init_sched_clock(&cd, nomadik_update_sched_clock, 32, rate);
183 158