Committer: Michael Beasley <mike@snafu.setup>
[mikesnafu-overlay.git] / arch / mips / tx4927 / common / tx4927_irq.c
blob0aabd57fdad2575baf635ad3160b6ae17c9597e0
1 /*
2 * Common tx4927 irq handler
4 * Author: MontaVista Software, Inc.
5 * source@mvista.com
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
11 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
12 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
14 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
15 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
16 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
17 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
18 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
19 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
20 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 675 Mass Ave, Cambridge, MA 02139, USA.
26 #include <linux/init.h>
27 #include <linux/interrupt.h>
28 #include <asm/irq_cpu.h>
29 #include <asm/mipsregs.h>
30 #include <asm/tx4927/tx4927.h>
31 #ifdef CONFIG_TOSHIBA_RBTX4927
32 #include <asm/tx4927/toshiba_rbtx4927.h>
33 #endif
35 void __init tx4927_irq_init(void)
37 mips_cpu_irq_init();
38 txx9_irq_init(TX4927_IRC_REG);
39 set_irq_chained_handler(TX4927_IRQ_NEST_PIC_ON_CP0, handle_simple_irq);
42 asmlinkage void plat_irq_dispatch(void)
44 unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM;
46 if (pending & STATUSF_IP7) /* cpu timer */
47 do_IRQ(TX4927_IRQ_CPU_TIMER);
48 else if (pending & STATUSF_IP2) { /* tx4927 pic */
49 int irq = txx9_irq();
50 #ifdef CONFIG_TOSHIBA_RBTX4927
51 if (irq == TX4927_IRQ_NEST_EXT_ON_PIC)
52 irq = toshiba_rbtx4927_irq_nested(irq);
53 #endif
54 if (unlikely(irq < 0)) {
55 spurious_interrupt();
56 return;
58 do_IRQ(irq);
59 } else if (pending & STATUSF_IP0) /* user line 0 */
60 do_IRQ(TX4927_IRQ_USER0);
61 else if (pending & STATUSF_IP1) /* user line 1 */
62 do_IRQ(TX4927_IRQ_USER1);
63 else
64 spurious_interrupt();