[PATCH] w1_therm: support for ds18b20, ds1822 thermal sensors.
[linux-2.6/verdex.git] / arch / mips / vr41xx / nec-cmbvr4133 / irq.c
blob31db6b61a39e9627ad7c5da13e2e4de555880325
1 /*
2 * arch/mips/vr41xx/nec-cmbvr4133/irq.c
4 * Interrupt routines for the NEC CMB-VR4133 board.
6 * Author: Yoichi Yuasa <yyuasa@mvista.com, or source@mvista.com> and
7 * Alex Sapkov <asapkov@ru.mvista.com>
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.
14 * Support for NEC-CMBVR4133 in 2.6
15 * Manish Lachwani (mlachwani@mvista.com)
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>
23 #include <asm/io.h>
24 #include <asm/vr41xx/cmbvr4133.h>
26 extern void enable_8259A_irq(unsigned int irq);
27 extern void disable_8259A_irq(unsigned int irq);
28 extern void mask_and_ack_8259A(unsigned int irq);
29 extern void init_8259A(int hoge);
31 extern int vr4133_rockhopper;
33 static unsigned int startup_i8259_irq(unsigned int irq)
35 enable_8259A_irq(irq - I8259_IRQ_BASE);
36 return 0;
39 static void shutdown_i8259_irq(unsigned int irq)
41 disable_8259A_irq(irq - I8259_IRQ_BASE);
44 static void enable_i8259_irq(unsigned int irq)
46 enable_8259A_irq(irq - I8259_IRQ_BASE);
49 static void disable_i8259_irq(unsigned int irq)
51 disable_8259A_irq(irq - I8259_IRQ_BASE);
54 static void ack_i8259_irq(unsigned int irq)
56 mask_and_ack_8259A(irq - I8259_IRQ_BASE);
59 static void end_i8259_irq(unsigned int irq)
61 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
62 enable_8259A_irq(irq - I8259_IRQ_BASE);
65 static 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,
75 static int i8259_get_irq_number(int irq)
77 unsigned long isr;
79 isr = inb(0x20);
80 irq = ffz(~isr);
81 if (irq == 2) {
82 isr = inb(0xa0);
83 irq = 8 + ffz(~isr);
86 if (irq < 0 || irq > 15)
87 return -EINVAL;
89 return I8259_IRQ_BASE + irq;
92 static struct irqaction i8259_slave_cascade = {
93 .handler = &no_action,
94 .name = "cascade",
97 void __init rockhopper_init_irq(void)
99 int i;
101 if(!vr4133_rockhopper) {
102 printk(KERN_ERR "Not a Rockhopper Board \n");
103 return;
106 for (i = I8259_IRQ_BASE; i <= I8259_IRQ_LAST; i++)
107 irq_desc[i].handler = &i8259_irq_type;
109 setup_irq(I8259_SLAVE_IRQ, &i8259_slave_cascade);
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);