aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/vr41xx/nec-cmbvr4133/irq.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/mips/vr41xx/nec-cmbvr4133/irq.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/mips/vr41xx/nec-cmbvr4133/irq.c')
-rw-r--r--arch/mips/vr41xx/nec-cmbvr4133/irq.c114
1 files changed, 114 insertions, 0 deletions
diff --git a/arch/mips/vr41xx/nec-cmbvr4133/irq.c b/arch/mips/vr41xx/nec-cmbvr4133/irq.c
new file mode 100644
index 000000000000..31db6b61a39e
--- /dev/null
+++ b/arch/mips/vr41xx/nec-cmbvr4133/irq.c
@@ -0,0 +1,114 @@
1/*
2 * arch/mips/vr41xx/nec-cmbvr4133/irq.c
3 *
4 * Interrupt routines for the NEC CMB-VR4133 board.
5 *
6 * Author: Yoichi Yuasa <yyuasa@mvista.com, or source@mvista.com> and
7 * Alex Sapkov <asapkov@ru.mvista.com>
8 *
9 * 2003-2004 (c) MontaVista, Software, Inc. This file is licensed under
10 * the terms of the GNU General Public License version 2. This program
11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 *
14 * Support for NEC-CMBVR4133 in 2.6
15 * Manish Lachwani (mlachwani@mvista.com)
16 */
17#include <linux/bitops.h>
18#include <linux/errno.h>
19#include <linux/init.h>
20#include <linux/ioport.h>
21#include <linux/interrupt.h>
22
23#include <asm/io.h>
24#include <asm/vr41xx/cmbvr4133.h>
25
26extern void enable_8259A_irq(unsigned int irq);
27extern void disable_8259A_irq(unsigned int irq);
28extern void mask_and_ack_8259A(unsigned int irq);
29extern void init_8259A(int hoge);
30
31extern int vr4133_rockhopper;
32
33static unsigned int startup_i8259_irq(unsigned int irq)
34{
35 enable_8259A_irq(irq - I8259_IRQ_BASE);
36 return 0;
37}
38
39static void shutdown_i8259_irq(unsigned int irq)
40{
41 disable_8259A_irq(irq - I8259_IRQ_BASE);
42}
43
44static void enable_i8259_irq(unsigned int irq)
45{
46 enable_8259A_irq(irq - I8259_IRQ_BASE);
47}
48
49static void disable_i8259_irq(unsigned int irq)
50{
51 disable_8259A_irq(irq - I8259_IRQ_BASE);
52}
53
54static void ack_i8259_irq(unsigned int irq)
55{
56 mask_and_ack_8259A(irq - I8259_IRQ_BASE);
57}
58
59static void end_i8259_irq(unsigned int irq)
60{
61 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
62 enable_8259A_irq(irq - I8259_IRQ_BASE);
63}
64
65static struct hw_interrupt_type i8259_irq_type = {
66 .typename = "XT-PIC",
67 .startup = startup_i8259_irq,
68 .shutdown = shutdown_i8259_irq,
69 .enable = enable_i8259_irq,
70 .disable = disable_i8259_irq,
71 .ack = ack_i8259_irq,
72 .end = end_i8259_irq,
73};
74
75static int i8259_get_irq_number(int irq)
76{
77 unsigned long isr;
78
79 isr = inb(0x20);
80 irq = ffz(~isr);
81 if (irq == 2) {
82 isr = inb(0xa0);
83 irq = 8 + ffz(~isr);
84 }
85
86 if (irq < 0 || irq > 15)
87 return -EINVAL;
88
89 return I8259_IRQ_BASE + irq;
90}
91
92static struct irqaction i8259_slave_cascade = {
93 .handler = &no_action,
94 .name = "cascade",
95};
96
97void __init rockhopper_init_irq(void)
98{
99 int i;
100
101 if(!vr4133_rockhopper) {
102 printk(KERN_ERR "Not a Rockhopper Board \n");
103 return;
104 }
105
106 for (i = I8259_IRQ_BASE; i <= I8259_IRQ_LAST; i++)
107 irq_desc[i].handler = &i8259_irq_type;
108
109 setup_irq(I8259_SLAVE_IRQ, &i8259_slave_cascade);
110
111 vr41xx_set_irq_trigger(CMBVR41XX_INTC_PIN, TRIGGER_LEVEL, SIGNAL_THROUGH);
112 vr41xx_set_irq_level(CMBVR41XX_INTC_PIN, LEVEL_HIGH);
113 vr41xx_cascade_irq(CMBVR41XX_INTC_IRQ, i8259_get_irq_number);
114}