]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/mips/au1000/common/irq.c
f0626992fd75fce7b4f735d91c9db199ccdaba55
[linux-2.6-omap-h63xx.git] / arch / mips / au1000 / common / irq.c
1 /*
2  * Copyright 2001, 2007-2008 MontaVista Software Inc.
3  * Author: MontaVista Software, Inc. <source@mvista.com>
4  *
5  * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org)
6  *
7  *  This program is free software; you can redistribute  it and/or modify it
8  *  under  the terms of  the GNU General  Public License as published by the
9  *  Free Software Foundation;  either version 2 of the  License, or (at your
10  *  option) any later version.
11  *
12  *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
13  *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
14  *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
15  *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
16  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17  *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
18  *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19  *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
20  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21  *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22  *
23  *  You should have received a copy of the  GNU General Public License along
24  *  with this program; if not, write  to the Free Software Foundation, Inc.,
25  *  675 Mass Ave, Cambridge, MA 02139, USA.
26  */
27 #include <linux/bitops.h>
28 #include <linux/init.h>
29 #include <linux/interrupt.h>
30 #include <linux/irq.h>
31
32 #include <asm/irq_cpu.h>
33 #include <asm/mipsregs.h>
34 #include <asm/mach-au1x00/au1000.h>
35 #ifdef CONFIG_MIPS_PB1000
36 #include <asm/mach-pb1x00/pb1000.h>
37 #endif
38
39 #define EXT_INTC0_REQ0 2 /* IP 2 */
40 #define EXT_INTC0_REQ1 3 /* IP 3 */
41 #define EXT_INTC1_REQ0 4 /* IP 4 */
42 #define EXT_INTC1_REQ1 5 /* IP 5 */
43 #define MIPS_TIMER_IP  7 /* IP 7 */
44
45 void (*board_init_irq)(void) __initdata = NULL;
46
47 static DEFINE_SPINLOCK(irq_lock);
48
49 #ifdef CONFIG_PM
50
51 /*
52  * Save/restore the interrupt controller state.
53  * Called from the save/restore core registers as part of the
54  * au_sleep function in power.c.....maybe I should just pm_register()
55  * them instead?
56  */
57 static unsigned int     sleep_intctl_config0[2];
58 static unsigned int     sleep_intctl_config1[2];
59 static unsigned int     sleep_intctl_config2[2];
60 static unsigned int     sleep_intctl_src[2];
61 static unsigned int     sleep_intctl_assign[2];
62 static unsigned int     sleep_intctl_wake[2];
63 static unsigned int     sleep_intctl_mask[2];
64
65 void save_au1xxx_intctl(void)
66 {
67         sleep_intctl_config0[0] = au_readl(IC0_CFG0RD);
68         sleep_intctl_config1[0] = au_readl(IC0_CFG1RD);
69         sleep_intctl_config2[0] = au_readl(IC0_CFG2RD);
70         sleep_intctl_src[0] = au_readl(IC0_SRCRD);
71         sleep_intctl_assign[0] = au_readl(IC0_ASSIGNRD);
72         sleep_intctl_wake[0] = au_readl(IC0_WAKERD);
73         sleep_intctl_mask[0] = au_readl(IC0_MASKRD);
74
75         sleep_intctl_config0[1] = au_readl(IC1_CFG0RD);
76         sleep_intctl_config1[1] = au_readl(IC1_CFG1RD);
77         sleep_intctl_config2[1] = au_readl(IC1_CFG2RD);
78         sleep_intctl_src[1] = au_readl(IC1_SRCRD);
79         sleep_intctl_assign[1] = au_readl(IC1_ASSIGNRD);
80         sleep_intctl_wake[1] = au_readl(IC1_WAKERD);
81         sleep_intctl_mask[1] = au_readl(IC1_MASKRD);
82 }
83
84 /*
85  * For most restore operations, we clear the entire register and
86  * then set the bits we found during the save.
87  */
88 void restore_au1xxx_intctl(void)
89 {
90         au_writel(0xffffffff, IC0_MASKCLR); au_sync();
91
92         au_writel(0xffffffff, IC0_CFG0CLR); au_sync();
93         au_writel(sleep_intctl_config0[0], IC0_CFG0SET); au_sync();
94         au_writel(0xffffffff, IC0_CFG1CLR); au_sync();
95         au_writel(sleep_intctl_config1[0], IC0_CFG1SET); au_sync();
96         au_writel(0xffffffff, IC0_CFG2CLR); au_sync();
97         au_writel(sleep_intctl_config2[0], IC0_CFG2SET); au_sync();
98         au_writel(0xffffffff, IC0_SRCCLR); au_sync();
99         au_writel(sleep_intctl_src[0], IC0_SRCSET); au_sync();
100         au_writel(0xffffffff, IC0_ASSIGNCLR); au_sync();
101         au_writel(sleep_intctl_assign[0], IC0_ASSIGNSET); au_sync();
102         au_writel(0xffffffff, IC0_WAKECLR); au_sync();
103         au_writel(sleep_intctl_wake[0], IC0_WAKESET); au_sync();
104         au_writel(0xffffffff, IC0_RISINGCLR); au_sync();
105         au_writel(0xffffffff, IC0_FALLINGCLR); au_sync();
106         au_writel(0x00000000, IC0_TESTBIT); au_sync();
107
108         au_writel(0xffffffff, IC1_MASKCLR); au_sync();
109
110         au_writel(0xffffffff, IC1_CFG0CLR); au_sync();
111         au_writel(sleep_intctl_config0[1], IC1_CFG0SET); au_sync();
112         au_writel(0xffffffff, IC1_CFG1CLR); au_sync();
113         au_writel(sleep_intctl_config1[1], IC1_CFG1SET); au_sync();
114         au_writel(0xffffffff, IC1_CFG2CLR); au_sync();
115         au_writel(sleep_intctl_config2[1], IC1_CFG2SET); au_sync();
116         au_writel(0xffffffff, IC1_SRCCLR); au_sync();
117         au_writel(sleep_intctl_src[1], IC1_SRCSET); au_sync();
118         au_writel(0xffffffff, IC1_ASSIGNCLR); au_sync();
119         au_writel(sleep_intctl_assign[1], IC1_ASSIGNSET); au_sync();
120         au_writel(0xffffffff, IC1_WAKECLR); au_sync();
121         au_writel(sleep_intctl_wake[1], IC1_WAKESET); au_sync();
122         au_writel(0xffffffff, IC1_RISINGCLR); au_sync();
123         au_writel(0xffffffff, IC1_FALLINGCLR); au_sync();
124         au_writel(0x00000000, IC1_TESTBIT); au_sync();
125
126         au_writel(sleep_intctl_mask[1], IC1_MASKSET); au_sync();
127
128         au_writel(sleep_intctl_mask[0], IC0_MASKSET); au_sync();
129 }
130 #endif /* CONFIG_PM */
131
132
133 inline void local_enable_irq(unsigned int irq_nr)
134 {
135         unsigned int bit = irq_nr - AU1000_INTC0_INT_BASE;
136
137         if (bit >= 32) {
138                 au_writel(1 << (bit - 32), IC1_MASKSET);
139                 au_writel(1 << (bit - 32), IC1_WAKESET);
140         } else {
141                 au_writel(1 << bit, IC0_MASKSET);
142                 au_writel(1 << bit, IC0_WAKESET);
143         }
144         au_sync();
145 }
146
147
148 inline void local_disable_irq(unsigned int irq_nr)
149 {
150         unsigned int bit = irq_nr - AU1000_INTC0_INT_BASE;
151
152         if (bit >= 32) {
153                 au_writel(1 << (bit - 32), IC1_MASKCLR);
154                 au_writel(1 << (bit - 32), IC1_WAKECLR);
155         } else {
156                 au_writel(1 << bit, IC0_MASKCLR);
157                 au_writel(1 << bit, IC0_WAKECLR);
158         }
159         au_sync();
160 }
161
162
163 static inline void mask_and_ack_rise_edge_irq(unsigned int irq_nr)
164 {
165         unsigned int bit = irq_nr - AU1000_INTC0_INT_BASE;
166
167         if (bit >= 32) {
168                 au_writel(1 << (bit - 32), IC1_RISINGCLR);
169                 au_writel(1 << (bit - 32), IC1_MASKCLR);
170         } else {
171                 au_writel(1 << bit, IC0_RISINGCLR);
172                 au_writel(1 << bit, IC0_MASKCLR);
173         }
174         au_sync();
175 }
176
177
178 static inline void mask_and_ack_fall_edge_irq(unsigned int irq_nr)
179 {
180         unsigned int bit = irq_nr - AU1000_INTC0_INT_BASE;
181
182         if (bit >= 32) {
183                 au_writel(1 << (bit - 32), IC1_FALLINGCLR);
184                 au_writel(1 << (bit - 32), IC1_MASKCLR);
185         } else {
186                 au_writel(1 << bit, IC0_FALLINGCLR);
187                 au_writel(1 << bit, IC0_MASKCLR);
188         }
189         au_sync();
190 }
191
192
193 static inline void mask_and_ack_either_edge_irq(unsigned int irq_nr)
194 {
195         unsigned int bit = irq_nr - AU1000_INTC0_INT_BASE;
196
197         /*
198          * This may assume that we don't get interrupts from
199          * both edges at once, or if we do, that we don't care.
200          */
201         if (bit >= 32) {
202                 au_writel(1 << (bit - 32), IC1_FALLINGCLR);
203                 au_writel(1 << (bit - 32), IC1_RISINGCLR);
204                 au_writel(1 << (bit - 32), IC1_MASKCLR);
205         } else {
206                 au_writel(1 << bit, IC0_FALLINGCLR);
207                 au_writel(1 << bit, IC0_RISINGCLR);
208                 au_writel(1 << bit, IC0_MASKCLR);
209         }
210         au_sync();
211 }
212
213
214 static inline void mask_and_ack_level_irq(unsigned int irq_nr)
215 {
216
217         local_disable_irq(irq_nr);
218         au_sync();
219 #if defined(CONFIG_MIPS_PB1000)
220         if (irq_nr == AU1000_GPIO_15) {
221                 au_writel(0x8000, PB1000_MDR); /* ack int */
222                 au_sync();
223         }
224 #endif
225 }
226
227 static void end_irq(unsigned int irq_nr)
228 {
229         if (!(irq_desc[irq_nr].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
230                 local_enable_irq(irq_nr);
231
232 #if defined(CONFIG_MIPS_PB1000)
233         if (irq_nr == AU1000_GPIO_15) {
234                 au_writel(0x4000, PB1000_MDR); /* enable int */
235                 au_sync();
236         }
237 #endif
238 }
239
240 unsigned long save_local_and_disable(int controller)
241 {
242         int i;
243         unsigned long flags, mask;
244
245         spin_lock_irqsave(&irq_lock, flags);
246         if (controller) {
247                 mask = au_readl(IC1_MASKSET);
248                 for (i = 32; i < 64; i++)
249                         local_disable_irq(i);
250         } else {
251                 mask = au_readl(IC0_MASKSET);
252                 for (i = 0; i < 32; i++)
253                         local_disable_irq(i);
254         }
255         spin_unlock_irqrestore(&irq_lock, flags);
256
257         return mask;
258 }
259
260 void restore_local_and_enable(int controller, unsigned long mask)
261 {
262         int i;
263         unsigned long flags, new_mask;
264
265         spin_lock_irqsave(&irq_lock, flags);
266         for (i = 0; i < 32; i++) {
267                 if (mask & (1 << i)) {
268                         if (controller)
269                                 local_enable_irq(i + 32);
270                         else
271                                 local_enable_irq(i);
272                 }
273         }
274         if (controller)
275                 new_mask = au_readl(IC1_MASKSET);
276         else
277                 new_mask = au_readl(IC0_MASKSET);
278
279         spin_unlock_irqrestore(&irq_lock, flags);
280 }
281
282
283 static struct irq_chip rise_edge_irq_type = {
284         .name           = "Au1000 Rise Edge",
285         .ack            = mask_and_ack_rise_edge_irq,
286         .mask           = local_disable_irq,
287         .mask_ack       = mask_and_ack_rise_edge_irq,
288         .unmask         = local_enable_irq,
289         .end            = end_irq,
290 };
291
292 static struct irq_chip fall_edge_irq_type = {
293         .name           = "Au1000 Fall Edge",
294         .ack            = mask_and_ack_fall_edge_irq,
295         .mask           = local_disable_irq,
296         .mask_ack       = mask_and_ack_fall_edge_irq,
297         .unmask         = local_enable_irq,
298         .end            = end_irq,
299 };
300
301 static struct irq_chip either_edge_irq_type = {
302         .name           = "Au1000 Rise or Fall Edge",
303         .ack            = mask_and_ack_either_edge_irq,
304         .mask           = local_disable_irq,
305         .mask_ack       = mask_and_ack_either_edge_irq,
306         .unmask         = local_enable_irq,
307         .end            = end_irq,
308 };
309
310 static struct irq_chip level_irq_type = {
311         .name           = "Au1000 Level",
312         .ack            = mask_and_ack_level_irq,
313         .mask           = local_disable_irq,
314         .mask_ack       = mask_and_ack_level_irq,
315         .unmask         = local_enable_irq,
316         .end            = end_irq,
317 };
318
319 static void __init setup_local_irq(unsigned int irq_nr, int type, int int_req)
320 {
321         unsigned int bit = irq_nr - AU1000_INTC0_INT_BASE;
322
323         if (irq_nr > AU1000_MAX_INTR)
324                 return;
325
326         /* Config2[n], Config1[n], Config0[n] */
327         if (bit >= 32) {
328                 switch (type) {
329                 case INTC_INT_RISE_EDGE: /* 0:0:1 */
330                         au_writel(1 << (bit - 32), IC1_CFG2CLR);
331                         au_writel(1 << (bit - 32), IC1_CFG1CLR);
332                         au_writel(1 << (bit - 32), IC1_CFG0SET);
333                         set_irq_chip(irq_nr, &rise_edge_irq_type);
334                         break;
335                 case INTC_INT_FALL_EDGE: /* 0:1:0 */
336                         au_writel(1 << (bit - 32), IC1_CFG2CLR);
337                         au_writel(1 << (bit - 32), IC1_CFG1SET);
338                         au_writel(1 << (bit - 32), IC1_CFG0CLR);
339                         set_irq_chip(irq_nr, &fall_edge_irq_type);
340                         break;
341                 case INTC_INT_RISE_AND_FALL_EDGE: /* 0:1:1 */
342                         au_writel(1 << (bit - 32), IC1_CFG2CLR);
343                         au_writel(1 << (bit - 32), IC1_CFG1SET);
344                         au_writel(1 << (bit - 32), IC1_CFG0SET);
345                         set_irq_chip(irq_nr, &either_edge_irq_type);
346                         break;
347                 case INTC_INT_HIGH_LEVEL: /* 1:0:1 */
348                         au_writel(1 << (bit - 32), IC1_CFG2SET);
349                         au_writel(1 << (bit - 32), IC1_CFG1CLR);
350                         au_writel(1 << (bit - 32), IC1_CFG0SET);
351                         set_irq_chip(irq_nr, &level_irq_type);
352                         break;
353                 case INTC_INT_LOW_LEVEL: /* 1:1:0 */
354                         au_writel(1 << (bit - 32), IC1_CFG2SET);
355                         au_writel(1 << (bit - 32), IC1_CFG1SET);
356                         au_writel(1 << (bit - 32), IC1_CFG0CLR);
357                         set_irq_chip(irq_nr, &level_irq_type);
358                         break;
359                 case INTC_INT_DISABLED: /* 0:0:0 */
360                         au_writel(1 << (bit - 32), IC1_CFG0CLR);
361                         au_writel(1 << (bit - 32), IC1_CFG1CLR);
362                         au_writel(1 << (bit - 32), IC1_CFG2CLR);
363                         break;
364                 default: /* disable the interrupt */
365                         printk(KERN_WARNING "unexpected int type %d (irq %d)\n",
366                                type, irq_nr);
367                         au_writel(1 << (bit - 32), IC1_CFG0CLR);
368                         au_writel(1 << (bit - 32), IC1_CFG1CLR);
369                         au_writel(1 << (bit - 32), IC1_CFG2CLR);
370                         return;
371                 }
372                 if (int_req) /* assign to interrupt request 1 */
373                         au_writel(1 << (bit - 32), IC1_ASSIGNCLR);
374                 else         /* assign to interrupt request 0 */
375                         au_writel(1 << (bit - 32), IC1_ASSIGNSET);
376                 au_writel(1 << (bit - 32), IC1_SRCSET);
377                 au_writel(1 << (bit - 32), IC1_MASKCLR);
378                 au_writel(1 << (bit - 32), IC1_WAKECLR);
379         } else {
380                 switch (type) {
381                 case INTC_INT_RISE_EDGE: /* 0:0:1 */
382                         au_writel(1 << bit, IC0_CFG2CLR);
383                         au_writel(1 << bit, IC0_CFG1CLR);
384                         au_writel(1 << bit, IC0_CFG0SET);
385                         set_irq_chip(irq_nr, &rise_edge_irq_type);
386                         break;
387                 case INTC_INT_FALL_EDGE: /* 0:1:0 */
388                         au_writel(1 << bit, IC0_CFG2CLR);
389                         au_writel(1 << bit, IC0_CFG1SET);
390                         au_writel(1 << bit, IC0_CFG0CLR);
391                         set_irq_chip(irq_nr, &fall_edge_irq_type);
392                         break;
393                 case INTC_INT_RISE_AND_FALL_EDGE: /* 0:1:1 */
394                         au_writel(1 << bit, IC0_CFG2CLR);
395                         au_writel(1 << bit, IC0_CFG1SET);
396                         au_writel(1 << bit, IC0_CFG0SET);
397                         set_irq_chip(irq_nr, &either_edge_irq_type);
398                         break;
399                 case INTC_INT_HIGH_LEVEL: /* 1:0:1 */
400                         au_writel(1 << bit, IC0_CFG2SET);
401                         au_writel(1 << bit, IC0_CFG1CLR);
402                         au_writel(1 << bit, IC0_CFG0SET);
403                         set_irq_chip(irq_nr, &level_irq_type);
404                         break;
405                 case INTC_INT_LOW_LEVEL: /* 1:1:0 */
406                         au_writel(1 << bit, IC0_CFG2SET);
407                         au_writel(1 << bit, IC0_CFG1SET);
408                         au_writel(1 << bit, IC0_CFG0CLR);
409                         set_irq_chip(irq_nr, &level_irq_type);
410                         break;
411                 case INTC_INT_DISABLED: /* 0:0:0 */
412                         au_writel(1 << bit, IC0_CFG0CLR);
413                         au_writel(1 << bit, IC0_CFG1CLR);
414                         au_writel(1 << bit, IC0_CFG2CLR);
415                         break;
416                 default: /* disable the interrupt */
417                         printk(KERN_WARNING "unexpected int type %d (irq %d)\n",
418                                type, irq_nr);
419                         au_writel(1 << bit, IC0_CFG0CLR);
420                         au_writel(1 << bit, IC0_CFG1CLR);
421                         au_writel(1 << bit, IC0_CFG2CLR);
422                         return;
423                 }
424                 if (int_req) /* assign to interrupt request 1 */
425                         au_writel(1 << bit, IC0_ASSIGNCLR);
426                 else         /* assign to interrupt request 0 */
427                         au_writel(1 << bit, IC0_ASSIGNSET);
428                 au_writel(1 << bit, IC0_SRCSET);
429                 au_writel(1 << bit, IC0_MASKCLR);
430                 au_writel(1 << bit, IC0_WAKECLR);
431         }
432         au_sync();
433 }
434
435 /*
436  * Interrupts are nested. Even if an interrupt handler is registered
437  * as "fast", we might get another interrupt before we return from
438  * intcX_reqX_irqdispatch().
439  */
440
441 static void intc0_req0_irqdispatch(void)
442 {
443         static unsigned long intc0_req0;
444         unsigned int bit;
445
446         intc0_req0 |= au_readl(IC0_REQ0INT);
447
448         if (!intc0_req0)
449                 return;
450
451 #ifdef AU1000_USB_DEV_REQ_INT
452         /*
453          * Because of the tight timing of SETUP token to reply
454          * transactions, the USB devices-side packet complete
455          * interrupt needs the highest priority.
456          */
457         if ((intc0_req0 & (1 << AU1000_USB_DEV_REQ_INT))) {
458                 intc0_req0 &= ~(1 << AU1000_USB_DEV_REQ_INT);
459                 do_IRQ(AU1000_USB_DEV_REQ_INT);
460                 return;
461         }
462 #endif
463         bit = __ffs(intc0_req0);
464         intc0_req0 &= ~(1 << bit);
465         do_IRQ(AU1000_INTC0_INT_BASE + bit);
466 }
467
468
469 static void intc0_req1_irqdispatch(void)
470 {
471         static unsigned long intc0_req1;
472         unsigned int bit;
473
474         intc0_req1 |= au_readl(IC0_REQ1INT);
475
476         if (!intc0_req1)
477                 return;
478
479         bit = __ffs(intc0_req1);
480         intc0_req1 &= ~(1 << bit);
481         do_IRQ(AU1000_INTC0_INT_BASE + bit);
482 }
483
484
485 /*
486  * Interrupt Controller 1:
487  * interrupts 32 - 63
488  */
489 static void intc1_req0_irqdispatch(void)
490 {
491         static unsigned long intc1_req0;
492         unsigned int bit;
493
494         intc1_req0 |= au_readl(IC1_REQ0INT);
495
496         if (!intc1_req0)
497                 return;
498
499         bit = __ffs(intc1_req0);
500         intc1_req0 &= ~(1 << bit);
501         do_IRQ(AU1000_INTC1_INT_BASE + bit);
502 }
503
504
505 static void intc1_req1_irqdispatch(void)
506 {
507         static unsigned long intc1_req1;
508         unsigned int bit;
509
510         intc1_req1 |= au_readl(IC1_REQ1INT);
511
512         if (!intc1_req1)
513                 return;
514
515         bit = __ffs(intc1_req1);
516         intc1_req1 &= ~(1 << bit);
517         do_IRQ(AU1000_INTC1_INT_BASE + bit);
518 }
519
520 asmlinkage void plat_irq_dispatch(void)
521 {
522         unsigned int pending = read_c0_status() & read_c0_cause();
523
524         if (pending & CAUSEF_IP7)
525                 do_IRQ(MIPS_CPU_IRQ_BASE + 7);
526         else if (pending & CAUSEF_IP2)
527                 intc0_req0_irqdispatch();
528         else if (pending & CAUSEF_IP3)
529                 intc0_req1_irqdispatch();
530         else if (pending & CAUSEF_IP4)
531                 intc1_req0_irqdispatch();
532         else if (pending  & CAUSEF_IP5)
533                 intc1_req1_irqdispatch();
534         else
535                 spurious_interrupt();
536 }
537
538 void __init arch_init_irq(void)
539 {
540         int i;
541         struct au1xxx_irqmap *imp;
542         extern struct au1xxx_irqmap au1xxx_irq_map[];
543         extern struct au1xxx_irqmap au1xxx_ic0_map[];
544         extern int au1xxx_nr_irqs;
545         extern int au1xxx_ic0_nr_irqs;
546
547         /*
548          * Initialize interrupt controllers to a safe state.
549          */
550         au_writel(0xffffffff, IC0_CFG0CLR);
551         au_writel(0xffffffff, IC0_CFG1CLR);
552         au_writel(0xffffffff, IC0_CFG2CLR);
553         au_writel(0xffffffff, IC0_MASKCLR);
554         au_writel(0xffffffff, IC0_ASSIGNSET);
555         au_writel(0xffffffff, IC0_WAKECLR);
556         au_writel(0xffffffff, IC0_SRCSET);
557         au_writel(0xffffffff, IC0_FALLINGCLR);
558         au_writel(0xffffffff, IC0_RISINGCLR);
559         au_writel(0x00000000, IC0_TESTBIT);
560
561         au_writel(0xffffffff, IC1_CFG0CLR);
562         au_writel(0xffffffff, IC1_CFG1CLR);
563         au_writel(0xffffffff, IC1_CFG2CLR);
564         au_writel(0xffffffff, IC1_MASKCLR);
565         au_writel(0xffffffff, IC1_ASSIGNSET);
566         au_writel(0xffffffff, IC1_WAKECLR);
567         au_writel(0xffffffff, IC1_SRCSET);
568         au_writel(0xffffffff, IC1_FALLINGCLR);
569         au_writel(0xffffffff, IC1_RISINGCLR);
570         au_writel(0x00000000, IC1_TESTBIT);
571
572         mips_cpu_irq_init();
573
574         /*
575          * Initialize IC0, which is fixed per processor.
576          */
577         imp = au1xxx_ic0_map;
578         for (i = 0; i < au1xxx_ic0_nr_irqs; i++) {
579                 setup_local_irq(imp->im_irq, imp->im_type, imp->im_request);
580                 imp++;
581         }
582
583         /*
584          * Now set up the irq mapping for the board.
585          */
586         imp = au1xxx_irq_map;
587         for (i = 0; i < au1xxx_nr_irqs; i++) {
588                 setup_local_irq(imp->im_irq, imp->im_type, imp->im_request);
589                 imp++;
590         }
591
592         set_c0_status(IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4);
593
594         /* Board specific IRQ initialization.
595         */
596         if (board_init_irq)
597                 board_init_irq();
598 }