2 * Generic interrupt control functions for Broadcom MIPS boards
4 * Copyright (C) 2012, Broadcom Corporation. All Rights Reserved.
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
13 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
15 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 * $Id: irq.c,v 1.1 2007-09-04 04:41:12 $
21 #include <linux/config.h>
22 #include <linux/init.h>
23 #include <linux/kernel.h>
24 #include <linux/types.h>
25 #include <linux/interrupt.h>
26 #include <linux/irq.h>
29 #include <asm/mipsregs.h>
30 #include <asm/gdb-stub.h>
32 #define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5)
34 extern asmlinkage
void brcmIRQ(void);
35 extern asmlinkage
unsigned int do_IRQ(int irq
, struct pt_regs
*regs
);
38 plat_irq_dispatch(struct pt_regs
*regs
)
42 cause
= read_c0_cause() &
46 #ifdef CONFIG_KERNPROF
47 change_c0_status(cause
| 1, 1);
49 clear_c0_status(cause
);
52 if (cause
& CAUSEF_IP7
)
54 if (cause
& CAUSEF_IP2
)
56 if (cause
& CAUSEF_IP3
)
58 if (cause
& CAUSEF_IP4
)
60 if (cause
& CAUSEF_IP5
)
62 if (cause
& CAUSEF_IP6
)
67 enable_brcm_irq(unsigned int irq
)
70 set_c0_status(1 << (irq
+ 8));
72 set_c0_status(IE_IRQ0
);
76 disable_brcm_irq(unsigned int irq
)
79 clear_c0_status(1 << (irq
+ 8));
81 clear_c0_status(IE_IRQ0
);
85 ack_brcm_irq(unsigned int irq
)
87 /* Already done in plat_irq_dispatch */
91 startup_brcm_irq(unsigned int irq
)
95 return 0; /* never anything pending */
99 end_brcm_irq(unsigned int irq
)
101 if (!(irq_desc
[irq
].status
& (IRQ_DISABLED
|IRQ_INPROGRESS
)))
102 enable_brcm_irq(irq
);
105 static struct hw_interrupt_type brcm_irq_type
= {
107 startup
: startup_brcm_irq
,
108 shutdown
: disable_brcm_irq
,
109 enable
: enable_brcm_irq
,
110 disable
: disable_brcm_irq
,
121 for (i
= 0; i
< NR_IRQS
; i
++) {
122 irq_desc
[i
].status
= IRQ_DISABLED
;
123 irq_desc
[i
].action
= 0;
124 irq_desc
[i
].depth
= 1;
125 irq_desc
[i
].handler
= &brcm_irq_type
;
128 change_c0_status(ST0_IM
, ALLINTS
);
131 printk("Breaking into debugger...\n");