diff options
Diffstat (limited to 'arch/arm/mach-ixp4xx')
-rw-r--r-- | arch/arm/mach-ixp4xx/common.c | 38 | ||||
-rw-r--r-- | arch/arm/mach-ixp4xx/nslu2-setup.c | 2 |
2 files changed, 29 insertions, 11 deletions
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c index 7c25dbd5a181..35dd8b3824b0 100644 --- a/arch/arm/mach-ixp4xx/common.c +++ b/arch/arm/mach-ixp4xx/common.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/bitops.h> | 26 | #include <linux/bitops.h> |
27 | #include <linux/time.h> | 27 | #include <linux/time.h> |
28 | #include <linux/timex.h> | 28 | #include <linux/timex.h> |
29 | #include <linux/clocksource.h> | ||
29 | 30 | ||
30 | #include <asm/hardware.h> | 31 | #include <asm/hardware.h> |
31 | #include <asm/uaccess.h> | 32 | #include <asm/uaccess.h> |
@@ -255,16 +256,6 @@ static unsigned volatile last_jiffy_time; | |||
255 | 256 | ||
256 | #define CLOCK_TICKS_PER_USEC ((CLOCK_TICK_RATE + USEC_PER_SEC/2) / USEC_PER_SEC) | 257 | #define CLOCK_TICKS_PER_USEC ((CLOCK_TICK_RATE + USEC_PER_SEC/2) / USEC_PER_SEC) |
257 | 258 | ||
258 | /* IRQs are disabled before entering here from do_gettimeofday() */ | ||
259 | static unsigned long ixp4xx_gettimeoffset(void) | ||
260 | { | ||
261 | u32 elapsed; | ||
262 | |||
263 | elapsed = *IXP4XX_OSTS - last_jiffy_time; | ||
264 | |||
265 | return elapsed / CLOCK_TICKS_PER_USEC; | ||
266 | } | ||
267 | |||
268 | static irqreturn_t ixp4xx_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) | 259 | static irqreturn_t ixp4xx_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) |
269 | { | 260 | { |
270 | write_seqlock(&xtime_lock); | 261 | write_seqlock(&xtime_lock); |
@@ -309,7 +300,6 @@ static void __init ixp4xx_timer_init(void) | |||
309 | 300 | ||
310 | struct sys_timer ixp4xx_timer = { | 301 | struct sys_timer ixp4xx_timer = { |
311 | .init = ixp4xx_timer_init, | 302 | .init = ixp4xx_timer_init, |
312 | .offset = ixp4xx_gettimeoffset, | ||
313 | }; | 303 | }; |
314 | 304 | ||
315 | static struct resource ixp46x_i2c_resources[] = { | 305 | static struct resource ixp46x_i2c_resources[] = { |
@@ -365,3 +355,29 @@ void __init ixp4xx_sys_init(void) | |||
365 | ixp4xx_exp_bus_size >> 20); | 355 | ixp4xx_exp_bus_size >> 20); |
366 | } | 356 | } |
367 | 357 | ||
358 | cycle_t ixp4xx_get_cycles(void) | ||
359 | { | ||
360 | return *IXP4XX_OSTS; | ||
361 | } | ||
362 | |||
363 | static struct clocksource clocksource_ixp4xx = { | ||
364 | .name = "OSTS", | ||
365 | .rating = 200, | ||
366 | .read = ixp4xx_get_cycles, | ||
367 | .mask = CLOCKSOURCE_MASK(32), | ||
368 | .shift = 20, | ||
369 | .is_continuous = 1, | ||
370 | }; | ||
371 | |||
372 | unsigned long ixp4xx_timer_freq = FREQ; | ||
373 | static int __init ixp4xx_clocksource_init(void) | ||
374 | { | ||
375 | clocksource_ixp4xx.mult = | ||
376 | clocksource_hz2mult(ixp4xx_timer_freq, | ||
377 | clocksource_ixp4xx.shift); | ||
378 | clocksource_register(&clocksource_ixp4xx); | ||
379 | |||
380 | return 0; | ||
381 | } | ||
382 | |||
383 | device_initcall(ixp4xx_clocksource_init); | ||
diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c index 749a337494d3..162c266e5f8f 100644 --- a/arch/arm/mach-ixp4xx/nslu2-setup.c +++ b/arch/arm/mach-ixp4xx/nslu2-setup.c | |||
@@ -159,6 +159,8 @@ static void nslu2_power_off(void) | |||
159 | 159 | ||
160 | static void __init nslu2_init(void) | 160 | static void __init nslu2_init(void) |
161 | { | 161 | { |
162 | ixp4xx_timer_freq = NSLU2_FREQ; | ||
163 | |||
162 | ixp4xx_sys_init(); | 164 | ixp4xx_sys_init(); |
163 | 165 | ||
164 | nslu2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); | 166 | nslu2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0); |