aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/mach-ixp4xx/common.c38
-rw-r--r--arch/arm/mach-ixp4xx/nslu2-setup.c2
-rw-r--r--include/asm-arm/arch-ixp4xx/platform.h5
4 files changed, 35 insertions, 11 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 314ac6ba0ec4..147abe0383d8 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -226,6 +226,7 @@ config ARCH_IOP33X
226config ARCH_IXP4XX 226config ARCH_IXP4XX
227 bool "IXP4xx-based" 227 bool "IXP4xx-based"
228 depends on MMU 228 depends on MMU
229 select GENERIC_TIME
229 help 230 help
230 Support for Intel's IXP4XX (XScale) family of processors. 231 Support for Intel's IXP4XX (XScale) family of processors.
231 232
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() */
259static 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
268static irqreturn_t ixp4xx_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) 259static 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
310struct sys_timer ixp4xx_timer = { 301struct sys_timer ixp4xx_timer = {
311 .init = ixp4xx_timer_init, 302 .init = ixp4xx_timer_init,
312 .offset = ixp4xx_gettimeoffset,
313}; 303};
314 304
315static struct resource ixp46x_i2c_resources[] = { 305static 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
358cycle_t ixp4xx_get_cycles(void)
359{
360 return *IXP4XX_OSTS;
361}
362
363static 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
372unsigned long ixp4xx_timer_freq = FREQ;
373static 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
383device_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
160static void __init nslu2_init(void) 160static 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);
diff --git a/include/asm-arm/arch-ixp4xx/platform.h b/include/asm-arm/arch-ixp4xx/platform.h
index 13aee17b0475..8d10a9187693 100644
--- a/include/asm-arm/arch-ixp4xx/platform.h
+++ b/include/asm-arm/arch-ixp4xx/platform.h
@@ -90,6 +90,11 @@ struct ixp4xx_i2c_pins {
90struct sys_timer; 90struct sys_timer;
91 91
92/* 92/*
93 * Frequency of clock used for primary clocksource
94 */
95extern unsigned long ixp4xx_timer_freq;
96
97/*
93 * Functions used by platform-level setup code 98 * Functions used by platform-level setup code
94 */ 99 */
95extern void ixp4xx_map_io(void); 100extern void ixp4xx_map_io(void);