blob: c059b899d1200220aa8b3e5a0682b7500bc30de4 [file] [log] [blame]
Ralf Baechle23fbee92005-07-25 22:45:45 +00001/*
Uwe Zeisbergerf30c2262006-10-03 23:01:26 +02002 * linux/arch/mips/tx4938/common/irq.c
Ralf Baechle23fbee92005-07-25 22:45:45 +00003 *
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 */
Ralf Baechle23fbee92005-07-25 22:45:45 +000014#include <linux/init.h>
Ralf Baechle23fbee92005-07-25 22:45:45 +000015#include <linux/interrupt.h>
Atsushi Nemotoc87abd72007-08-02 23:36:02 +090016#include <asm/irq_cpu.h>
Ralf Baechle23fbee92005-07-25 22:45:45 +000017#include <asm/mipsregs.h>
Ralf Baechle23fbee92005-07-25 22:45:45 +000018#include <asm/tx4938/rbtx4938.h>
19
Ralf Baechle23fbee92005-07-25 22:45:45 +000020void __init
21tx4938_irq_init(void)
22{
Atsushi Nemotoc87abd72007-08-02 23:36:02 +090023 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);
Ralf Baechle23fbee92005-07-25 22:45:45 +000026}
27
Atsushi Nemotoc87abd72007-08-02 23:36:02 +090028int toshiba_rbtx4938_irq_nested(int irq);
Ralf Baechlee4ac58a2006-04-03 17:56:36 +010029
Ralf Baechle937a8012006-10-07 19:44:33 +010030asmlinkage void plat_irq_dispatch(void)
Ralf Baechlee4ac58a2006-04-03 17:56:36 +010031{
32 unsigned int pending = read_c0_cause() & read_c0_status();
33
34 if (pending & STATUSF_IP7)
Ralf Baechle937a8012006-10-07 19:44:33 +010035 do_IRQ(TX4938_IRQ_CPU_TIMER);
Ralf Baechlee4ac58a2006-04-03 17:56:36 +010036 else if (pending & STATUSF_IP2) {
Atsushi Nemotoc87abd72007-08-02 23:36:02 +090037 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)
Ralf Baechle937a8012006-10-07 19:44:33 +010041 do_IRQ(irq);
Ralf Baechlee4ac58a2006-04-03 17:56:36 +010042 else
Ralf Baechle937a8012006-10-07 19:44:33 +010043 spurious_interrupt();
Ralf Baechlee4ac58a2006-04-03 17:56:36 +010044 } else if (pending & STATUSF_IP1)
Ralf Baechle937a8012006-10-07 19:44:33 +010045 do_IRQ(TX4938_IRQ_USER1);
Ralf Baechlee4ac58a2006-04-03 17:56:36 +010046 else if (pending & STATUSF_IP0)
Ralf Baechle937a8012006-10-07 19:44:33 +010047 do_IRQ(TX4938_IRQ_USER0);
Ralf Baechlee4ac58a2006-04-03 17:56:36 +010048}