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.
15 #include <linux/config.h>
16 #include <linux/init.h>
17 #include <linux/kernel.h>
18 #include <linux/types.h>
19 #include <linux/interrupt.h>
20 #include <linux/irq.h>
23 #include <asm/mipsregs.h>
24 #include <asm/gdb-stub.h>
26 #define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5)
28 extern asmlinkage void brcmIRQ(void);
29 extern asmlinkage unsigned int do_IRQ(int irq, struct pt_regs *regs);
32 brcm_irq_dispatch(struct pt_regs *regs)
36 cause = read_c0_cause() &
40 #ifdef CONFIG_KERNPROF
41 change_c0_status(cause | 1, 1);
43 clear_c0_status(cause);
46 if (cause & CAUSEF_IP7)
48 if (cause & CAUSEF_IP2)
50 if (cause & CAUSEF_IP3)
52 if (cause & CAUSEF_IP4)
54 if (cause & CAUSEF_IP5)
56 if (cause & CAUSEF_IP6)
61 enable_brcm_irq(unsigned int irq)
64 set_c0_status(1 << (irq + 8));
66 set_c0_status(IE_IRQ0);
70 disable_brcm_irq(unsigned int irq)
73 clear_c0_status(1 << (irq + 8));
75 clear_c0_status(IE_IRQ0);
79 ack_brcm_irq(unsigned int irq)
81 /* Already done in brcm_irq_dispatch */
85 startup_brcm_irq(unsigned int irq)
89 return 0; /* never anything pending */
93 end_brcm_irq(unsigned int irq)
95 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
99 static struct hw_interrupt_type brcm_irq_type = {
101 startup: startup_brcm_irq,
102 shutdown: disable_brcm_irq,
103 enable: enable_brcm_irq,
104 disable: disable_brcm_irq,
115 for (i = 0; i < NR_IRQS; i++) {
116 irq_desc[i].status = IRQ_DISABLED;
117 irq_desc[i].action = 0;
118 irq_desc[i].depth = 1;
119 irq_desc[i].handler = &brcm_irq_type;
122 set_except_vector(0, brcmIRQ);
123 change_c0_status(ST0_IM, ALLINTS);
125 #ifdef CONFIG_REMOTE_DEBUG
126 printk("Breaking into debugger...\n");