Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2000 RidgeRun, Inc. |
| 3 | * Author: RidgeRun, Inc. |
| 4 | * glonnon@ridgerun.com, skranz@ridgerun.com, stevej@ridgerun.com |
| 5 | * |
| 6 | * Copyright 2001 MontaVista Software Inc. |
| 7 | * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net |
| 8 | * Copyright (C) 2000, 01, 05 Ralf Baechle (ralf@linux-mips.org) |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify it |
| 11 | * under the terms of the GNU General Public License as published by the |
| 12 | * Free Software Foundation; either version 2 of the License, or (at your |
| 13 | * option) any later version. |
| 14 | * |
| 15 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED |
| 16 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 17 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN |
| 18 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
| 21 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
| 22 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 | * |
| 26 | * You should have received a copy of the GNU General Public License along |
| 27 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 28 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
| 29 | * |
| 30 | */ |
| 31 | #include <linux/errno.h> |
| 32 | #include <linux/init.h> |
| 33 | #include <linux/kernel_stat.h> |
| 34 | #include <linux/module.h> |
| 35 | #include <linux/signal.h> |
| 36 | #include <linux/sched.h> |
| 37 | #include <linux/types.h> |
| 38 | #include <linux/interrupt.h> |
| 39 | #include <linux/ioport.h> |
| 40 | #include <linux/timex.h> |
| 41 | #include <linux/slab.h> |
| 42 | #include <linux/random.h> |
| 43 | #include <linux/bitops.h> |
Ralf Baechle | 3367fd5 | 2006-03-08 14:22:27 +0000 | [diff] [blame] | 44 | #include <linux/mv643xx.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | #include <asm/bootinfo.h> |
| 46 | #include <asm/io.h> |
| 47 | #include <asm/irq_cpu.h> |
| 48 | #include <asm/mipsregs.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | #include <asm/system.h> |
| 50 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | extern void uart_irq_init(void); |
| 52 | extern void cpci_irq_init(void); |
| 53 | |
| 54 | static struct irqaction cascade_fpga = { |
Thomas Gleixner | f40298f | 2006-07-01 19:29:20 -0700 | [diff] [blame] | 55 | no_action, IRQF_DISABLED, CPU_MASK_NONE, "cascade via FPGA", NULL, NULL |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | }; |
| 57 | |
| 58 | static struct irqaction cascade_mv64340 = { |
Thomas Gleixner | f40298f | 2006-07-01 19:29:20 -0700 | [diff] [blame] | 59 | no_action, IRQF_DISABLED, CPU_MASK_NONE, "cascade via MV64340", NULL, NULL |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | }; |
| 61 | |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 62 | extern void ll_uart_irq(void); |
| 63 | extern void ll_cpci_irq(void); |
Ralf Baechle | e4ac58a | 2006-04-03 17:56:36 +0100 | [diff] [blame] | 64 | |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 65 | asmlinkage void plat_irq_dispatch(void) |
Ralf Baechle | e4ac58a | 2006-04-03 17:56:36 +0100 | [diff] [blame] | 66 | { |
Thiemo Seufer | 119537c | 2007-03-19 00:13:37 +0000 | [diff] [blame] | 67 | unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM; |
Ralf Baechle | e4ac58a | 2006-04-03 17:56:36 +0100 | [diff] [blame] | 68 | |
| 69 | if (pending & STATUSF_IP0) |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 70 | do_IRQ(0); |
Ralf Baechle | e4ac58a | 2006-04-03 17:56:36 +0100 | [diff] [blame] | 71 | else if (pending & STATUSF_IP1) |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 72 | do_IRQ(1); |
Ralf Baechle | e4ac58a | 2006-04-03 17:56:36 +0100 | [diff] [blame] | 73 | else if (pending & STATUSF_IP2) |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 74 | do_IRQ(2); |
Ralf Baechle | e4ac58a | 2006-04-03 17:56:36 +0100 | [diff] [blame] | 75 | else if (pending & STATUSF_IP3) |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 76 | ll_uart_irq(); |
Ralf Baechle | e4ac58a | 2006-04-03 17:56:36 +0100 | [diff] [blame] | 77 | else if (pending & STATUSF_IP4) |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 78 | do_IRQ(4); |
Ralf Baechle | e4ac58a | 2006-04-03 17:56:36 +0100 | [diff] [blame] | 79 | else if (pending & STATUSF_IP5) |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 80 | ll_cpci_irq(); |
Ralf Baechle | e4ac58a | 2006-04-03 17:56:36 +0100 | [diff] [blame] | 81 | else if (pending & STATUSF_IP6) |
Ralf Baechle | d864b96 | 2006-10-08 21:32:40 +0100 | [diff] [blame] | 82 | ll_mv64340_irq(); |
Ralf Baechle | e4ac58a | 2006-04-03 17:56:36 +0100 | [diff] [blame] | 83 | else if (pending & STATUSF_IP7) |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 84 | do_IRQ(7); |
Ralf Baechle | e4ac58a | 2006-04-03 17:56:36 +0100 | [diff] [blame] | 85 | else |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 86 | spurious_interrupt(); |
Ralf Baechle | e4ac58a | 2006-04-03 17:56:36 +0100 | [diff] [blame] | 87 | } |
| 88 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | void __init arch_init_irq(void) |
| 90 | { |
| 91 | /* |
| 92 | * Clear all of the interrupts while we change the able around a bit. |
| 93 | * int-handler is not on bootstrap |
| 94 | */ |
| 95 | clear_c0_status(ST0_IM); |
| 96 | |
Atsushi Nemoto | 97dcb82 | 2007-01-08 02:14:29 +0900 | [diff] [blame] | 97 | mips_cpu_irq_init(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | |
| 99 | /* set up the cascading interrupts */ |
| 100 | setup_irq(3, &cascade_fpga); |
| 101 | setup_irq(5, &cascade_fpga); |
| 102 | setup_irq(6, &cascade_mv64340); |
| 103 | |
| 104 | mv64340_irq_init(16); |
| 105 | uart_irq_init(); |
| 106 | cpci_irq_init(); |
| 107 | } |