Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+8 -13
+1
arch/arm/Kconfig
··· 376 376 select GENERIC_CLOCKEVENTS 377 377 select ARCH_REQUIRE_GPIOLIB 378 378 select CLKDEV_LOOKUP 379 + select CLKSRC_MMIO 379 380 help 380 381 Support for Freescale MXS-based family of processors 381 382
+7 -13
arch/arm/mach-mxs/timer.c
··· 101 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 104 static int timrotv1_set_next_event(unsigned long evt, 110 105 struct clock_event_device *dev) 111 106 { ··· 225 230 static struct clocksource clocksource_mxs = { 226 231 .name = "mxs_timer", 227 232 .rating = 200, 228 - .read = timrotv2_get_cycles, 229 - .mask = CLOCKSOURCE_MASK(32), 233 + .read = timrotv1_get_cycles, 234 + .mask = CLOCKSOURCE_MASK(16), 230 235 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 231 236 }; 232 237 ··· 234 239 { 235 240 unsigned int c = clk_get_rate(timer_clk); 236 241 237 - if (timrot_is_v1()) { 238 - clocksource_mxs.read = timrotv1_get_cycles; 239 - clocksource_mxs.mask = CLOCKSOURCE_MASK(16); 240 - } 241 - 242 - clocksource_register_hz(&clocksource_mxs, c); 242 + if (timrot_is_v1()) 243 + clocksource_register_hz(&clocksource_mxs, c); 244 + else 245 + clocksource_mmio_init(mxs_timrot_base + HW_TIMROT_RUNNING_COUNTn(1), 246 + "mxs_timer", c, 200, 32, clocksource_mmio_readl_down); 243 247 244 248 return 0; 245 249 }