diff options
-rw-r--r-- | arch/arm/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm/plat-iop/time.c | 15 |
2 files changed, 13 insertions, 3 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index d5bd266ee565..58e2fe30715b 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -992,6 +992,7 @@ config ARCH_ACORN | |||
992 | config PLAT_IOP | 992 | config PLAT_IOP |
993 | bool | 993 | bool |
994 | select GENERIC_CLOCKEVENTS | 994 | select GENERIC_CLOCKEVENTS |
995 | select HAVE_SCHED_CLOCK | ||
995 | 996 | ||
996 | config PLAT_ORION | 997 | config PLAT_ORION |
997 | bool | 998 | bool |
diff --git a/arch/arm/plat-iop/time.c b/arch/arm/plat-iop/time.c index d03a93295e60..2db6e60d149d 100644 --- a/arch/arm/plat-iop/time.c +++ b/arch/arm/plat-iop/time.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/clockchips.h> | 24 | #include <linux/clockchips.h> |
25 | #include <mach/hardware.h> | 25 | #include <mach/hardware.h> |
26 | #include <asm/irq.h> | 26 | #include <asm/irq.h> |
27 | #include <asm/sched_clock.h> | ||
27 | #include <asm/uaccess.h> | 28 | #include <asm/uaccess.h> |
28 | #include <asm/mach/irq.h> | 29 | #include <asm/mach/irq.h> |
29 | #include <asm/mach/time.h> | 30 | #include <asm/mach/time.h> |
@@ -50,15 +51,21 @@ static struct clocksource iop_clocksource = { | |||
50 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 51 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
51 | }; | 52 | }; |
52 | 53 | ||
54 | static DEFINE_CLOCK_DATA(cd); | ||
55 | |||
53 | /* | 56 | /* |
54 | * IOP sched_clock() implementation via its clocksource. | 57 | * IOP sched_clock() implementation via its clocksource. |
55 | */ | 58 | */ |
56 | unsigned long long notrace sched_clock(void) | 59 | unsigned long long notrace sched_clock(void) |
57 | { | 60 | { |
58 | cycle_t cyc = iop_clocksource_read(NULL); | 61 | u32 cyc = 0xffffffffu - read_tcr1(); |
59 | struct clocksource *cs = &iop_clocksource; | 62 | return cyc_to_sched_clock(&cd, cyc, (u32)~0); |
63 | } | ||
60 | 64 | ||
61 | return clocksource_cyc2ns(cyc, cs->mult, cs->shift); | 65 | static void notrace iop_update_sched_clock(void) |
66 | { | ||
67 | u32 cyc = 0xffffffffu - read_tcr1(); | ||
68 | update_sched_clock(&cd, cyc, (u32)~0); | ||
62 | } | 69 | } |
63 | 70 | ||
64 | /* | 71 | /* |
@@ -144,6 +151,8 @@ void __init iop_init_time(unsigned long tick_rate) | |||
144 | { | 151 | { |
145 | u32 timer_ctl; | 152 | u32 timer_ctl; |
146 | 153 | ||
154 | init_sched_clock(&cd, iop_update_sched_clock, 32, tick_rate); | ||
155 | |||
147 | ticks_per_jiffy = DIV_ROUND_CLOSEST(tick_rate, HZ); | 156 | ticks_per_jiffy = DIV_ROUND_CLOSEST(tick_rate, HZ); |
148 | iop_tick_rate = tick_rate; | 157 | iop_tick_rate = tick_rate; |
149 | 158 | ||