diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-12-15 16:23:13 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-12-22 17:44:44 -0500 |
commit | 5b0d495c067d843c52fc1f9edbca29d5e9368b10 (patch) | |
tree | 5af99e500e83ee8aa9946fe197db45784ec7df64 /arch/arm | |
parent | 112f38a4a31668eb6a7d91d128296a26afdf7c4b (diff) |
ARM: ixp4xx: convert sched_clock() to use new infrastructure
Convert ixp4xx to use the new sched_clock() infrastructure for
extending 32bit counters to full 64-bit nanoseconds.
Tested-by: Mikael Pettersson <mikpe@it.uu.se>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm/mach-ixp4xx/common.c | 31 |
2 files changed, 21 insertions, 11 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index ed7a0a729d9c..6f58bce687f3 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -437,6 +437,7 @@ config ARCH_IXP4XX | |||
437 | select CPU_XSCALE | 437 | select CPU_XSCALE |
438 | select GENERIC_GPIO | 438 | select GENERIC_GPIO |
439 | select GENERIC_CLOCKEVENTS | 439 | select GENERIC_CLOCKEVENTS |
440 | select HAVE_SCHED_CLOCK | ||
440 | select DMABOUNCE if PCI | 441 | select DMABOUNCE if PCI |
441 | help | 442 | help |
442 | Support for Intel's IXP4XX (XScale) family of processors. | 443 | Support for Intel's IXP4XX (XScale) family of processors. |
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c index e0b91d8ef644..4dbfcbb9163c 100644 --- a/arch/arm/mach-ixp4xx/common.c +++ b/arch/arm/mach-ixp4xx/common.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <asm/pgtable.h> | 35 | #include <asm/pgtable.h> |
36 | #include <asm/page.h> | 36 | #include <asm/page.h> |
37 | #include <asm/irq.h> | 37 | #include <asm/irq.h> |
38 | #include <asm/sched_clock.h> | ||
38 | 39 | ||
39 | #include <asm/mach/map.h> | 40 | #include <asm/mach/map.h> |
40 | #include <asm/mach/irq.h> | 41 | #include <asm/mach/irq.h> |
@@ -399,6 +400,23 @@ void __init ixp4xx_sys_init(void) | |||
399 | } | 400 | } |
400 | 401 | ||
401 | /* | 402 | /* |
403 | * sched_clock() | ||
404 | */ | ||
405 | static DEFINE_CLOCK_DATA(cd); | ||
406 | |||
407 | unsigned long long notrace sched_clock(void) | ||
408 | { | ||
409 | u32 cyc = *IXP4XX_OSTS; | ||
410 | return cyc_to_sched_clock(&cd, cyc, (u32)~0); | ||
411 | } | ||
412 | |||
413 | static void notrace ixp4xx_update_sched_clock(void) | ||
414 | { | ||
415 | u32 cyc = *IXP4XX_OSTS; | ||
416 | update_sched_clock(&cd, cyc, (u32)~0); | ||
417 | } | ||
418 | |||
419 | /* | ||
402 | * clocksource | 420 | * clocksource |
403 | */ | 421 | */ |
404 | static cycle_t ixp4xx_get_cycles(struct clocksource *cs) | 422 | static cycle_t ixp4xx_get_cycles(struct clocksource *cs) |
@@ -418,18 +436,9 @@ unsigned long ixp4xx_timer_freq = FREQ; | |||
418 | EXPORT_SYMBOL(ixp4xx_timer_freq); | 436 | EXPORT_SYMBOL(ixp4xx_timer_freq); |
419 | static void __init ixp4xx_clocksource_init(void) | 437 | static void __init ixp4xx_clocksource_init(void) |
420 | { | 438 | { |
421 | clocksource_register_hz(&clocksource_ixp4xx, ixp4xx_timer_freq); | 439 | init_sched_clock(&cd, ixp4xx_update_sched_clock, 32, ixp4xx_timer_freq); |
422 | } | ||
423 | |||
424 | /* | ||
425 | * sched_clock() | ||
426 | */ | ||
427 | unsigned long long notrace sched_clock(void) | ||
428 | { | ||
429 | cycle_t cyc = ixp4xx_get_cycles(NULL); | ||
430 | struct clocksource *cs = &clocksource_ixp4xx; | ||
431 | 440 | ||
432 | return clocksource_cyc2ns(cyc, cs->mult, cs->shift); | 441 | clocksource_register_hz(&clocksource_ixp4xx, ixp4xx_timer_freq); |
433 | } | 442 | } |
434 | 443 | ||
435 | /* | 444 | /* |