2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 2002 MIPS Technologies, Inc. All rights reserved.
4 * Copyright (C) 2003 Ralf Baechle (ralf@linux-mips.org)
5 * Copyright (C) 2004 Maciej W. Rozycki
7 * This program is free software; you can distribute it and/or modify it
8 * under the terms of the GNU General Public License (Version 2) as
9 * published by the Free Software Foundation.
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
20 * Routines for generic manipulation of the interrupts found on the MIPS
23 #include <linux/init.h>
24 #include <linux/interrupt.h>
26 #include <asm/irq_cpu.h>
27 #include <asm/mipsregs.h>
28 #include <asm/system.h>
30 #include <asm/mips-boards/seadint.h>
32 static inline int clz(unsigned long x)
46 * Version of ffs that only looks at bits 12..15.
48 static inline unsigned int irq_ffs(unsigned int pending)
50 #if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
51 return -clz(pending) + 31 - CAUSEB_IP;
79 * IRQs on the SEAD board look basically are combined together on hardware
80 * interrupt 0 (MIPS IRQ 2)) like:
84 * 0 Software (ignored)
85 * 1 Software (ignored)
88 * 4 Hardware (ignored)
89 * 5 Hardware (ignored)
90 * 6 Hardware (ignored)
91 * 7 R4k timer (what we use)
93 * We handle the IRQ according to _our_ priority which is:
95 * Highest ---- R4k Timer
96 * Lowest ---- Combined hardware interrupt
98 * then we just return, if multiple IRQs are pending then we will just take
99 * another exception, big deal.
101 asmlinkage void plat_irq_dispatch(void)
103 unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM;
106 irq = irq_ffs(pending);
109 do_IRQ(MIPSCPU_INT_BASE + irq);
111 spurious_interrupt();
114 void __init arch_init_irq(void)
116 mips_cpu_irq_init(MIPSCPU_INT_BASE);