update atheros 2.6 port - add support for the older chip generation
[openwrt/svn-archive/archive.git] / target / linux / atheros-2.6 / files / arch / mips / atheros / irq.c
1 /*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003 Atheros Communications, Inc., All Rights Reserved.
7 * Copyright (C) 2006 FON Technology, SL.
8 * Copyright (C) 2006 Imre Kaloz <kaloz@openwrt.org>
9 * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
10 */
11
12 /*
13 * Interrupt support for AR531X WiSOC.
14 */
15
16 #include <linux/autoconf.h>
17 #include <linux/init.h>
18 #include <linux/kernel_stat.h>
19 #include <linux/signal.h>
20 #include <linux/sched.h>
21 #include <linux/interrupt.h>
22 #include <linux/slab.h>
23 #include <linux/random.h>
24 #include <linux/pm.h>
25 #include <linux/delay.h>
26 #include <linux/reboot.h>
27 #include <linux/irq.h>
28 #include <asm/bootinfo.h>
29 #include <asm/mipsregs.h>
30 #include <asm/irq_cpu.h>
31 #include "ar531x.h"
32
33
34 /* ARGSUSED */
35 irqreturn_t
36 spurious_irq_handler(int cpl, void *dev_id)
37 {
38 /*
39 printk("spurious_irq_handler: %d cause=0x%8.8x status=0x%8.8x\n",
40 cpl, cause_intrs, status_intrs);
41 */
42 return IRQ_NONE;
43 }
44
45 /* ARGSUSED */
46 irqreturn_t
47 spurious_misc_handler(int cpl, void *dev_id)
48 {
49 /*
50 printk("spurious_misc_handler: 0x%x isr=0x%8.8x imr=0x%8.8x\n",
51 cpl, ar531x_isr, ar531x_imr);
52 */
53 return IRQ_NONE;
54 }
55
56 static struct irqaction spurious_irq = {
57 .handler = spurious_irq_handler,
58 .flags = SA_INTERRUPT,
59 .name = "spurious_irq",
60 };
61
62 static struct irqaction spurious_misc = {
63 .handler = spurious_misc_handler,
64 .flags = SA_INTERRUPT,
65 .name = "spurious_misc",
66 };
67
68 asmlinkage void plat_irq_dispatch(void)
69 {
70 #ifdef CONFIG_ATHEROS_AR5312
71 if (mips_machtype == MACH_ATHEROS_AR5312)
72 ar5312_irq_dispatch();
73 #endif
74 #ifdef CONFIG_ATHEROS_AR5315
75 if (mips_machtype == MACH_ATHEROS_AR5315)
76 ar5315_irq_dispatch();
77 #endif
78 }
79
80 void __init arch_init_irq(void)
81 {
82 clear_c0_status(ST0_IM);
83 mips_cpu_irq_init(0);
84
85 /* Initialize interrupt controllers */
86 #ifdef CONFIG_ATHEROS_AR5312
87 if (mips_machtype == MACH_ATHEROS_AR5312)
88 ar5312_misc_intr_init(AR531X_MISC_IRQ_BASE);
89 #endif
90 #ifdef CONFIG_ATHEROS_AR5315
91 if (mips_machtype == MACH_ATHEROS_AR5315)
92 ar5315_misc_intr_init(AR531X_MISC_IRQ_BASE);
93 #endif
94
95 /* Default "spurious interrupt" handlers */
96 setup_irq(AR531X_IRQ_NONE, &spurious_irq);
97 setup_irq(AR531X_MISC_IRQ_NONE, &spurious_misc);
98 }