dmitry pervushin | 355c471 | 2006-05-21 14:53:06 +0400 | [diff] [blame] | 1 | /* |
dmitry pervushin | 355c471 | 2006-05-21 14:53:06 +0400 | [diff] [blame] | 2 | * Copyright (C) NEC Electronics Corporation 2004-2006 |
| 3 | * |
| 4 | * This file is based on the arch/mips/ddb5xxx/ddb5477/irq.c |
| 5 | * |
| 6 | * Copyright 2001 MontaVista Software Inc. |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 2 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 21 | */ |
dmitry pervushin | 355c471 | 2006-05-21 14:53:06 +0400 | [diff] [blame] | 22 | #include <linux/init.h> |
| 23 | #include <linux/interrupt.h> |
| 24 | #include <linux/irq.h> |
| 25 | #include <linux/types.h> |
| 26 | #include <linux/ptrace.h> |
| 27 | #include <linux/delay.h> |
| 28 | |
dmitry pervushin | 355c471 | 2006-05-21 14:53:06 +0400 | [diff] [blame] | 29 | #include <asm/irq_cpu.h> |
| 30 | #include <asm/system.h> |
| 31 | #include <asm/mipsregs.h> |
dmitry pervushin | 355c471 | 2006-05-21 14:53:06 +0400 | [diff] [blame] | 32 | #include <asm/addrspace.h> |
| 33 | #include <asm/bootinfo.h> |
| 34 | |
Shinya Kuribayashi | d91f2cb | 2008-10-24 01:30:20 +0900 | [diff] [blame] | 35 | #include <asm/emma/emma2rh.h> |
dmitry pervushin | 355c471 | 2006-05-21 14:53:06 +0400 | [diff] [blame] | 36 | |
Thomas Gleixner | 90a568f | 2011-03-23 21:08:51 +0000 | [diff] [blame^] | 37 | static void emma2rh_irq_enable(struct irq_data *d) |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 38 | { |
Thomas Gleixner | 90a568f | 2011-03-23 21:08:51 +0000 | [diff] [blame^] | 39 | unsigned int irq = d->irq - EMMA2RH_IRQ_BASE; |
| 40 | u32 reg_value, reg_bitmask, reg_index; |
Shinya Kuribayashi | 49618d6 | 2008-10-24 01:35:59 +0900 | [diff] [blame] | 41 | |
| 42 | reg_index = EMMA2RH_BHIF_INT_EN_0 + |
| 43 | (EMMA2RH_BHIF_INT_EN_1 - EMMA2RH_BHIF_INT_EN_0) * (irq / 32); |
| 44 | reg_value = emma2rh_in32(reg_index); |
| 45 | reg_bitmask = 0x1 << (irq % 32); |
| 46 | emma2rh_out32(reg_index, reg_value | reg_bitmask); |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 47 | } |
| 48 | |
Thomas Gleixner | 90a568f | 2011-03-23 21:08:51 +0000 | [diff] [blame^] | 49 | static void emma2rh_irq_disable(struct irq_data *d) |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 50 | { |
Thomas Gleixner | 90a568f | 2011-03-23 21:08:51 +0000 | [diff] [blame^] | 51 | unsigned int irq = d->irq - EMMA2RH_IRQ_BASE; |
| 52 | u32 reg_value, reg_bitmask, reg_index; |
Shinya Kuribayashi | 49618d6 | 2008-10-24 01:35:59 +0900 | [diff] [blame] | 53 | |
| 54 | reg_index = EMMA2RH_BHIF_INT_EN_0 + |
| 55 | (EMMA2RH_BHIF_INT_EN_1 - EMMA2RH_BHIF_INT_EN_0) * (irq / 32); |
| 56 | reg_value = emma2rh_in32(reg_index); |
| 57 | reg_bitmask = 0x1 << (irq % 32); |
| 58 | emma2rh_out32(reg_index, reg_value & ~reg_bitmask); |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 59 | } |
| 60 | |
| 61 | struct irq_chip emma2rh_irq_controller = { |
| 62 | .name = "emma2rh_irq", |
Thomas Gleixner | 90a568f | 2011-03-23 21:08:51 +0000 | [diff] [blame^] | 63 | .irq_mask = emma2rh_irq_disable, |
| 64 | .irq_unmask = emma2rh_irq_enable, |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 65 | }; |
| 66 | |
| 67 | void emma2rh_irq_init(void) |
| 68 | { |
| 69 | u32 i; |
| 70 | |
| 71 | for (i = 0; i < NUM_EMMA2RH_IRQ; i++) |
Shinya Kuribayashi | ae3c1d3 | 2009-03-21 22:08:12 +0900 | [diff] [blame] | 72 | set_irq_chip_and_handler_name(EMMA2RH_IRQ_BASE + i, |
| 73 | &emma2rh_irq_controller, |
| 74 | handle_level_irq, "level"); |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 75 | } |
| 76 | |
Thomas Gleixner | 90a568f | 2011-03-23 21:08:51 +0000 | [diff] [blame^] | 77 | static void emma2rh_sw_irq_enable(struct irq_data *d) |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 78 | { |
Thomas Gleixner | 90a568f | 2011-03-23 21:08:51 +0000 | [diff] [blame^] | 79 | unsigned int irq = d->irq - EMMA2RH_SW_IRQ_BASE; |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 80 | u32 reg; |
| 81 | |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 82 | reg = emma2rh_in32(EMMA2RH_BHIF_SW_INT_EN); |
| 83 | reg |= 1 << irq; |
| 84 | emma2rh_out32(EMMA2RH_BHIF_SW_INT_EN, reg); |
| 85 | } |
| 86 | |
Thomas Gleixner | 90a568f | 2011-03-23 21:08:51 +0000 | [diff] [blame^] | 87 | static void emma2rh_sw_irq_disable(struct irq_data *d) |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 88 | { |
Thomas Gleixner | 90a568f | 2011-03-23 21:08:51 +0000 | [diff] [blame^] | 89 | unsigned int irq = d->irq - EMMA2RH_SW_IRQ_BASE; |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 90 | u32 reg; |
| 91 | |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 92 | reg = emma2rh_in32(EMMA2RH_BHIF_SW_INT_EN); |
| 93 | reg &= ~(1 << irq); |
| 94 | emma2rh_out32(EMMA2RH_BHIF_SW_INT_EN, reg); |
| 95 | } |
| 96 | |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 97 | struct irq_chip emma2rh_sw_irq_controller = { |
| 98 | .name = "emma2rh_sw_irq", |
Thomas Gleixner | 90a568f | 2011-03-23 21:08:51 +0000 | [diff] [blame^] | 99 | .irq_mask = emma2rh_sw_irq_disable, |
| 100 | .irq_unmask = emma2rh_sw_irq_enable, |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 101 | }; |
| 102 | |
| 103 | void emma2rh_sw_irq_init(void) |
| 104 | { |
| 105 | u32 i; |
| 106 | |
| 107 | for (i = 0; i < NUM_EMMA2RH_IRQ_SW; i++) |
Shinya Kuribayashi | ae3c1d3 | 2009-03-21 22:08:12 +0900 | [diff] [blame] | 108 | set_irq_chip_and_handler_name(EMMA2RH_SW_IRQ_BASE + i, |
| 109 | &emma2rh_sw_irq_controller, |
| 110 | handle_level_irq, "level"); |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 111 | } |
| 112 | |
Thomas Gleixner | 90a568f | 2011-03-23 21:08:51 +0000 | [diff] [blame^] | 113 | static void emma2rh_gpio_irq_enable(struct irq_data *d) |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 114 | { |
Thomas Gleixner | 90a568f | 2011-03-23 21:08:51 +0000 | [diff] [blame^] | 115 | unsigned int irq = d->irq - EMMA2RH_GPIO_IRQ_BASE; |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 116 | u32 reg; |
| 117 | |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 118 | reg = emma2rh_in32(EMMA2RH_GPIO_INT_MASK); |
| 119 | reg |= 1 << irq; |
| 120 | emma2rh_out32(EMMA2RH_GPIO_INT_MASK, reg); |
| 121 | } |
| 122 | |
Thomas Gleixner | 90a568f | 2011-03-23 21:08:51 +0000 | [diff] [blame^] | 123 | static void emma2rh_gpio_irq_disable(struct irq_data *d) |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 124 | { |
Thomas Gleixner | 90a568f | 2011-03-23 21:08:51 +0000 | [diff] [blame^] | 125 | unsigned int irq = d->irq - EMMA2RH_GPIO_IRQ_BASE; |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 126 | u32 reg; |
| 127 | |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 128 | reg = emma2rh_in32(EMMA2RH_GPIO_INT_MASK); |
| 129 | reg &= ~(1 << irq); |
| 130 | emma2rh_out32(EMMA2RH_GPIO_INT_MASK, reg); |
| 131 | } |
| 132 | |
Thomas Gleixner | 90a568f | 2011-03-23 21:08:51 +0000 | [diff] [blame^] | 133 | static void emma2rh_gpio_irq_ack(struct irq_data *d) |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 134 | { |
Thomas Gleixner | 90a568f | 2011-03-23 21:08:51 +0000 | [diff] [blame^] | 135 | unsigned int irq = d->irq - EMMA2RH_GPIO_IRQ_BASE; |
| 136 | |
Shinya Kuribayashi | 8da55bb | 2009-03-21 22:06:14 +0900 | [diff] [blame] | 137 | emma2rh_out32(EMMA2RH_GPIO_INT_ST, ~(1 << irq)); |
| 138 | } |
| 139 | |
Thomas Gleixner | 90a568f | 2011-03-23 21:08:51 +0000 | [diff] [blame^] | 140 | static void emma2rh_gpio_irq_mask_ack(struct irq_data *d) |
Shinya Kuribayashi | 8da55bb | 2009-03-21 22:06:14 +0900 | [diff] [blame] | 141 | { |
Thomas Gleixner | 90a568f | 2011-03-23 21:08:51 +0000 | [diff] [blame^] | 142 | unsigned int irq = d->irq - EMMA2RH_GPIO_IRQ_BASE; |
Shinya Kuribayashi | 49618d6 | 2008-10-24 01:35:59 +0900 | [diff] [blame] | 143 | u32 reg; |
| 144 | |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 145 | emma2rh_out32(EMMA2RH_GPIO_INT_ST, ~(1 << irq)); |
Shinya Kuribayashi | 49618d6 | 2008-10-24 01:35:59 +0900 | [diff] [blame] | 146 | |
| 147 | reg = emma2rh_in32(EMMA2RH_GPIO_INT_MASK); |
| 148 | reg &= ~(1 << irq); |
| 149 | emma2rh_out32(EMMA2RH_GPIO_INT_MASK, reg); |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 150 | } |
| 151 | |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 152 | struct irq_chip emma2rh_gpio_irq_controller = { |
| 153 | .name = "emma2rh_gpio_irq", |
Thomas Gleixner | 90a568f | 2011-03-23 21:08:51 +0000 | [diff] [blame^] | 154 | .irq_ack = emma2rh_gpio_irq_ack, |
| 155 | .irq_mask = emma2rh_gpio_irq_disable, |
| 156 | .irq_mask_ack = emma2rh_gpio_irq_mask_ack, |
| 157 | .irq_unmask = emma2rh_gpio_irq_enable, |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 158 | }; |
| 159 | |
| 160 | void emma2rh_gpio_irq_init(void) |
| 161 | { |
| 162 | u32 i; |
| 163 | |
| 164 | for (i = 0; i < NUM_EMMA2RH_IRQ_GPIO; i++) |
Shinya Kuribayashi | 8da55bb | 2009-03-21 22:06:14 +0900 | [diff] [blame] | 165 | set_irq_chip_and_handler_name(EMMA2RH_GPIO_IRQ_BASE + i, |
| 166 | &emma2rh_gpio_irq_controller, |
| 167 | handle_edge_irq, "edge"); |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 168 | } |
dmitry pervushin | 355c471 | 2006-05-21 14:53:06 +0400 | [diff] [blame] | 169 | |
| 170 | static struct irqaction irq_cascade = { |
| 171 | .handler = no_action, |
| 172 | .flags = 0, |
dmitry pervushin | 355c471 | 2006-05-21 14:53:06 +0400 | [diff] [blame] | 173 | .name = "cascade", |
| 174 | .dev_id = NULL, |
| 175 | .next = NULL, |
| 176 | }; |
| 177 | |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 178 | /* |
| 179 | * the first level int-handler will jump here if it is a emma2rh irq |
| 180 | */ |
| 181 | void emma2rh_irq_dispatch(void) |
| 182 | { |
| 183 | u32 intStatus; |
| 184 | u32 bitmask; |
| 185 | u32 i; |
| 186 | |
| 187 | intStatus = emma2rh_in32(EMMA2RH_BHIF_INT_ST_0) & |
| 188 | emma2rh_in32(EMMA2RH_BHIF_INT_EN_0); |
| 189 | |
| 190 | #ifdef EMMA2RH_SW_CASCADE |
Shinya Kuribayashi | fb2826b | 2009-03-21 22:04:21 +0900 | [diff] [blame] | 191 | if (intStatus & (1UL << EMMA2RH_SW_CASCADE)) { |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 192 | u32 swIntStatus; |
| 193 | swIntStatus = emma2rh_in32(EMMA2RH_BHIF_SW_INT) |
| 194 | & emma2rh_in32(EMMA2RH_BHIF_SW_INT_EN); |
| 195 | for (i = 0, bitmask = 1; i < 32; i++, bitmask <<= 1) { |
| 196 | if (swIntStatus & bitmask) { |
| 197 | do_IRQ(EMMA2RH_SW_IRQ_BASE + i); |
| 198 | return; |
| 199 | } |
| 200 | } |
| 201 | } |
Shinya Kuribayashi | fb2826b | 2009-03-21 22:04:21 +0900 | [diff] [blame] | 202 | /* Skip S/W interrupt */ |
| 203 | intStatus &= ~(1UL << EMMA2RH_SW_CASCADE); |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 204 | #endif |
| 205 | |
| 206 | for (i = 0, bitmask = 1; i < 32; i++, bitmask <<= 1) { |
| 207 | if (intStatus & bitmask) { |
| 208 | do_IRQ(EMMA2RH_IRQ_BASE + i); |
| 209 | return; |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | intStatus = emma2rh_in32(EMMA2RH_BHIF_INT_ST_1) & |
| 214 | emma2rh_in32(EMMA2RH_BHIF_INT_EN_1); |
| 215 | |
| 216 | #ifdef EMMA2RH_GPIO_CASCADE |
Shinya Kuribayashi | fb2826b | 2009-03-21 22:04:21 +0900 | [diff] [blame] | 217 | if (intStatus & (1UL << (EMMA2RH_GPIO_CASCADE % 32))) { |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 218 | u32 gpioIntStatus; |
| 219 | gpioIntStatus = emma2rh_in32(EMMA2RH_GPIO_INT_ST) |
| 220 | & emma2rh_in32(EMMA2RH_GPIO_INT_MASK); |
| 221 | for (i = 0, bitmask = 1; i < 32; i++, bitmask <<= 1) { |
| 222 | if (gpioIntStatus & bitmask) { |
| 223 | do_IRQ(EMMA2RH_GPIO_IRQ_BASE + i); |
| 224 | return; |
| 225 | } |
| 226 | } |
| 227 | } |
Shinya Kuribayashi | fb2826b | 2009-03-21 22:04:21 +0900 | [diff] [blame] | 228 | /* Skip GPIO interrupt */ |
| 229 | intStatus &= ~(1UL << (EMMA2RH_GPIO_CASCADE % 32)); |
Shinya Kuribayashi | 9ae9fd7 | 2008-10-24 01:32:40 +0900 | [diff] [blame] | 230 | #endif |
| 231 | |
| 232 | for (i = 32, bitmask = 1; i < 64; i++, bitmask <<= 1) { |
| 233 | if (intStatus & bitmask) { |
| 234 | do_IRQ(EMMA2RH_IRQ_BASE + i); |
| 235 | return; |
| 236 | } |
| 237 | } |
| 238 | |
| 239 | intStatus = emma2rh_in32(EMMA2RH_BHIF_INT_ST_2) & |
| 240 | emma2rh_in32(EMMA2RH_BHIF_INT_EN_2); |
| 241 | |
| 242 | for (i = 64, bitmask = 1; i < 96; i++, bitmask <<= 1) { |
| 243 | if (intStatus & bitmask) { |
| 244 | do_IRQ(EMMA2RH_IRQ_BASE + i); |
| 245 | return; |
| 246 | } |
| 247 | } |
| 248 | } |
| 249 | |
dmitry pervushin | 355c471 | 2006-05-21 14:53:06 +0400 | [diff] [blame] | 250 | void __init arch_init_irq(void) |
| 251 | { |
| 252 | u32 reg; |
| 253 | |
dmitry pervushin | 355c471 | 2006-05-21 14:53:06 +0400 | [diff] [blame] | 254 | /* by default, interrupts are disabled. */ |
| 255 | emma2rh_out32(EMMA2RH_BHIF_INT_EN_0, 0); |
| 256 | emma2rh_out32(EMMA2RH_BHIF_INT_EN_1, 0); |
| 257 | emma2rh_out32(EMMA2RH_BHIF_INT_EN_2, 0); |
| 258 | emma2rh_out32(EMMA2RH_BHIF_INT1_EN_0, 0); |
| 259 | emma2rh_out32(EMMA2RH_BHIF_INT1_EN_1, 0); |
| 260 | emma2rh_out32(EMMA2RH_BHIF_INT1_EN_2, 0); |
| 261 | emma2rh_out32(EMMA2RH_BHIF_SW_INT_EN, 0); |
| 262 | |
| 263 | clear_c0_status(0xff00); |
| 264 | set_c0_status(0x0400); |
| 265 | |
| 266 | #define GPIO_PCI (0xf<<15) |
| 267 | /* setup GPIO interrupt for PCI interface */ |
| 268 | /* direction input */ |
| 269 | reg = emma2rh_in32(EMMA2RH_GPIO_DIR); |
| 270 | emma2rh_out32(EMMA2RH_GPIO_DIR, reg & ~GPIO_PCI); |
| 271 | /* disable interrupt */ |
| 272 | reg = emma2rh_in32(EMMA2RH_GPIO_INT_MASK); |
| 273 | emma2rh_out32(EMMA2RH_GPIO_INT_MASK, reg & ~GPIO_PCI); |
| 274 | /* level triggerd */ |
| 275 | reg = emma2rh_in32(EMMA2RH_GPIO_INT_MODE); |
| 276 | emma2rh_out32(EMMA2RH_GPIO_INT_MODE, reg | GPIO_PCI); |
| 277 | reg = emma2rh_in32(EMMA2RH_GPIO_INT_CND_A); |
| 278 | emma2rh_out32(EMMA2RH_GPIO_INT_CND_A, reg & (~GPIO_PCI)); |
| 279 | /* interrupt clear */ |
| 280 | emma2rh_out32(EMMA2RH_GPIO_INT_ST, ~GPIO_PCI); |
| 281 | |
| 282 | /* init all controllers */ |
Shinya Kuribayashi | 9b6c04b | 2008-10-24 01:31:16 +0900 | [diff] [blame] | 283 | emma2rh_irq_init(); |
Shinya Kuribayashi | 68ed1ca | 2008-10-24 01:31:43 +0900 | [diff] [blame] | 284 | emma2rh_sw_irq_init(); |
Shinya Kuribayashi | fcb3cfe | 2008-10-24 01:32:11 +0900 | [diff] [blame] | 285 | emma2rh_gpio_irq_init(); |
Atsushi Nemoto | 97dcb82 | 2007-01-08 02:14:29 +0900 | [diff] [blame] | 286 | mips_cpu_irq_init(); |
dmitry pervushin | 355c471 | 2006-05-21 14:53:06 +0400 | [diff] [blame] | 287 | |
| 288 | /* setup cascade interrupts */ |
| 289 | setup_irq(EMMA2RH_IRQ_BASE + EMMA2RH_SW_CASCADE, &irq_cascade); |
| 290 | setup_irq(EMMA2RH_IRQ_BASE + EMMA2RH_GPIO_CASCADE, &irq_cascade); |
Shinya Kuribayashi | 9e6f396 | 2010-06-17 20:36:13 +0900 | [diff] [blame] | 291 | setup_irq(MIPS_CPU_IRQ_BASE + 2, &irq_cascade); |
dmitry pervushin | 355c471 | 2006-05-21 14:53:06 +0400 | [diff] [blame] | 292 | } |
| 293 | |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 294 | asmlinkage void plat_irq_dispatch(void) |
dmitry pervushin | 355c471 | 2006-05-21 14:53:06 +0400 | [diff] [blame] | 295 | { |
Thiemo Seufer | 119537c | 2007-03-19 00:13:37 +0000 | [diff] [blame] | 296 | unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM; |
dmitry pervushin | 355c471 | 2006-05-21 14:53:06 +0400 | [diff] [blame] | 297 | |
| 298 | if (pending & STATUSF_IP7) |
Shinya Kuribayashi | eebacda | 2010-06-17 20:35:58 +0900 | [diff] [blame] | 299 | do_IRQ(MIPS_CPU_IRQ_BASE + 7); |
dmitry pervushin | 355c471 | 2006-05-21 14:53:06 +0400 | [diff] [blame] | 300 | else if (pending & STATUSF_IP2) |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 301 | emma2rh_irq_dispatch(); |
dmitry pervushin | 355c471 | 2006-05-21 14:53:06 +0400 | [diff] [blame] | 302 | else if (pending & STATUSF_IP1) |
Shinya Kuribayashi | eebacda | 2010-06-17 20:35:58 +0900 | [diff] [blame] | 303 | do_IRQ(MIPS_CPU_IRQ_BASE + 1); |
dmitry pervushin | 355c471 | 2006-05-21 14:53:06 +0400 | [diff] [blame] | 304 | else if (pending & STATUSF_IP0) |
Shinya Kuribayashi | eebacda | 2010-06-17 20:35:58 +0900 | [diff] [blame] | 305 | do_IRQ(MIPS_CPU_IRQ_BASE + 0); |
dmitry pervushin | 355c471 | 2006-05-21 14:53:06 +0400 | [diff] [blame] | 306 | else |
Ralf Baechle | 937a801 | 2006-10-07 19:44:33 +0100 | [diff] [blame] | 307 | spurious_interrupt(); |
dmitry pervushin | 355c471 | 2006-05-21 14:53:06 +0400 | [diff] [blame] | 308 | } |