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

clocksource: convert W90x900 24-bit down counting clocksource

Convert the W90x900 24-bit down-counting clocksource to the generic
mmio clocksource infrastructure

Acked-by: Wan ZongShun <mcuos.com@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

+3 -15
+1
arch/arm/Kconfig
··· 575 575 select CPU_ARM926T 576 576 select ARCH_REQUIRE_GPIOLIB 577 577 select CLKDEV_LOOKUP 578 + select CLKSRC_MMIO 578 579 select GENERIC_CLOCKEVENTS 579 580 help 580 581 Support for Nuvoton (Winbond logic dept.) ARM9 processor,
+2 -15
arch/arm/mach-w90x900/time.c
··· 43 43 #define PRESCALE 0x63 /* Divider = prescale + 1 */ 44 44 45 45 #define TDR_SHIFT 24 46 - #define TDR_MASK ((1 << TDR_SHIFT) - 1) 47 46 48 47 static unsigned int timer0_load; 49 48 ··· 142 143 clockevents_register_device(&nuc900_clockevent_device); 143 144 } 144 145 145 - static cycle_t nuc900_get_cycles(struct clocksource *cs) 146 - { 147 - return (~__raw_readl(REG_TDR1)) & TDR_MASK; 148 - } 149 - 150 - static struct clocksource clocksource_nuc900 = { 151 - .name = "nuc900-timer1", 152 - .rating = 200, 153 - .read = nuc900_get_cycles, 154 - .mask = CLOCKSOURCE_MASK(TDR_SHIFT), 155 - .flags = CLOCK_SOURCE_IS_CONTINUOUS, 156 - }; 157 - 158 146 static void __init nuc900_clocksource_init(void) 159 147 { 160 148 unsigned int val; ··· 161 175 val |= (COUNTEN | PERIOD | PRESCALE); 162 176 __raw_writel(val, REG_TCSR1); 163 177 164 - clocksource_register_hz(&clocksource_nuc900, rate); 178 + clocksource_mmio_init(REG_TDR1, "nuc900-timer1", rate, 200, 179 + TDR_SHIFT, clocksource_mmio_readl_down); 165 180 } 166 181 167 182 static void __init nuc900_timer_init(void)