diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2007-10-11 18:46:09 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2007-10-11 18:46:09 -0400 |
commit | 584d98be3b90f00b410288e59eeba871fbf81b86 (patch) | |
tree | f78b1f537869d15f2bdd33c0a4f363c8fc6b256a | |
parent | ea5804015c0ce67741eb4b156a071fb4f415345f (diff) |
[MIPS] Jazz clockevent driver
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | arch/mips/jazz/irq.c | 48 | ||||
-rw-r--r-- | arch/mips/jazz/setup.c | 7 |
2 files changed, 48 insertions, 7 deletions
diff --git a/arch/mips/jazz/irq.c b/arch/mips/jazz/irq.c index 56235412cbb7..835b056cea36 100644 --- a/arch/mips/jazz/irq.c +++ b/arch/mips/jazz/irq.c | |||
@@ -6,6 +6,7 @@ | |||
6 | * Copyright (C) 1992 Linus Torvalds | 6 | * Copyright (C) 1992 Linus Torvalds |
7 | * Copyright (C) 1994 - 2001, 2003 Ralf Baechle | 7 | * Copyright (C) 1994 - 2001, 2003 Ralf Baechle |
8 | */ | 8 | */ |
9 | #include <linux/clockchips.h> | ||
9 | #include <linux/init.h> | 10 | #include <linux/init.h> |
10 | #include <linux/interrupt.h> | 11 | #include <linux/interrupt.h> |
11 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
@@ -105,3 +106,50 @@ asmlinkage void plat_irq_dispatch(void) | |||
105 | panic("Unimplemented loc_no_irq handler"); | 106 | panic("Unimplemented loc_no_irq handler"); |
106 | } | 107 | } |
107 | } | 108 | } |
109 | |||
110 | static void r4030_set_mode(enum clock_event_mode mode, | ||
111 | struct clock_event_device *evt) | ||
112 | { | ||
113 | /* Nothing to do ... */ | ||
114 | } | ||
115 | |||
116 | struct clock_event_device r4030_clockevent = { | ||
117 | .name = "r4030", | ||
118 | .features = CLOCK_EVT_FEAT_PERIODIC, | ||
119 | .rating = 100, | ||
120 | .irq = JAZZ_TIMER_IRQ, | ||
121 | .cpumask = CPU_MASK_CPU0, | ||
122 | .set_mode = r4030_set_mode, | ||
123 | }; | ||
124 | |||
125 | static irqreturn_t r4030_timer_interrupt(int irq, void *dev_id) | ||
126 | { | ||
127 | r4030_clockevent.event_handler(&r4030_clockevent); | ||
128 | |||
129 | return IRQ_HANDLED; | ||
130 | } | ||
131 | |||
132 | static struct irqaction r4030_timer_irqaction = { | ||
133 | .handler = r4030_timer_interrupt, | ||
134 | .flags = IRQF_DISABLED, | ||
135 | .mask = CPU_MASK_CPU0, | ||
136 | .name = "timer", | ||
137 | }; | ||
138 | |||
139 | void __init plat_timer_setup(struct irqaction *ignored) | ||
140 | { | ||
141 | struct irqaction *irq = &r4030_timer_irqaction; | ||
142 | |||
143 | BUG_ON(HZ != 100); | ||
144 | |||
145 | /* | ||
146 | * Set clock to 100Hz. | ||
147 | * | ||
148 | * The R4030 timer receives an input clock of 1kHz which is divieded by | ||
149 | * a programmable 4-bit divider. This makes it fairly inflexible. | ||
150 | */ | ||
151 | r4030_write_reg32(JAZZ_TIMER_INTERVAL, 9); | ||
152 | setup_irq(JAZZ_TIMER_IRQ, irq); | ||
153 | |||
154 | clockevents_register_device(&r4030_clockevent); | ||
155 | } | ||
diff --git a/arch/mips/jazz/setup.c b/arch/mips/jazz/setup.c index 5c6271ab927f..fa890df36589 100644 --- a/arch/mips/jazz/setup.c +++ b/arch/mips/jazz/setup.c | |||
@@ -39,13 +39,6 @@ extern asmlinkage void jazz_handle_int(void); | |||
39 | 39 | ||
40 | extern void jazz_machine_restart(char *command); | 40 | extern void jazz_machine_restart(char *command); |
41 | 41 | ||
42 | void __init plat_timer_setup(struct irqaction *irq) | ||
43 | { | ||
44 | /* set the clock to 100 Hz */ | ||
45 | r4030_write_reg32(JAZZ_TIMER_INTERVAL, 9); | ||
46 | setup_irq(JAZZ_TIMER_IRQ, irq); | ||
47 | } | ||
48 | |||
49 | static struct resource jazz_io_resources[] = { | 42 | static struct resource jazz_io_resources[] = { |
50 | { | 43 | { |
51 | .start = 0x00, | 44 | .start = 0x00, |