2 * Ralink RT288x SoC specific interrupt handling
4 * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published
9 * by the Free Software Foundation.
12 #include <linux/kernel.h>
13 #include <linux/init.h>
14 #include <linux/interrupt.h>
15 #include <linux/irq.h>
17 #include <asm/irq_cpu.h>
18 #include <asm/mipsregs.h>
20 #include <asm/mach-ralink/common.h>
21 #include <asm/mach-ralink/rt288x.h>
22 #include <asm/mach-ralink/rt288x_regs.h>
24 static void rt288x_intc_irq_dispatch(void)
28 pending = ramips_intc_get_status();
30 if (pending & RT2880_INTC_INT_TIMER0)
31 do_IRQ(RT2880_INTC_IRQ_TIMER0);
33 else if (pending & RT2880_INTC_INT_TIMER1)
34 do_IRQ(RT2880_INTC_IRQ_TIMER1);
36 else if (pending & RT2880_INTC_INT_UART0)
37 do_IRQ(RT2880_INTC_IRQ_UART0);
39 else if (pending & RT2880_INTC_INT_PCM)
40 do_IRQ(RT2880_INTC_IRQ_PCM);
42 else if (pending & RT2880_INTC_INT_UART1)
43 do_IRQ(RT2880_INTC_IRQ_UART1);
45 /* TODO: handle PIO interrupts as well */
51 asmlinkage void plat_irq_dispatch(void)
53 unsigned long pending;
55 pending = read_c0_status() & read_c0_cause() & ST0_IM;
57 if (pending & STATUSF_IP7)
58 do_IRQ(RT288X_CPU_IRQ_COUNTER);
60 else if (pending & STATUSF_IP4)
61 do_IRQ(RT288X_CPU_IRQ_PCI);
63 else if (pending & STATUSF_IP5)
64 do_IRQ(RT288X_CPU_IRQ_FE);
66 else if (pending & STATUSF_IP6)
67 do_IRQ(RT288X_CPU_IRQ_WNIC);
69 else if (pending & STATUSF_IP2)
70 rt288x_intc_irq_dispatch();
76 void __init arch_init_irq(void)
79 ramips_intc_irq_init(RT2880_INTC_BASE, RT288X_CPU_IRQ_INTC,
80 RT288X_INTC_IRQ_BASE);