diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-05-08 13:50:20 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-05-14 05:29:48 -0400 |
commit | 8c414ff3f4dcdde228c6a668385218290d73a265 (patch) | |
tree | 2454fc7bf7d76b13fd6c03c08954afbae9d633b0 /arch/arm/mach-footbridge | |
parent | 89c0b8e2520e12d69dafc663dfbd39f8180438ea (diff) |
clocksource: convert footbridge to generic i8253 clocksource
Convert the footbridge isa-timer code to use generic i8253 clocksource.
Acked-by: John Stultz <john.stultz@linaro.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-footbridge')
-rw-r--r-- | arch/arm/mach-footbridge/Kconfig | 2 | ||||
-rw-r--r-- | arch/arm/mach-footbridge/isa-timer.c | 45 |
2 files changed, 6 insertions, 41 deletions
diff --git a/arch/arm/mach-footbridge/Kconfig b/arch/arm/mach-footbridge/Kconfig index bdd257921cfb..46adca068f2c 100644 --- a/arch/arm/mach-footbridge/Kconfig +++ b/arch/arm/mach-footbridge/Kconfig | |||
@@ -4,6 +4,7 @@ menu "Footbridge Implementations" | |||
4 | 4 | ||
5 | config ARCH_CATS | 5 | config ARCH_CATS |
6 | bool "CATS" | 6 | bool "CATS" |
7 | select CLKSRC_I8253 | ||
7 | select FOOTBRIDGE_HOST | 8 | select FOOTBRIDGE_HOST |
8 | select ISA | 9 | select ISA |
9 | select ISA_DMA | 10 | select ISA_DMA |
@@ -59,6 +60,7 @@ config ARCH_EBSA285_HOST | |||
59 | 60 | ||
60 | config ARCH_NETWINDER | 61 | config ARCH_NETWINDER |
61 | bool "NetWinder" | 62 | bool "NetWinder" |
63 | select CLKSRC_I8253 | ||
62 | select FOOTBRIDGE_HOST | 64 | select FOOTBRIDGE_HOST |
63 | select ISA | 65 | select ISA |
64 | select ISA_DMA | 66 | select ISA_DMA |
diff --git a/arch/arm/mach-footbridge/isa-timer.c b/arch/arm/mach-footbridge/isa-timer.c index 441c6ce0d555..7020f1a3feca 100644 --- a/arch/arm/mach-footbridge/isa-timer.c +++ b/arch/arm/mach-footbridge/isa-timer.c | |||
@@ -10,53 +10,16 @@ | |||
10 | #include <linux/interrupt.h> | 10 | #include <linux/interrupt.h> |
11 | #include <linux/irq.h> | 11 | #include <linux/irq.h> |
12 | #include <linux/io.h> | 12 | #include <linux/io.h> |
13 | #include <linux/spinlock.h> | ||
13 | #include <linux/timex.h> | 14 | #include <linux/timex.h> |
14 | 15 | ||
15 | #include <asm/irq.h> | 16 | #include <asm/irq.h> |
16 | 17 | #include <asm/i8253.h> | |
17 | #include <asm/mach/time.h> | 18 | #include <asm/mach/time.h> |
18 | 19 | ||
19 | #include "common.h" | 20 | #include "common.h" |
20 | 21 | ||
21 | #define PIT_MODE 0x43 | 22 | DEFINE_RAW_SPINLOCK(i8253_lock); |
22 | #define PIT_CH0 0x40 | ||
23 | |||
24 | #define PIT_LATCH ((PIT_TICK_RATE + HZ / 2) / HZ) | ||
25 | |||
26 | static cycle_t pit_read(struct clocksource *cs) | ||
27 | { | ||
28 | unsigned long flags; | ||
29 | static int old_count; | ||
30 | static u32 old_jifs; | ||
31 | int count; | ||
32 | u32 jifs; | ||
33 | |||
34 | raw_local_irq_save(flags); | ||
35 | |||
36 | jifs = jiffies; | ||
37 | outb_p(0x00, PIT_MODE); /* latch the count */ | ||
38 | count = inb_p(PIT_CH0); /* read the latched count */ | ||
39 | count |= inb_p(PIT_CH0) << 8; | ||
40 | |||
41 | if (count > old_count && jifs == old_jifs) | ||
42 | count = old_count; | ||
43 | |||
44 | old_count = count; | ||
45 | old_jifs = jifs; | ||
46 | |||
47 | raw_local_irq_restore(flags); | ||
48 | |||
49 | count = (PIT_LATCH - 1) - count; | ||
50 | |||
51 | return (cycle_t)(jifs * PIT_LATCH) + count; | ||
52 | } | ||
53 | |||
54 | static struct clocksource pit_cs = { | ||
55 | .name = "pit", | ||
56 | .rating = 110, | ||
57 | .read = pit_read, | ||
58 | .mask = CLOCKSOURCE_MASK(32), | ||
59 | }; | ||
60 | 23 | ||
61 | static void pit_set_mode(enum clock_event_mode mode, | 24 | static void pit_set_mode(enum clock_event_mode mode, |
62 | struct clock_event_device *evt) | 25 | struct clock_event_device *evt) |
@@ -121,7 +84,7 @@ static void __init isa_timer_init(void) | |||
121 | pit_ce.max_delta_ns = clockevent_delta2ns(0x7fff, &pit_ce); | 84 | pit_ce.max_delta_ns = clockevent_delta2ns(0x7fff, &pit_ce); |
122 | pit_ce.min_delta_ns = clockevent_delta2ns(0x000f, &pit_ce); | 85 | pit_ce.min_delta_ns = clockevent_delta2ns(0x000f, &pit_ce); |
123 | 86 | ||
124 | clocksource_register_hz(&pit_cs, PIT_TICK_RATE); | 87 | clocksource_i8253_init(); |
125 | 88 | ||
126 | setup_irq(pit_ce.irq, &pit_timer_irq); | 89 | setup_irq(pit_ce.irq, &pit_timer_irq); |
127 | clockevents_register_device(&pit_ce); | 90 | clockevents_register_device(&pit_ce); |