aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2011-05-08 12:21:49 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2011-05-23 13:04:52 -0400
commit5c61ddcfaf98fae4a0ac8077b06a07fb2ba6864a (patch)
treef4e7e0865d40a1b17a0e684af27577987d56b76d /arch
parentd6e15d78537d2483bff05f0ee5b5cec6c4678fd5 (diff)
clocksource: convert MXS timrotv2 to 32-bit down counting clocksource
Convert the MXS timrotv2 32-bit down counting clocksource to the generic clocksource infrastructure. Cc: Sascha Hauer <kernel@pengutronix.de> Acked-by: Shawn Guo <shawn.guo@freescale.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/mach-mxs/timer.c20
2 files changed, 8 insertions, 13 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index cbc27fb1256..43f003a5a0f 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -376,6 +376,7 @@ config ARCH_MXS
376 select GENERIC_CLOCKEVENTS 376 select GENERIC_CLOCKEVENTS
377 select ARCH_REQUIRE_GPIOLIB 377 select ARCH_REQUIRE_GPIOLIB
378 select CLKDEV_LOOKUP 378 select CLKDEV_LOOKUP
379 select CLKSRC_MMIO
379 help 380 help
380 Support for Freescale MXS-based family of processors 381 Support for Freescale MXS-based family of processors
381 382
diff --git a/arch/arm/mach-mxs/timer.c b/arch/arm/mach-mxs/timer.c
index 13647f30186..cace0d2e5a5 100644
--- a/arch/arm/mach-mxs/timer.c
+++ b/arch/arm/mach-mxs/timer.c
@@ -101,11 +101,6 @@ static cycle_t timrotv1_get_cycles(struct clocksource *cs)
101 & 0xffff0000) >> 16); 101 & 0xffff0000) >> 16);
102} 102}
103 103
104static cycle_t timrotv2_get_cycles(struct clocksource *cs)
105{
106 return ~__raw_readl(mxs_timrot_base + HW_TIMROT_RUNNING_COUNTn(1));
107}
108
109static int timrotv1_set_next_event(unsigned long evt, 104static int timrotv1_set_next_event(unsigned long evt,
110 struct clock_event_device *dev) 105 struct clock_event_device *dev)
111{ 106{
@@ -230,8 +225,8 @@ static int __init mxs_clockevent_init(struct clk *timer_clk)
230static struct clocksource clocksource_mxs = { 225static struct clocksource clocksource_mxs = {
231 .name = "mxs_timer", 226 .name = "mxs_timer",
232 .rating = 200, 227 .rating = 200,
233 .read = timrotv2_get_cycles, 228 .read = timrotv1_get_cycles,
234 .mask = CLOCKSOURCE_MASK(32), 229 .mask = CLOCKSOURCE_MASK(16),
235 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 230 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
236}; 231};
237 232
@@ -239,12 +234,11 @@ static int __init mxs_clocksource_init(struct clk *timer_clk)
239{ 234{
240 unsigned int c = clk_get_rate(timer_clk); 235 unsigned int c = clk_get_rate(timer_clk);
241 236
242 if (timrot_is_v1()) { 237 if (timrot_is_v1())
243 clocksource_mxs.read = timrotv1_get_cycles; 238 clocksource_register_hz(&clocksource_mxs, c);
244 clocksource_mxs.mask = CLOCKSOURCE_MASK(16); 239 else
245 } 240 clocksource_mmio_init(mxs_timrot_base + HW_TIMROT_RUNNING_COUNTn(1),
246 241 "mxs_timer", c, 200, 32, clocksource_mmio_readl_down);
247 clocksource_register_hz(&clocksource_mxs, c);
248 242
249 return 0; 243 return 0;
250} 244}