2 * arch/mips/vr4181/common/int_handler.S
4 * Adapted to the VR4181 and almost entirely rewritten:
5 * Copyright (C) 1999 Bradley D. LaRonde and Michael Klar
7 * Clean up to conform to the new IRQ
8 * Copyright (C) 2001 MontaVista Software Inc.
9 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file "COPYING" in the main directory of this archive
18 #include <asm/regdef.h>
19 #include <asm/mipsregs.h>
20 #include <asm/stackframe.h>
22 #include <asm/vr4181/vr4181.h>
26 * See include/asm/vr4181/irq.h for IRQ assignment and strategy.
33 NESTED(vr4181_handle_irq, PT_SIZE, ra)
47 /* we check IP3 first; it happens most frequently */
48 andi t1, t0, STATUSF_IP3
50 andi t1, t0, STATUSF_IP2
52 andi t1, t0, STATUSF_IP7 /* cpu timer */
53 bnez t1, ll_cputimer_irq
54 andi t1, t0, STATUSF_IP4
56 andi t1, t0, STATUSF_IP5
58 andi t1, t0, STATUSF_IP6
60 andi t1, t0, STATUSF_IP0 /* software int 0 */
62 andi t1, t0, STATUSF_IP1 /* software int 1 */
74 li a0, VR4181_IRQ_TIMER
93 li a0, VR4181_IRQ_INT1
99 li a0, VR4181_IRQ_INT2
105 li a0, VR4181_IRQ_INT3
111 li a0, VR4181_IRQ_INT4
117 * One of the sys irq has happend.
119 * In the interest of speed, we first determine in the following order
120 * which 16-irq block have pending interrupts:
121 * sysint1 (16 sources, including cascading intrs from GPIO)
123 * gpio (16 intr sources)
125 * Then we do binary search to find the exact interrupt source.
129 lui t3,%hi(VR4181_SYSINT1REG)
130 lhu t0,%lo(VR4181_SYSINT1REG)(t3)
131 lhu t2,%lo(VR4181_MSYSINT1REG)(t3)
132 and t0, 0xfffb /* hack - remove RTC Long 1 intr */
134 beqz t0, check_sysint2
136 /* check for GPIO interrupts */
138 bnez t1, check_gpio_int
140 /* so we have an interrupt in sysint1 which is not gpio int */
141 li a0, VR4181_SYS_IRQ_BASE - 1
146 lhu t0,%lo(VR4181_SYSINT2REG)(t3)
147 lhu t2,%lo(VR4181_MSYSINT2REG)(t3)
148 and t0, 0xfffe /* hack - remove RTC Long 2 intr */
150 li a0, VR4181_SYS_IRQ_BASE + 16 - 1
154 lui t3,%hi(VR4181_GPINTMSK)
155 lhu t0,%lo(VR4181_GPINTMSK)(t3)
156 lhu t2,%lo(VR4181_GPINTSTAT)(t3)
157 xori t0, 0xffff /* why? reverse logic? */
159 li a0, VR4181_GPIO_IRQ_BASE - 1
163 * When we reach check_16, we have 16-bit status in t0 and base irq number
175 * When we reach check_8, we have 8-bit status in t0 and base irq number
187 * When we reach check_4, we have 4-bit status in t0 and base irq number
206 END(vr4181_handle_irq)