2 * Generic interrupt control functions for Broadcom MIPS boards
4 * Copyright 2004, Broadcom Corporation
7 * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
8 * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
9 * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
10 * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
14 #include <linux/config.h>
15 #include <linux/init.h>
16 #include <linux/kernel.h>
17 #include <linux/types.h>
18 #include <linux/interrupt.h>
19 #include <linux/irq.h>
22 #include <asm/mipsregs.h>
23 #include <asm/gdb-stub.h>
25 #define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5)
27 extern asmlinkage
void brcmIRQ(void);
28 extern asmlinkage
unsigned int do_IRQ(int irq
, struct pt_regs
*regs
);
31 brcm_irq_dispatch(struct pt_regs
*regs
)
35 cause
= read_c0_cause() &
39 #ifdef CONFIG_KERNPROF
40 change_c0_status(cause
| 1, 1);
42 clear_c0_status(cause
);
45 if (cause
& CAUSEF_IP7
)
47 if (cause
& CAUSEF_IP2
)
49 if (cause
& CAUSEF_IP3
)
51 if (cause
& CAUSEF_IP4
)
53 if (cause
& CAUSEF_IP5
)
55 if (cause
& CAUSEF_IP6
)
60 enable_brcm_irq(unsigned int irq
)
63 set_c0_status(1 << (irq
+ 8));
65 set_c0_status(IE_IRQ0
);
69 disable_brcm_irq(unsigned int irq
)
72 clear_c0_status(1 << (irq
+ 8));
74 clear_c0_status(IE_IRQ0
);
78 ack_brcm_irq(unsigned int irq
)
80 /* Already done in brcm_irq_dispatch */
84 startup_brcm_irq(unsigned int irq
)
88 return 0; /* never anything pending */
92 end_brcm_irq(unsigned int irq
)
94 if (!(irq_desc
[irq
].status
& (IRQ_DISABLED
|IRQ_INPROGRESS
)))
98 static struct hw_interrupt_type brcm_irq_type
= {
100 startup
: startup_brcm_irq
,
101 shutdown
: disable_brcm_irq
,
102 enable
: enable_brcm_irq
,
103 disable
: disable_brcm_irq
,
114 for (i
= 0; i
< NR_IRQS
; i
++) {
115 irq_desc
[i
].status
= IRQ_DISABLED
;
116 irq_desc
[i
].action
= 0;
117 irq_desc
[i
].depth
= 1;
118 irq_desc
[i
].handler
= &brcm_irq_type
;
121 set_except_vector(0, brcmIRQ
);
122 change_c0_status(ST0_IM
, ALLINTS
);
124 #ifdef CONFIG_REMOTE_DEBUG
125 printk("Breaking into debugger...\n");