diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-05-08 12:21:49 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-05-23 13:04:52 -0400 |
commit | 5c61ddcfaf98fae4a0ac8077b06a07fb2ba6864a (patch) | |
tree | f4e7e0865d40a1b17a0e684af27577987d56b76d /arch | |
parent | d6e15d78537d2483bff05f0ee5b5cec6c4678fd5 (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/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm/mach-mxs/timer.c | 20 |
2 files changed, 8 insertions, 13 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index cbc27fb1256f..43f003a5a0f4 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 13647f301860..cace0d2e5a55 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 | ||
104 | static cycle_t timrotv2_get_cycles(struct clocksource *cs) | ||
105 | { | ||
106 | return ~__raw_readl(mxs_timrot_base + HW_TIMROT_RUNNING_COUNTn(1)); | ||
107 | } | ||
108 | |||
109 | static int timrotv1_set_next_event(unsigned long evt, | 104 | static 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) | |||
230 | static struct clocksource clocksource_mxs = { | 225 | static 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 | } |