diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-05-09 04:51:03 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-05-23 13:04:52 -0400 |
commit | 933e54a53ccb68543ffb7ea32168ea086c93d09a (patch) | |
tree | 5c6b80c621855de26bfd25245cde977347da64b2 /arch/arm/mach-omap1/time.c | |
parent | 5c61ddcfaf98fae4a0ac8077b06a07fb2ba6864a (diff) |
clocksource: convert OMAP1 to 32-bit down counting clocksource
Convert the OMAP1 32-bit down counting clocksource to the generic
clocksource infrastructure.
Tested-by: Tony Lindgren <tony@atomide.com>
Cc: linux-omap@vger.kernel.org
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-omap1/time.c')
-rw-r--r-- | arch/arm/mach-omap1/time.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c index e7ab61625b44..03e1e1062ad4 100644 --- a/arch/arm/mach-omap1/time.c +++ b/arch/arm/mach-omap1/time.c | |||
@@ -190,24 +190,11 @@ static __init void omap_init_mpu_timer(unsigned long rate) | |||
190 | * --------------------------------------------------------------------------- | 190 | * --------------------------------------------------------------------------- |
191 | */ | 191 | */ |
192 | 192 | ||
193 | static cycle_t mpu_read(struct clocksource *cs) | ||
194 | { | ||
195 | return ~omap_mpu_timer_read(1); | ||
196 | } | ||
197 | |||
198 | static struct clocksource clocksource_mpu = { | ||
199 | .name = "mpu_timer2", | ||
200 | .rating = 300, | ||
201 | .read = mpu_read, | ||
202 | .mask = CLOCKSOURCE_MASK(32), | ||
203 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | ||
204 | }; | ||
205 | |||
206 | static DEFINE_CLOCK_DATA(cd); | 193 | static DEFINE_CLOCK_DATA(cd); |
207 | 194 | ||
208 | static inline unsigned long long notrace _omap_mpu_sched_clock(void) | 195 | static inline unsigned long long notrace _omap_mpu_sched_clock(void) |
209 | { | 196 | { |
210 | u32 cyc = mpu_read(&clocksource_mpu); | 197 | u32 cyc = ~omap_mpu_timer_read(1); |
211 | return cyc_to_sched_clock(&cd, cyc, (u32)~0); | 198 | return cyc_to_sched_clock(&cd, cyc, (u32)~0); |
212 | } | 199 | } |
213 | 200 | ||
@@ -225,20 +212,22 @@ static unsigned long long notrace omap_mpu_sched_clock(void) | |||
225 | 212 | ||
226 | static void notrace mpu_update_sched_clock(void) | 213 | static void notrace mpu_update_sched_clock(void) |
227 | { | 214 | { |
228 | u32 cyc = mpu_read(&clocksource_mpu); | 215 | u32 cyc = ~omap_mpu_timer_read(1); |
229 | update_sched_clock(&cd, cyc, (u32)~0); | 216 | update_sched_clock(&cd, cyc, (u32)~0); |
230 | } | 217 | } |
231 | 218 | ||
232 | static void __init omap_init_clocksource(unsigned long rate) | 219 | static void __init omap_init_clocksource(unsigned long rate) |
233 | { | 220 | { |
221 | omap_mpu_timer_regs_t __iomem *timer = omap_mpu_timer_base(1); | ||
234 | static char err[] __initdata = KERN_ERR | 222 | static char err[] __initdata = KERN_ERR |
235 | "%s: can't register clocksource!\n"; | 223 | "%s: can't register clocksource!\n"; |
236 | 224 | ||
237 | omap_mpu_timer_start(1, ~0, 1); | 225 | omap_mpu_timer_start(1, ~0, 1); |
238 | init_sched_clock(&cd, mpu_update_sched_clock, 32, rate); | 226 | init_sched_clock(&cd, mpu_update_sched_clock, 32, rate); |
239 | 227 | ||
240 | if (clocksource_register_hz(&clocksource_mpu, rate)) | 228 | if (clocksource_mmio_init(&timer->read_tim, "mpu_timer2", rate, |
241 | printk(err, clocksource_mpu.name); | 229 | 300, 32, clocksource_mmio_readl_down)) |
230 | printk(err, "mpu_timer2"); | ||
242 | } | 231 | } |
243 | 232 | ||
244 | static void __init omap_mpu_timer_init(void) | 233 | static void __init omap_mpu_timer_init(void) |