x86, AMD IOMMU: replace DEVID macro with a function
[sfrench/cifs-2.6.git] / arch / mips / tx4938 / common / irq.c
1 /*
2  * linux/arch/mips/tx4938/common/irq.c
3  *
4  * Common tx4938 irq handler
5  * Copyright (C) 2000-2001 Toshiba Corporation
6  *
7  * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the
8  * terms of the GNU General Public License version 2. This program is
9  * licensed "as is" without any warranty of any kind, whether express
10  * or implied.
11  *
12  * Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com)
13  */
14 #include <linux/init.h>
15 #include <linux/interrupt.h>
16 #include <asm/irq_cpu.h>
17 #include <asm/mipsregs.h>
18 #include <asm/tx4938/rbtx4938.h>
19
20 void __init
21 tx4938_irq_init(void)
22 {
23         mips_cpu_irq_init();
24         txx9_irq_init(TX4938_IRC_REG);
25         set_irq_chained_handler(TX4938_IRQ_NEST_PIC_ON_CP0, handle_simple_irq);
26 }
27
28 int toshiba_rbtx4938_irq_nested(int irq);
29
30 asmlinkage void plat_irq_dispatch(void)
31 {
32         unsigned int pending = read_c0_cause() & read_c0_status();
33
34         if (pending & STATUSF_IP7)
35                 do_IRQ(TX4938_IRQ_CPU_TIMER);
36         else if (pending & STATUSF_IP2) {
37                 int irq = txx9_irq();
38                 if (irq == TX4938_IRQ_PIC_BEG + TX4938_IR_INT(0))
39                         irq = toshiba_rbtx4938_irq_nested(irq);
40                 if (irq >= 0)
41                         do_IRQ(irq);
42                 else
43                         spurious_interrupt();
44         } else if (pending & STATUSF_IP1)
45                 do_IRQ(TX4938_IRQ_USER1);
46         else if (pending & STATUSF_IP0)
47                 do_IRQ(TX4938_IRQ_USER0);
48 }