aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68knommu/platform/68328
diff options
context:
space:
mode:
authorGreg Ungerer <gerg@snapgear.com>2007-07-19 04:49:12 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-19 13:04:50 -0400
commit2502b667ea835ee16685c74b2a0d89ba8afe117a (patch)
tree31d492fb934df6d83819b679f3aa8d7f6952396d /arch/m68knommu/platform/68328
parentf8af0bb890d6cdcb09ec042c128e217a7c500355 (diff)
m68knommu: generic irq handling
Change the m68knommu irq handling to use the generic irq framework. Signed-off-by: Greg Ungerer <gerg@uclinux.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/m68knommu/platform/68328')
-rw-r--r--arch/m68knommu/platform/68328/entry.S10
-rw-r--r--arch/m68knommu/platform/68328/ints.c130
2 files changed, 21 insertions, 119 deletions
diff --git a/arch/m68knommu/platform/68328/entry.S b/arch/m68knommu/platform/68328/entry.S
index f97862715450..b1aef72f3baf 100644
--- a/arch/m68knommu/platform/68328/entry.S
+++ b/arch/m68knommu/platform/68328/entry.S
@@ -133,7 +133,6 @@ Lreturn:
133 */ 133 */
134inthandler1: 134inthandler1:
135 SAVE_ALL 135 SAVE_ALL
136 addql #1,local_irq_count /* put exception # in d0*/
137 movew %sp@(PT_VECTOR), %d0 136 movew %sp@(PT_VECTOR), %d0
138 and #0x3ff, %d0 137 and #0x3ff, %d0
139 138
@@ -145,7 +144,6 @@ inthandler1:
145 144
146inthandler2: 145inthandler2:
147 SAVE_ALL 146 SAVE_ALL
148 addql #1,local_irq_count /* put exception # in d0*/
149 movew %sp@(PT_VECTOR), %d0 147 movew %sp@(PT_VECTOR), %d0
150 and #0x3ff, %d0 148 and #0x3ff, %d0
151 149
@@ -157,7 +155,6 @@ inthandler2:
157 155
158inthandler3: 156inthandler3:
159 SAVE_ALL 157 SAVE_ALL
160 addql #1,local_irq_count /* put exception # in d0*/
161 movew %sp@(PT_VECTOR), %d0 158 movew %sp@(PT_VECTOR), %d0
162 and #0x3ff, %d0 159 and #0x3ff, %d0
163 160
@@ -169,7 +166,6 @@ inthandler3:
169 166
170inthandler4: 167inthandler4:
171 SAVE_ALL 168 SAVE_ALL
172 addql #1,local_irq_count /* put exception # in d0*/
173 movew %sp@(PT_VECTOR), %d0 169 movew %sp@(PT_VECTOR), %d0
174 and #0x3ff, %d0 170 and #0x3ff, %d0
175 171
@@ -181,7 +177,6 @@ inthandler4:
181 177
182inthandler5: 178inthandler5:
183 SAVE_ALL 179 SAVE_ALL
184 addql #1,local_irq_count /* put exception # in d0*/
185 movew %sp@(PT_VECTOR), %d0 180 movew %sp@(PT_VECTOR), %d0
186 and #0x3ff, %d0 181 and #0x3ff, %d0
187 182
@@ -193,7 +188,6 @@ inthandler5:
193 188
194inthandler6: 189inthandler6:
195 SAVE_ALL 190 SAVE_ALL
196 addql #1,local_irq_count /* put exception # in d0*/
197 movew %sp@(PT_VECTOR), %d0 191 movew %sp@(PT_VECTOR), %d0
198 and #0x3ff, %d0 192 and #0x3ff, %d0
199 193
@@ -205,7 +199,6 @@ inthandler6:
205 199
206inthandler7: 200inthandler7:
207 SAVE_ALL 201 SAVE_ALL
208 addql #1,local_irq_count /* put exception # in d0*/
209 movew %sp@(PT_VECTOR), %d0 202 movew %sp@(PT_VECTOR), %d0
210 and #0x3ff, %d0 203 and #0x3ff, %d0
211 204
@@ -217,7 +210,6 @@ inthandler7:
217 210
218inthandler: 211inthandler:
219 SAVE_ALL 212 SAVE_ALL
220 addql #1,local_irq_count /* put exception # in d0*/
221 movew %sp@(PT_VECTOR), %d0 213 movew %sp@(PT_VECTOR), %d0
222 and #0x3ff, %d0 214 and #0x3ff, %d0
223 215
@@ -228,7 +220,6 @@ inthandler:
228 bra ret_from_interrupt 220 bra ret_from_interrupt
229 221
230ret_from_interrupt: 222ret_from_interrupt:
231 subql #1,local_irq_count
232 jeq 1f 223 jeq 1f
2332: 2242:
234 RESTORE_ALL 225 RESTORE_ALL
@@ -238,7 +229,6 @@ ret_from_interrupt:
238 jhi 2b 229 jhi 2b
239 230
240 /* check if we need to do software interrupts */ 231 /* check if we need to do software interrupts */
241 movel local_irq_count,%d0
242 jeq ret_from_exception 232 jeq ret_from_exception
243 233
244 pea ret_from_exception 234 pea ret_from_exception
diff --git a/arch/m68knommu/platform/68328/ints.c b/arch/m68knommu/platform/68328/ints.c
index 3de6e337554e..72e56d554f4f 100644
--- a/arch/m68knommu/platform/68328/ints.c
+++ b/arch/m68knommu/platform/68328/ints.c
@@ -9,21 +9,14 @@
9 * Copyright 1999 D. Jeff Dionne <jeff@rt-control.com> 9 * Copyright 1999 D. Jeff Dionne <jeff@rt-control.com>
10 */ 10 */
11 11
12#include <linux/module.h>
13#include <linux/types.h> 12#include <linux/types.h>
14#include <linux/kernel.h> 13#include <linux/kernel.h>
15#include <linux/sched.h> 14#include <linux/init.h>
16#include <linux/kernel_stat.h>
17#include <linux/errno.h>
18#include <linux/interrupt.h> 15#include <linux/interrupt.h>
19 16#include <linux/irq.h>
20#include <asm/system.h>
21#include <asm/irq.h>
22#include <asm/irqnode.h>
23#include <asm/traps.h> 17#include <asm/traps.h>
24#include <asm/io.h> 18#include <asm/io.h>
25#include <asm/machdep.h> 19#include <asm/machdep.h>
26#include <asm/setup.h>
27 20
28#if defined(CONFIG_M68328) 21#if defined(CONFIG_M68328)
29#include <asm/MC68328.h> 22#include <asm/MC68328.h>
@@ -79,16 +72,12 @@ extern e_vector *_ramvec;
79 72
80/* The number of spurious interrupts */ 73/* The number of spurious interrupts */
81volatile unsigned int num_spurious; 74volatile unsigned int num_spurious;
82unsigned int local_irq_count[NR_CPUS];
83
84/* irq node variables for the 32 (potential) on chip sources */
85static irq_node_t int_irq_list[NR_IRQS];
86 75
87/* 76/*
88 * This function should be called during kernel startup to initialize 77 * This function should be called during kernel startup to initialize
89 * the IRQ handling routines. 78 * the machine vector table.
90 */ 79 */
91void init_IRQ(void) 80void __init init_vectors(void)
92{ 81{
93 int i; 82 int i;
94 83
@@ -108,96 +97,10 @@ void init_IRQ(void)
108 97
109 IVR = 0x40; /* Set DragonBall IVR (interrupt base) to 64 */ 98 IVR = 0x40; /* Set DragonBall IVR (interrupt base) to 64 */
110 99
111 /* initialize handlers */
112 for (i = 0; i < NR_IRQS; i++) {
113 int_irq_list[i].handler = bad_interrupt;
114 int_irq_list[i].flags = IRQ_FLG_STD;
115 int_irq_list[i].dev_id = NULL;
116 int_irq_list[i].devname = NULL;
117 }
118
119 /* turn off all interrupts */ 100 /* turn off all interrupts */
120 IMR = ~0; 101 IMR = ~0;
121} 102}
122 103
123int request_irq(
124 unsigned int irq,
125 irq_handler_t handler,
126 unsigned long flags,
127 const char *devname,
128 void *dev_id)
129{
130 if (irq >= NR_IRQS) {
131 printk (KERN_ERR "%s: Unknown IRQ %d from %s\n", __FUNCTION__, irq, devname);
132 return -ENXIO;
133 }
134
135 if (!(int_irq_list[irq].flags & IRQ_FLG_STD)) {
136 if (int_irq_list[irq].flags & IRQ_FLG_LOCK) {
137 printk(KERN_ERR "%s: IRQ %d from %s is not replaceable\n",
138 __FUNCTION__, irq, int_irq_list[irq].devname);
139 return -EBUSY;
140 }
141 if (flags & IRQ_FLG_REPLACE) {
142 printk(KERN_ERR "%s: %s can't replace IRQ %d from %s\n",
143 __FUNCTION__, devname, irq, int_irq_list[irq].devname);
144 return -EBUSY;
145 }
146 }
147
148 int_irq_list[irq].handler = handler;
149 int_irq_list[irq].flags = flags;
150 int_irq_list[irq].dev_id = dev_id;
151 int_irq_list[irq].devname = devname;
152
153 IMR &= ~(1<<irq);
154
155 return 0;
156}
157
158EXPORT_SYMBOL(request_irq);
159
160void free_irq(unsigned int irq, void *dev_id)
161{
162 if (irq >= NR_IRQS) {
163 printk (KERN_ERR "%s: Unknown IRQ %d\n", __FUNCTION__, irq);
164 return;
165 }
166
167 if (int_irq_list[irq].dev_id != dev_id)
168 printk(KERN_INFO "%s: removing probably wrong IRQ %d from %s\n",
169 __FUNCTION__, irq, int_irq_list[irq].devname);
170
171 int_irq_list[irq].handler = bad_interrupt;
172 int_irq_list[irq].flags = IRQ_FLG_STD;
173 int_irq_list[irq].dev_id = NULL;
174 int_irq_list[irq].devname = NULL;
175
176 IMR |= 1<<irq;
177}
178
179EXPORT_SYMBOL(free_irq);
180
181int show_interrupts(struct seq_file *p, void *v)
182{
183 int i = *(loff_t *) v;
184
185 if (i < NR_IRQS) {
186 if (int_irq_list[i].devname) {
187 seq_printf(p, "%3d: %10u ", i, kstat_cpu(0).irqs[i]);
188 if (int_irq_list[i].flags & IRQ_FLG_LOCK)
189 seq_printf(p, "L ");
190 else
191 seq_printf(p, " ");
192 seq_printf(p, "%s\n", int_irq_list[i].devname);
193 }
194 }
195 if (i == NR_IRQS)
196 seq_printf(p, " : %10u spurious\n", num_spurious);
197
198 return 0;
199}
200
201/* The 68k family did not have a good way to determine the source 104/* The 68k family did not have a good way to determine the source
202 * of interrupts until later in the family. The EC000 core does 105 * of interrupts until later in the family. The EC000 core does
203 * not provide the vector number on the stack, we vector everything 106 * not provide the vector number on the stack, we vector everything
@@ -255,14 +158,23 @@ void process_int(int vec, struct pt_regs *fp)
255 irq++; 158 irq++;
256 } 159 }
257 160
258 kstat_cpu(0).irqs[irq]++; 161 do_IRQ(irq, fp);
259
260 if (int_irq_list[irq].handler) {
261 int_irq_list[irq].handler(irq, int_irq_list[irq].dev_id, fp);
262 } else {
263 printk(KERN_ERR "unregistered interrupt %d!\nTurning it off in the IMR...\n", irq);
264 IMR |= mask;
265 }
266 pend &= ~mask; 162 pend &= ~mask;
267 } 163 }
268} 164}
165
166void enable_vector(unsigned int irq)
167{
168 IMR &= ~(1<<irq);
169}
170
171void disable_vector(unsigned int irq)
172{
173 IMR |= (1<<irq);
174}
175
176void ack_vector(unsigned int irq)
177{
178 /* Nothing needed */
179}
180