David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 1 | /* |
| 2 | * This file is subject to the terms and conditions of the GNU General Public |
| 3 | * License. See the file "COPYING" in the main directory of this archive |
| 4 | * for more details. |
| 5 | * |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 6 | * Copyright (C) 2004-2008, 2009, 2010, 2011 Cavium Networks |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 7 | */ |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 8 | |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 9 | #include <linux/interrupt.h> |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 10 | #include <linux/bitops.h> |
| 11 | #include <linux/percpu.h> |
| 12 | #include <linux/irq.h> |
Ralf Baechle | 631330f | 2009-06-19 14:05:26 +0100 | [diff] [blame] | 13 | #include <linux/smp.h> |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 14 | |
| 15 | #include <asm/octeon/octeon.h> |
| 16 | |
David Daney | 3996142 | 2010-02-18 11:47:40 -0800 | [diff] [blame] | 17 | static DEFINE_RAW_SPINLOCK(octeon_irq_ciu0_lock); |
| 18 | static DEFINE_RAW_SPINLOCK(octeon_irq_ciu1_lock); |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 19 | |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 20 | static DEFINE_PER_CPU(unsigned long, octeon_irq_ciu0_en_mirror); |
| 21 | static DEFINE_PER_CPU(unsigned long, octeon_irq_ciu1_en_mirror); |
| 22 | |
| 23 | static __read_mostly u8 octeon_irq_ciu_to_irq[8][64]; |
| 24 | |
| 25 | union octeon_ciu_chip_data { |
| 26 | void *p; |
| 27 | unsigned long l; |
| 28 | struct { |
| 29 | unsigned int line:6; |
| 30 | unsigned int bit:6; |
| 31 | } s; |
| 32 | }; |
| 33 | |
| 34 | struct octeon_core_chip_data { |
| 35 | struct mutex core_irq_mutex; |
| 36 | bool current_en; |
| 37 | bool desired_en; |
| 38 | u8 bit; |
| 39 | }; |
| 40 | |
| 41 | #define MIPS_CORE_IRQ_LINES 8 |
| 42 | |
| 43 | static struct octeon_core_chip_data octeon_irq_core_chip_data[MIPS_CORE_IRQ_LINES]; |
| 44 | |
| 45 | static void __init octeon_irq_set_ciu_mapping(int irq, int line, int bit, |
| 46 | struct irq_chip *chip, |
| 47 | irq_flow_handler_t handler) |
| 48 | { |
| 49 | union octeon_ciu_chip_data cd; |
| 50 | |
| 51 | irq_set_chip_and_handler(irq, chip, handler); |
| 52 | |
| 53 | cd.l = 0; |
| 54 | cd.s.line = line; |
| 55 | cd.s.bit = bit; |
| 56 | |
| 57 | irq_set_chip_data(irq, cd.p); |
| 58 | octeon_irq_ciu_to_irq[line][bit] = irq; |
| 59 | } |
| 60 | |
David Daney | cd847b7 | 2009-10-13 11:26:03 -0700 | [diff] [blame] | 61 | static int octeon_coreid_for_cpu(int cpu) |
| 62 | { |
| 63 | #ifdef CONFIG_SMP |
| 64 | return cpu_logical_map(cpu); |
| 65 | #else |
| 66 | return cvmx_get_core_num(); |
| 67 | #endif |
| 68 | } |
| 69 | |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 70 | static int octeon_cpu_for_coreid(int coreid) |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 71 | { |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 72 | #ifdef CONFIG_SMP |
| 73 | return cpu_number_map(coreid); |
| 74 | #else |
| 75 | return smp_processor_id(); |
| 76 | #endif |
| 77 | } |
| 78 | |
| 79 | static void octeon_irq_core_ack(struct irq_data *data) |
| 80 | { |
| 81 | struct octeon_core_chip_data *cd = irq_data_get_irq_chip_data(data); |
| 82 | unsigned int bit = cd->bit; |
| 83 | |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 84 | /* |
| 85 | * We don't need to disable IRQs to make these atomic since |
| 86 | * they are already disabled earlier in the low level |
| 87 | * interrupt code. |
| 88 | */ |
| 89 | clear_c0_status(0x100 << bit); |
| 90 | /* The two user interrupts must be cleared manually. */ |
| 91 | if (bit < 2) |
| 92 | clear_c0_cause(0x100 << bit); |
| 93 | } |
| 94 | |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 95 | static void octeon_irq_core_eoi(struct irq_data *data) |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 96 | { |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 97 | struct octeon_core_chip_data *cd = irq_data_get_irq_chip_data(data); |
| 98 | |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 99 | /* |
| 100 | * We don't need to disable IRQs to make these atomic since |
| 101 | * they are already disabled earlier in the low level |
| 102 | * interrupt code. |
| 103 | */ |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 104 | set_c0_status(0x100 << cd->bit); |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 105 | } |
| 106 | |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 107 | static void octeon_irq_core_set_enable_local(void *arg) |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 108 | { |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 109 | struct irq_data *data = arg; |
| 110 | struct octeon_core_chip_data *cd = irq_data_get_irq_chip_data(data); |
| 111 | unsigned int mask = 0x100 << cd->bit; |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 112 | |
| 113 | /* |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 114 | * Interrupts are already disabled, so these are atomic. |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 115 | */ |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 116 | if (cd->desired_en) |
| 117 | set_c0_status(mask); |
| 118 | else |
| 119 | clear_c0_status(mask); |
| 120 | |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 121 | } |
| 122 | |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 123 | static void octeon_irq_core_disable(struct irq_data *data) |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 124 | { |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 125 | struct octeon_core_chip_data *cd = irq_data_get_irq_chip_data(data); |
| 126 | cd->desired_en = false; |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 127 | } |
| 128 | |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 129 | static void octeon_irq_core_enable(struct irq_data *data) |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 130 | { |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 131 | struct octeon_core_chip_data *cd = irq_data_get_irq_chip_data(data); |
| 132 | cd->desired_en = true; |
| 133 | } |
| 134 | |
| 135 | static void octeon_irq_core_bus_lock(struct irq_data *data) |
| 136 | { |
| 137 | struct octeon_core_chip_data *cd = irq_data_get_irq_chip_data(data); |
| 138 | |
| 139 | mutex_lock(&cd->core_irq_mutex); |
| 140 | } |
| 141 | |
| 142 | static void octeon_irq_core_bus_sync_unlock(struct irq_data *data) |
| 143 | { |
| 144 | struct octeon_core_chip_data *cd = irq_data_get_irq_chip_data(data); |
| 145 | |
| 146 | if (cd->desired_en != cd->current_en) { |
| 147 | on_each_cpu(octeon_irq_core_set_enable_local, data, 1); |
| 148 | |
| 149 | cd->current_en = cd->desired_en; |
| 150 | } |
| 151 | |
| 152 | mutex_unlock(&cd->core_irq_mutex); |
| 153 | } |
| 154 | |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 155 | static struct irq_chip octeon_irq_chip_core = { |
| 156 | .name = "Core", |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 157 | .irq_enable = octeon_irq_core_enable, |
| 158 | .irq_disable = octeon_irq_core_disable, |
| 159 | .irq_ack = octeon_irq_core_ack, |
| 160 | .irq_eoi = octeon_irq_core_eoi, |
| 161 | .irq_bus_lock = octeon_irq_core_bus_lock, |
| 162 | .irq_bus_sync_unlock = octeon_irq_core_bus_sync_unlock, |
| 163 | |
Thomas Gleixner | 5b7cd6f | 2011-03-27 16:04:30 +0200 | [diff] [blame] | 164 | .irq_cpu_online = octeon_irq_core_eoi, |
| 165 | .irq_cpu_offline = octeon_irq_core_ack, |
| 166 | .flags = IRQCHIP_ONOFFLINE_ENABLED, |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 167 | }; |
| 168 | |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 169 | static void __init octeon_irq_init_core(void) |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 170 | { |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 171 | int i; |
| 172 | int irq; |
| 173 | struct octeon_core_chip_data *cd; |
David Daney | 5aae1fd | 2010-07-23 10:43:46 -0700 | [diff] [blame] | 174 | |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 175 | for (i = 0; i < MIPS_CORE_IRQ_LINES; i++) { |
| 176 | cd = &octeon_irq_core_chip_data[i]; |
| 177 | cd->current_en = false; |
| 178 | cd->desired_en = false; |
| 179 | cd->bit = i; |
| 180 | mutex_init(&cd->core_irq_mutex); |
| 181 | |
| 182 | irq = OCTEON_IRQ_SW0 + i; |
| 183 | switch (irq) { |
| 184 | case OCTEON_IRQ_TIMER: |
| 185 | case OCTEON_IRQ_SW0: |
| 186 | case OCTEON_IRQ_SW1: |
| 187 | case OCTEON_IRQ_5: |
| 188 | case OCTEON_IRQ_PERF: |
| 189 | irq_set_chip_data(irq, cd); |
| 190 | irq_set_chip_and_handler(irq, &octeon_irq_chip_core, |
| 191 | handle_percpu_irq); |
| 192 | break; |
| 193 | default: |
| 194 | break; |
| 195 | } |
| 196 | } |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 197 | } |
| 198 | |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 199 | static int next_cpu_for_irq(struct irq_data *data) |
David Daney | 5aae1fd | 2010-07-23 10:43:46 -0700 | [diff] [blame] | 200 | { |
| 201 | |
| 202 | #ifdef CONFIG_SMP |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 203 | int cpu; |
| 204 | int weight = cpumask_weight(data->affinity); |
David Daney | 5aae1fd | 2010-07-23 10:43:46 -0700 | [diff] [blame] | 205 | |
| 206 | if (weight > 1) { |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 207 | cpu = smp_processor_id(); |
David Daney | 5aae1fd | 2010-07-23 10:43:46 -0700 | [diff] [blame] | 208 | for (;;) { |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 209 | cpu = cpumask_next(cpu, data->affinity); |
David Daney | 5aae1fd | 2010-07-23 10:43:46 -0700 | [diff] [blame] | 210 | if (cpu >= nr_cpu_ids) { |
| 211 | cpu = -1; |
| 212 | continue; |
| 213 | } else if (cpumask_test_cpu(cpu, cpu_online_mask)) { |
| 214 | break; |
| 215 | } |
| 216 | } |
David Daney | 5aae1fd | 2010-07-23 10:43:46 -0700 | [diff] [blame] | 217 | } else if (weight == 1) { |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 218 | cpu = cpumask_first(data->affinity); |
David Daney | 5aae1fd | 2010-07-23 10:43:46 -0700 | [diff] [blame] | 219 | } else { |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 220 | cpu = smp_processor_id(); |
David Daney | 5aae1fd | 2010-07-23 10:43:46 -0700 | [diff] [blame] | 221 | } |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 222 | return cpu; |
David Daney | 5aae1fd | 2010-07-23 10:43:46 -0700 | [diff] [blame] | 223 | #else |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 224 | return smp_processor_id(); |
David Daney | 5aae1fd | 2010-07-23 10:43:46 -0700 | [diff] [blame] | 225 | #endif |
| 226 | } |
| 227 | |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 228 | static void octeon_irq_ciu_enable(struct irq_data *data) |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 229 | { |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 230 | int cpu = next_cpu_for_irq(data); |
| 231 | int coreid = octeon_coreid_for_cpu(cpu); |
| 232 | unsigned long *pen; |
David Daney | 5aae1fd | 2010-07-23 10:43:46 -0700 | [diff] [blame] | 233 | unsigned long flags; |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 234 | union octeon_ciu_chip_data cd; |
David Daney | 5aae1fd | 2010-07-23 10:43:46 -0700 | [diff] [blame] | 235 | |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 236 | cd.p = irq_data_get_irq_chip_data(data); |
David Daney | 5aae1fd | 2010-07-23 10:43:46 -0700 | [diff] [blame] | 237 | |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 238 | if (cd.s.line == 0) { |
| 239 | raw_spin_lock_irqsave(&octeon_irq_ciu0_lock, flags); |
| 240 | pen = &per_cpu(octeon_irq_ciu0_en_mirror, cpu); |
| 241 | set_bit(cd.s.bit, pen); |
| 242 | cvmx_write_csr(CVMX_CIU_INTX_EN0(coreid * 2), *pen); |
| 243 | raw_spin_unlock_irqrestore(&octeon_irq_ciu0_lock, flags); |
| 244 | } else { |
| 245 | raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags); |
| 246 | pen = &per_cpu(octeon_irq_ciu1_en_mirror, cpu); |
| 247 | set_bit(cd.s.bit, pen); |
| 248 | cvmx_write_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1), *pen); |
| 249 | raw_spin_unlock_irqrestore(&octeon_irq_ciu1_lock, flags); |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 250 | } |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 251 | } |
| 252 | |
| 253 | static void octeon_irq_ciu_enable_local(struct irq_data *data) |
| 254 | { |
| 255 | unsigned long *pen; |
| 256 | unsigned long flags; |
| 257 | union octeon_ciu_chip_data cd; |
| 258 | |
| 259 | cd.p = irq_data_get_irq_chip_data(data); |
| 260 | |
| 261 | if (cd.s.line == 0) { |
| 262 | raw_spin_lock_irqsave(&octeon_irq_ciu0_lock, flags); |
| 263 | pen = &__get_cpu_var(octeon_irq_ciu0_en_mirror); |
| 264 | set_bit(cd.s.bit, pen); |
| 265 | cvmx_write_csr(CVMX_CIU_INTX_EN0(cvmx_get_core_num() * 2), *pen); |
| 266 | raw_spin_unlock_irqrestore(&octeon_irq_ciu0_lock, flags); |
| 267 | } else { |
| 268 | raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags); |
| 269 | pen = &__get_cpu_var(octeon_irq_ciu1_en_mirror); |
| 270 | set_bit(cd.s.bit, pen); |
| 271 | cvmx_write_csr(CVMX_CIU_INTX_EN1(cvmx_get_core_num() * 2 + 1), *pen); |
| 272 | raw_spin_unlock_irqrestore(&octeon_irq_ciu1_lock, flags); |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | static void octeon_irq_ciu_disable_local(struct irq_data *data) |
| 277 | { |
| 278 | unsigned long *pen; |
| 279 | unsigned long flags; |
| 280 | union octeon_ciu_chip_data cd; |
| 281 | |
| 282 | cd.p = irq_data_get_irq_chip_data(data); |
| 283 | |
| 284 | if (cd.s.line == 0) { |
| 285 | raw_spin_lock_irqsave(&octeon_irq_ciu0_lock, flags); |
| 286 | pen = &__get_cpu_var(octeon_irq_ciu0_en_mirror); |
| 287 | clear_bit(cd.s.bit, pen); |
| 288 | cvmx_write_csr(CVMX_CIU_INTX_EN0(cvmx_get_core_num() * 2), *pen); |
| 289 | raw_spin_unlock_irqrestore(&octeon_irq_ciu0_lock, flags); |
| 290 | } else { |
| 291 | raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags); |
| 292 | pen = &__get_cpu_var(octeon_irq_ciu1_en_mirror); |
| 293 | clear_bit(cd.s.bit, pen); |
| 294 | cvmx_write_csr(CVMX_CIU_INTX_EN1(cvmx_get_core_num() * 2 + 1), *pen); |
| 295 | raw_spin_unlock_irqrestore(&octeon_irq_ciu1_lock, flags); |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | static void octeon_irq_ciu_disable_all(struct irq_data *data) |
| 300 | { |
| 301 | unsigned long flags; |
| 302 | unsigned long *pen; |
| 303 | int cpu; |
| 304 | union octeon_ciu_chip_data cd; |
| 305 | |
| 306 | wmb(); /* Make sure flag changes arrive before register updates. */ |
| 307 | |
| 308 | cd.p = irq_data_get_irq_chip_data(data); |
| 309 | |
| 310 | if (cd.s.line == 0) { |
| 311 | raw_spin_lock_irqsave(&octeon_irq_ciu0_lock, flags); |
| 312 | for_each_online_cpu(cpu) { |
| 313 | int coreid = octeon_coreid_for_cpu(cpu); |
| 314 | pen = &per_cpu(octeon_irq_ciu0_en_mirror, cpu); |
| 315 | clear_bit(cd.s.bit, pen); |
| 316 | cvmx_write_csr(CVMX_CIU_INTX_EN0(coreid * 2), *pen); |
| 317 | } |
| 318 | raw_spin_unlock_irqrestore(&octeon_irq_ciu0_lock, flags); |
| 319 | } else { |
| 320 | raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags); |
| 321 | for_each_online_cpu(cpu) { |
| 322 | int coreid = octeon_coreid_for_cpu(cpu); |
| 323 | pen = &per_cpu(octeon_irq_ciu1_en_mirror, cpu); |
| 324 | clear_bit(cd.s.bit, pen); |
| 325 | cvmx_write_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1), *pen); |
| 326 | } |
| 327 | raw_spin_unlock_irqrestore(&octeon_irq_ciu1_lock, flags); |
| 328 | } |
| 329 | } |
| 330 | |
| 331 | static void octeon_irq_ciu_enable_all(struct irq_data *data) |
| 332 | { |
| 333 | unsigned long flags; |
| 334 | unsigned long *pen; |
| 335 | int cpu; |
| 336 | union octeon_ciu_chip_data cd; |
| 337 | |
| 338 | cd.p = irq_data_get_irq_chip_data(data); |
| 339 | |
| 340 | if (cd.s.line == 0) { |
| 341 | raw_spin_lock_irqsave(&octeon_irq_ciu0_lock, flags); |
| 342 | for_each_online_cpu(cpu) { |
| 343 | int coreid = octeon_coreid_for_cpu(cpu); |
| 344 | pen = &per_cpu(octeon_irq_ciu0_en_mirror, cpu); |
| 345 | set_bit(cd.s.bit, pen); |
| 346 | cvmx_write_csr(CVMX_CIU_INTX_EN0(coreid * 2), *pen); |
| 347 | } |
| 348 | raw_spin_unlock_irqrestore(&octeon_irq_ciu0_lock, flags); |
| 349 | } else { |
| 350 | raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags); |
| 351 | for_each_online_cpu(cpu) { |
| 352 | int coreid = octeon_coreid_for_cpu(cpu); |
| 353 | pen = &per_cpu(octeon_irq_ciu1_en_mirror, cpu); |
| 354 | set_bit(cd.s.bit, pen); |
| 355 | cvmx_write_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1), *pen); |
| 356 | } |
| 357 | raw_spin_unlock_irqrestore(&octeon_irq_ciu1_lock, flags); |
| 358 | } |
David Daney | cd847b7 | 2009-10-13 11:26:03 -0700 | [diff] [blame] | 359 | } |
| 360 | |
| 361 | /* |
David Daney | 5aae1fd | 2010-07-23 10:43:46 -0700 | [diff] [blame] | 362 | * Enable the irq on the next core in the affinity set for chips that |
| 363 | * have the EN*_W1{S,C} registers. |
David Daney | cd847b7 | 2009-10-13 11:26:03 -0700 | [diff] [blame] | 364 | */ |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 365 | static void octeon_irq_ciu_enable_v2(struct irq_data *data) |
David Daney | cd847b7 | 2009-10-13 11:26:03 -0700 | [diff] [blame] | 366 | { |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 367 | u64 mask; |
| 368 | int cpu = next_cpu_for_irq(data); |
| 369 | union octeon_ciu_chip_data cd; |
David Daney | 5aae1fd | 2010-07-23 10:43:46 -0700 | [diff] [blame] | 370 | |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 371 | cd.p = irq_data_get_irq_chip_data(data); |
| 372 | mask = 1ull << (cd.s.bit); |
| 373 | |
| 374 | /* |
| 375 | * Called under the desc lock, so these should never get out |
| 376 | * of sync. |
| 377 | */ |
| 378 | if (cd.s.line == 0) { |
| 379 | int index = octeon_coreid_for_cpu(cpu) * 2; |
| 380 | set_bit(cd.s.bit, &per_cpu(octeon_irq_ciu0_en_mirror, cpu)); |
David Daney | 5aae1fd | 2010-07-23 10:43:46 -0700 | [diff] [blame] | 381 | cvmx_write_csr(CVMX_CIU_INTX_EN0_W1S(index), mask); |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 382 | } else { |
| 383 | int index = octeon_coreid_for_cpu(cpu) * 2 + 1; |
| 384 | set_bit(cd.s.bit, &per_cpu(octeon_irq_ciu1_en_mirror, cpu)); |
| 385 | cvmx_write_csr(CVMX_CIU_INTX_EN1_W1S(index), mask); |
David Daney | 5aae1fd | 2010-07-23 10:43:46 -0700 | [diff] [blame] | 386 | } |
| 387 | } |
| 388 | |
| 389 | /* |
| 390 | * Enable the irq on the current CPU for chips that |
| 391 | * have the EN*_W1{S,C} registers. |
| 392 | */ |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 393 | static void octeon_irq_ciu_enable_local_v2(struct irq_data *data) |
David Daney | 5aae1fd | 2010-07-23 10:43:46 -0700 | [diff] [blame] | 394 | { |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 395 | u64 mask; |
| 396 | union octeon_ciu_chip_data cd; |
David Daney | cd847b7 | 2009-10-13 11:26:03 -0700 | [diff] [blame] | 397 | |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 398 | cd.p = irq_data_get_irq_chip_data(data); |
| 399 | mask = 1ull << (cd.s.bit); |
David Daney | cd847b7 | 2009-10-13 11:26:03 -0700 | [diff] [blame] | 400 | |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 401 | if (cd.s.line == 0) { |
| 402 | int index = cvmx_get_core_num() * 2; |
| 403 | set_bit(cd.s.bit, &__get_cpu_var(octeon_irq_ciu0_en_mirror)); |
David Daney | dbb103b | 2010-01-07 11:05:00 -0800 | [diff] [blame] | 404 | cvmx_write_csr(CVMX_CIU_INTX_EN0_W1S(index), mask); |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 405 | } else { |
| 406 | int index = cvmx_get_core_num() * 2 + 1; |
| 407 | set_bit(cd.s.bit, &__get_cpu_var(octeon_irq_ciu1_en_mirror)); |
| 408 | cvmx_write_csr(CVMX_CIU_INTX_EN1_W1S(index), mask); |
| 409 | } |
David Daney | dbb103b | 2010-01-07 11:05:00 -0800 | [diff] [blame] | 410 | } |
| 411 | |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 412 | static void octeon_irq_ciu_disable_local_v2(struct irq_data *data) |
David Daney | cd847b7 | 2009-10-13 11:26:03 -0700 | [diff] [blame] | 413 | { |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 414 | u64 mask; |
| 415 | union octeon_ciu_chip_data cd; |
| 416 | |
| 417 | cd.p = irq_data_get_irq_chip_data(data); |
| 418 | mask = 1ull << (cd.s.bit); |
| 419 | |
| 420 | if (cd.s.line == 0) { |
| 421 | int index = cvmx_get_core_num() * 2; |
| 422 | clear_bit(cd.s.bit, &__get_cpu_var(octeon_irq_ciu0_en_mirror)); |
David Daney | cd847b7 | 2009-10-13 11:26:03 -0700 | [diff] [blame] | 423 | cvmx_write_csr(CVMX_CIU_INTX_EN0_W1C(index), mask); |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 424 | } else { |
| 425 | int index = cvmx_get_core_num() * 2 + 1; |
| 426 | clear_bit(cd.s.bit, &__get_cpu_var(octeon_irq_ciu1_en_mirror)); |
David Daney | cd847b7 | 2009-10-13 11:26:03 -0700 | [diff] [blame] | 427 | cvmx_write_csr(CVMX_CIU_INTX_EN1_W1C(index), mask); |
| 428 | } |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 429 | } |
| 430 | |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 431 | /* |
| 432 | * Write to the W1C bit in CVMX_CIU_INTX_SUM0 to clear the irq. |
| 433 | */ |
| 434 | static void octeon_irq_ciu_ack(struct irq_data *data) |
| 435 | { |
| 436 | u64 mask; |
| 437 | union octeon_ciu_chip_data cd; |
| 438 | |
| 439 | cd.p = data->chip_data; |
| 440 | mask = 1ull << (cd.s.bit); |
| 441 | |
| 442 | if (cd.s.line == 0) { |
| 443 | int index = cvmx_get_core_num() * 2; |
| 444 | cvmx_write_csr(CVMX_CIU_INTX_SUM0(index), mask); |
| 445 | } else { |
| 446 | cvmx_write_csr(CVMX_CIU_INT_SUM1, mask); |
| 447 | } |
| 448 | } |
| 449 | |
| 450 | /* |
| 451 | * Disable the irq on the all cores for chips that have the EN*_W1{S,C} |
| 452 | * registers. |
| 453 | */ |
| 454 | static void octeon_irq_ciu_disable_all_v2(struct irq_data *data) |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 455 | { |
| 456 | int cpu; |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 457 | u64 mask; |
| 458 | union octeon_ciu_chip_data cd; |
| 459 | |
| 460 | wmb(); /* Make sure flag changes arrive before register updates. */ |
| 461 | |
| 462 | cd.p = data->chip_data; |
| 463 | mask = 1ull << (cd.s.bit); |
| 464 | |
| 465 | if (cd.s.line == 0) { |
| 466 | for_each_online_cpu(cpu) { |
| 467 | int index = octeon_coreid_for_cpu(cpu) * 2; |
| 468 | clear_bit(cd.s.bit, &per_cpu(octeon_irq_ciu0_en_mirror, cpu)); |
| 469 | cvmx_write_csr(CVMX_CIU_INTX_EN0_W1C(index), mask); |
| 470 | } |
| 471 | } else { |
| 472 | for_each_online_cpu(cpu) { |
| 473 | int index = octeon_coreid_for_cpu(cpu) * 2 + 1; |
| 474 | clear_bit(cd.s.bit, &per_cpu(octeon_irq_ciu1_en_mirror, cpu)); |
| 475 | cvmx_write_csr(CVMX_CIU_INTX_EN1_W1C(index), mask); |
| 476 | } |
| 477 | } |
| 478 | } |
| 479 | |
| 480 | /* |
| 481 | * Enable the irq on the all cores for chips that have the EN*_W1{S,C} |
| 482 | * registers. |
| 483 | */ |
| 484 | static void octeon_irq_ciu_enable_all_v2(struct irq_data *data) |
| 485 | { |
| 486 | int cpu; |
| 487 | u64 mask; |
| 488 | union octeon_ciu_chip_data cd; |
| 489 | |
| 490 | cd.p = data->chip_data; |
| 491 | mask = 1ull << (cd.s.bit); |
| 492 | |
| 493 | if (cd.s.line == 0) { |
| 494 | for_each_online_cpu(cpu) { |
| 495 | int index = octeon_coreid_for_cpu(cpu) * 2; |
| 496 | set_bit(cd.s.bit, &per_cpu(octeon_irq_ciu0_en_mirror, cpu)); |
| 497 | cvmx_write_csr(CVMX_CIU_INTX_EN0_W1S(index), mask); |
| 498 | } |
| 499 | } else { |
| 500 | for_each_online_cpu(cpu) { |
| 501 | int index = octeon_coreid_for_cpu(cpu) * 2 + 1; |
| 502 | set_bit(cd.s.bit, &per_cpu(octeon_irq_ciu1_en_mirror, cpu)); |
| 503 | cvmx_write_csr(CVMX_CIU_INTX_EN1_W1S(index), mask); |
| 504 | } |
| 505 | } |
| 506 | } |
| 507 | |
David Daney | 6d1ab4c | 2012-07-05 18:12:37 +0200 | [diff] [blame] | 508 | static void octeon_irq_gpio_setup(struct irq_data *data) |
| 509 | { |
| 510 | union cvmx_gpio_bit_cfgx cfg; |
| 511 | union octeon_ciu_chip_data cd; |
| 512 | u32 t = irqd_get_trigger_type(data); |
| 513 | |
| 514 | cd.p = irq_data_get_irq_chip_data(data); |
| 515 | |
| 516 | cfg.u64 = 0; |
| 517 | cfg.s.int_en = 1; |
| 518 | cfg.s.int_type = (t & IRQ_TYPE_EDGE_BOTH) != 0; |
| 519 | cfg.s.rx_xor = (t & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_EDGE_FALLING)) != 0; |
| 520 | |
| 521 | /* 140 nS glitch filter*/ |
| 522 | cfg.s.fil_cnt = 7; |
| 523 | cfg.s.fil_sel = 3; |
| 524 | |
| 525 | cvmx_write_csr(CVMX_GPIO_BIT_CFGX(cd.s.bit - 16), cfg.u64); |
| 526 | } |
| 527 | |
| 528 | static void octeon_irq_ciu_enable_gpio_v2(struct irq_data *data) |
| 529 | { |
| 530 | octeon_irq_gpio_setup(data); |
| 531 | octeon_irq_ciu_enable_v2(data); |
| 532 | } |
| 533 | |
| 534 | static void octeon_irq_ciu_enable_gpio(struct irq_data *data) |
| 535 | { |
| 536 | octeon_irq_gpio_setup(data); |
| 537 | octeon_irq_ciu_enable(data); |
| 538 | } |
| 539 | |
| 540 | static int octeon_irq_ciu_gpio_set_type(struct irq_data *data, unsigned int t) |
| 541 | { |
| 542 | irqd_set_trigger_type(data, t); |
| 543 | octeon_irq_gpio_setup(data); |
| 544 | |
| 545 | return IRQ_SET_MASK_OK; |
| 546 | } |
| 547 | |
| 548 | static void octeon_irq_ciu_disable_gpio_v2(struct irq_data *data) |
| 549 | { |
| 550 | union octeon_ciu_chip_data cd; |
| 551 | |
| 552 | cd.p = irq_data_get_irq_chip_data(data); |
| 553 | cvmx_write_csr(CVMX_GPIO_BIT_CFGX(cd.s.bit - 16), 0); |
| 554 | |
| 555 | octeon_irq_ciu_disable_all_v2(data); |
| 556 | } |
| 557 | |
| 558 | static void octeon_irq_ciu_disable_gpio(struct irq_data *data) |
| 559 | { |
| 560 | union octeon_ciu_chip_data cd; |
| 561 | |
| 562 | cd.p = irq_data_get_irq_chip_data(data); |
| 563 | cvmx_write_csr(CVMX_GPIO_BIT_CFGX(cd.s.bit - 16), 0); |
| 564 | |
| 565 | octeon_irq_ciu_disable_all(data); |
| 566 | } |
| 567 | |
| 568 | static void octeon_irq_ciu_gpio_ack(struct irq_data *data) |
| 569 | { |
| 570 | union octeon_ciu_chip_data cd; |
| 571 | u64 mask; |
| 572 | |
| 573 | cd.p = irq_data_get_irq_chip_data(data); |
| 574 | mask = 1ull << (cd.s.bit - 16); |
| 575 | |
| 576 | cvmx_write_csr(CVMX_GPIO_INT_CLR, mask); |
| 577 | } |
| 578 | |
| 579 | static void octeon_irq_handle_gpio(unsigned int irq, struct irq_desc *desc) |
| 580 | { |
| 581 | if (irqd_get_trigger_type(irq_desc_get_irq_data(desc)) & IRQ_TYPE_EDGE_BOTH) |
| 582 | handle_edge_irq(irq, desc); |
| 583 | else |
| 584 | handle_level_irq(irq, desc); |
| 585 | } |
| 586 | |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 587 | #ifdef CONFIG_SMP |
| 588 | |
| 589 | static void octeon_irq_cpu_offline_ciu(struct irq_data *data) |
| 590 | { |
| 591 | int cpu = smp_processor_id(); |
| 592 | cpumask_t new_affinity; |
| 593 | |
| 594 | if (!cpumask_test_cpu(cpu, data->affinity)) |
| 595 | return; |
| 596 | |
| 597 | if (cpumask_weight(data->affinity) > 1) { |
| 598 | /* |
| 599 | * It has multi CPU affinity, just remove this CPU |
| 600 | * from the affinity set. |
| 601 | */ |
| 602 | cpumask_copy(&new_affinity, data->affinity); |
| 603 | cpumask_clear_cpu(cpu, &new_affinity); |
| 604 | } else { |
| 605 | /* Otherwise, put it on lowest numbered online CPU. */ |
| 606 | cpumask_clear(&new_affinity); |
| 607 | cpumask_set_cpu(cpumask_first(cpu_online_mask), &new_affinity); |
| 608 | } |
| 609 | __irq_set_affinity_locked(data, &new_affinity); |
| 610 | } |
| 611 | |
| 612 | static int octeon_irq_ciu_set_affinity(struct irq_data *data, |
| 613 | const struct cpumask *dest, bool force) |
| 614 | { |
| 615 | int cpu; |
Thomas Gleixner | 5b7cd6f | 2011-03-27 16:04:30 +0200 | [diff] [blame] | 616 | bool enable_one = !irqd_irq_disabled(data) && !irqd_irq_masked(data); |
David Daney | b6b74d5 | 2009-10-13 08:52:28 -0700 | [diff] [blame] | 617 | unsigned long flags; |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 618 | union octeon_ciu_chip_data cd; |
| 619 | |
| 620 | cd.p = data->chip_data; |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 621 | |
David Daney | 5aae1fd | 2010-07-23 10:43:46 -0700 | [diff] [blame] | 622 | /* |
| 623 | * For non-v2 CIU, we will allow only single CPU affinity. |
| 624 | * This removes the need to do locking in the .ack/.eoi |
| 625 | * functions. |
| 626 | */ |
| 627 | if (cpumask_weight(dest) != 1) |
| 628 | return -EINVAL; |
| 629 | |
Thomas Gleixner | 5b7cd6f | 2011-03-27 16:04:30 +0200 | [diff] [blame] | 630 | if (!enable_one) |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 631 | return 0; |
Yinghai Lu | d5dedd4 | 2009-04-27 17:59:21 -0700 | [diff] [blame] | 632 | |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 633 | if (cd.s.line == 0) { |
| 634 | raw_spin_lock_irqsave(&octeon_irq_ciu0_lock, flags); |
| 635 | for_each_online_cpu(cpu) { |
| 636 | int coreid = octeon_coreid_for_cpu(cpu); |
| 637 | unsigned long *pen = &per_cpu(octeon_irq_ciu0_en_mirror, cpu); |
| 638 | |
| 639 | if (cpumask_test_cpu(cpu, dest) && enable_one) { |
Thomas Gleixner | 5b7cd6f | 2011-03-27 16:04:30 +0200 | [diff] [blame] | 640 | enable_one = false; |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 641 | set_bit(cd.s.bit, pen); |
| 642 | } else { |
| 643 | clear_bit(cd.s.bit, pen); |
| 644 | } |
| 645 | cvmx_write_csr(CVMX_CIU_INTX_EN0(coreid * 2), *pen); |
| 646 | } |
| 647 | raw_spin_unlock_irqrestore(&octeon_irq_ciu0_lock, flags); |
| 648 | } else { |
| 649 | raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags); |
| 650 | for_each_online_cpu(cpu) { |
| 651 | int coreid = octeon_coreid_for_cpu(cpu); |
| 652 | unsigned long *pen = &per_cpu(octeon_irq_ciu1_en_mirror, cpu); |
| 653 | |
| 654 | if (cpumask_test_cpu(cpu, dest) && enable_one) { |
Thomas Gleixner | 5b7cd6f | 2011-03-27 16:04:30 +0200 | [diff] [blame] | 655 | enable_one = false; |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 656 | set_bit(cd.s.bit, pen); |
| 657 | } else { |
| 658 | clear_bit(cd.s.bit, pen); |
| 659 | } |
| 660 | cvmx_write_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1), *pen); |
| 661 | } |
| 662 | raw_spin_unlock_irqrestore(&octeon_irq_ciu1_lock, flags); |
| 663 | } |
Yinghai Lu | d5dedd4 | 2009-04-27 17:59:21 -0700 | [diff] [blame] | 664 | return 0; |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 665 | } |
David Daney | cd847b7 | 2009-10-13 11:26:03 -0700 | [diff] [blame] | 666 | |
| 667 | /* |
| 668 | * Set affinity for the irq for chips that have the EN*_W1{S,C} |
| 669 | * registers. |
| 670 | */ |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 671 | static int octeon_irq_ciu_set_affinity_v2(struct irq_data *data, |
| 672 | const struct cpumask *dest, |
| 673 | bool force) |
David Daney | cd847b7 | 2009-10-13 11:26:03 -0700 | [diff] [blame] | 674 | { |
| 675 | int cpu; |
Thomas Gleixner | 5b7cd6f | 2011-03-27 16:04:30 +0200 | [diff] [blame] | 676 | bool enable_one = !irqd_irq_disabled(data) && !irqd_irq_masked(data); |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 677 | u64 mask; |
| 678 | union octeon_ciu_chip_data cd; |
| 679 | |
Thomas Gleixner | 5b7cd6f | 2011-03-27 16:04:30 +0200 | [diff] [blame] | 680 | if (!enable_one) |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 681 | return 0; |
| 682 | |
| 683 | cd.p = data->chip_data; |
| 684 | mask = 1ull << cd.s.bit; |
| 685 | |
| 686 | if (cd.s.line == 0) { |
| 687 | for_each_online_cpu(cpu) { |
| 688 | unsigned long *pen = &per_cpu(octeon_irq_ciu0_en_mirror, cpu); |
| 689 | int index = octeon_coreid_for_cpu(cpu) * 2; |
| 690 | if (cpumask_test_cpu(cpu, dest) && enable_one) { |
Thomas Gleixner | 5b7cd6f | 2011-03-27 16:04:30 +0200 | [diff] [blame] | 691 | enable_one = false; |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 692 | set_bit(cd.s.bit, pen); |
| 693 | cvmx_write_csr(CVMX_CIU_INTX_EN0_W1S(index), mask); |
| 694 | } else { |
| 695 | clear_bit(cd.s.bit, pen); |
| 696 | cvmx_write_csr(CVMX_CIU_INTX_EN0_W1C(index), mask); |
| 697 | } |
| 698 | } |
| 699 | } else { |
| 700 | for_each_online_cpu(cpu) { |
| 701 | unsigned long *pen = &per_cpu(octeon_irq_ciu1_en_mirror, cpu); |
| 702 | int index = octeon_coreid_for_cpu(cpu) * 2 + 1; |
| 703 | if (cpumask_test_cpu(cpu, dest) && enable_one) { |
Thomas Gleixner | 5b7cd6f | 2011-03-27 16:04:30 +0200 | [diff] [blame] | 704 | enable_one = false; |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 705 | set_bit(cd.s.bit, pen); |
| 706 | cvmx_write_csr(CVMX_CIU_INTX_EN1_W1S(index), mask); |
| 707 | } else { |
| 708 | clear_bit(cd.s.bit, pen); |
| 709 | cvmx_write_csr(CVMX_CIU_INTX_EN1_W1C(index), mask); |
| 710 | } |
David Daney | 5aae1fd | 2010-07-23 10:43:46 -0700 | [diff] [blame] | 711 | } |
David Daney | cd847b7 | 2009-10-13 11:26:03 -0700 | [diff] [blame] | 712 | } |
| 713 | return 0; |
| 714 | } |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 715 | #endif |
| 716 | |
David Daney | cd847b7 | 2009-10-13 11:26:03 -0700 | [diff] [blame] | 717 | /* |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 718 | * The v1 CIU code already masks things, so supply a dummy version to |
| 719 | * the core chip code. |
| 720 | */ |
| 721 | static void octeon_irq_dummy_mask(struct irq_data *data) |
| 722 | { |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 723 | } |
| 724 | |
| 725 | /* |
David Daney | cd847b7 | 2009-10-13 11:26:03 -0700 | [diff] [blame] | 726 | * Newer octeon chips have support for lockless CIU operation. |
| 727 | */ |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 728 | static struct irq_chip octeon_irq_chip_ciu_v2 = { |
| 729 | .name = "CIU", |
| 730 | .irq_enable = octeon_irq_ciu_enable_v2, |
| 731 | .irq_disable = octeon_irq_ciu_disable_all_v2, |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 732 | .irq_ack = octeon_irq_ciu_ack, |
| 733 | .irq_mask = octeon_irq_ciu_disable_local_v2, |
| 734 | .irq_unmask = octeon_irq_ciu_enable_v2, |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 735 | #ifdef CONFIG_SMP |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 736 | .irq_set_affinity = octeon_irq_ciu_set_affinity_v2, |
| 737 | .irq_cpu_offline = octeon_irq_cpu_offline_ciu, |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 738 | #endif |
| 739 | }; |
| 740 | |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 741 | static struct irq_chip octeon_irq_chip_ciu = { |
| 742 | .name = "CIU", |
| 743 | .irq_enable = octeon_irq_ciu_enable, |
| 744 | .irq_disable = octeon_irq_ciu_disable_all, |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 745 | .irq_ack = octeon_irq_ciu_ack, |
David Daney | a339aef | 2012-07-05 18:12:38 +0200 | [diff] [blame^] | 746 | .irq_mask = octeon_irq_dummy_mask, |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 747 | #ifdef CONFIG_SMP |
| 748 | .irq_set_affinity = octeon_irq_ciu_set_affinity, |
| 749 | .irq_cpu_offline = octeon_irq_cpu_offline_ciu, |
| 750 | #endif |
David Daney | 5aae1fd | 2010-07-23 10:43:46 -0700 | [diff] [blame] | 751 | }; |
| 752 | |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 753 | /* The mbox versions don't do any affinity or round-robin. */ |
| 754 | static struct irq_chip octeon_irq_chip_ciu_mbox_v2 = { |
| 755 | .name = "CIU-M", |
| 756 | .irq_enable = octeon_irq_ciu_enable_all_v2, |
| 757 | .irq_disable = octeon_irq_ciu_disable_all_v2, |
| 758 | .irq_ack = octeon_irq_ciu_disable_local_v2, |
| 759 | .irq_eoi = octeon_irq_ciu_enable_local_v2, |
| 760 | |
Thomas Gleixner | 5b7cd6f | 2011-03-27 16:04:30 +0200 | [diff] [blame] | 761 | .irq_cpu_online = octeon_irq_ciu_enable_local_v2, |
| 762 | .irq_cpu_offline = octeon_irq_ciu_disable_local_v2, |
| 763 | .flags = IRQCHIP_ONOFFLINE_ENABLED, |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 764 | }; |
| 765 | |
| 766 | static struct irq_chip octeon_irq_chip_ciu_mbox = { |
| 767 | .name = "CIU-M", |
| 768 | .irq_enable = octeon_irq_ciu_enable_all, |
| 769 | .irq_disable = octeon_irq_ciu_disable_all, |
| 770 | |
Thomas Gleixner | 5b7cd6f | 2011-03-27 16:04:30 +0200 | [diff] [blame] | 771 | .irq_cpu_online = octeon_irq_ciu_enable_local, |
| 772 | .irq_cpu_offline = octeon_irq_ciu_disable_local, |
| 773 | .flags = IRQCHIP_ONOFFLINE_ENABLED, |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 774 | }; |
| 775 | |
David Daney | 6d1ab4c | 2012-07-05 18:12:37 +0200 | [diff] [blame] | 776 | static struct irq_chip octeon_irq_chip_ciu_gpio_v2 = { |
| 777 | .name = "CIU-GPIO", |
| 778 | .irq_enable = octeon_irq_ciu_enable_gpio_v2, |
| 779 | .irq_disable = octeon_irq_ciu_disable_gpio_v2, |
| 780 | .irq_ack = octeon_irq_ciu_gpio_ack, |
| 781 | .irq_mask = octeon_irq_ciu_disable_local_v2, |
| 782 | .irq_unmask = octeon_irq_ciu_enable_v2, |
| 783 | .irq_set_type = octeon_irq_ciu_gpio_set_type, |
| 784 | #ifdef CONFIG_SMP |
| 785 | .irq_set_affinity = octeon_irq_ciu_set_affinity_v2, |
| 786 | #endif |
| 787 | .flags = IRQCHIP_SET_TYPE_MASKED, |
| 788 | }; |
| 789 | |
| 790 | static struct irq_chip octeon_irq_chip_ciu_gpio = { |
| 791 | .name = "CIU-GPIO", |
| 792 | .irq_enable = octeon_irq_ciu_enable_gpio, |
| 793 | .irq_disable = octeon_irq_ciu_disable_gpio, |
| 794 | .irq_mask = octeon_irq_dummy_mask, |
| 795 | .irq_ack = octeon_irq_ciu_gpio_ack, |
| 796 | .irq_set_type = octeon_irq_ciu_gpio_set_type, |
| 797 | #ifdef CONFIG_SMP |
| 798 | .irq_set_affinity = octeon_irq_ciu_set_affinity, |
| 799 | #endif |
| 800 | .flags = IRQCHIP_SET_TYPE_MASKED, |
| 801 | }; |
| 802 | |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 803 | /* |
| 804 | * Watchdog interrupts are special. They are associated with a single |
| 805 | * core, so we hardwire the affinity to that core. |
| 806 | */ |
| 807 | static void octeon_irq_ciu_wd_enable(struct irq_data *data) |
| 808 | { |
| 809 | unsigned long flags; |
| 810 | unsigned long *pen; |
| 811 | int coreid = data->irq - OCTEON_IRQ_WDOG0; /* Bit 0-63 of EN1 */ |
| 812 | int cpu = octeon_cpu_for_coreid(coreid); |
| 813 | |
| 814 | raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags); |
| 815 | pen = &per_cpu(octeon_irq_ciu1_en_mirror, cpu); |
| 816 | set_bit(coreid, pen); |
| 817 | cvmx_write_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1), *pen); |
| 818 | raw_spin_unlock_irqrestore(&octeon_irq_ciu1_lock, flags); |
| 819 | } |
| 820 | |
| 821 | /* |
| 822 | * Watchdog interrupts are special. They are associated with a single |
| 823 | * core, so we hardwire the affinity to that core. |
| 824 | */ |
| 825 | static void octeon_irq_ciu1_wd_enable_v2(struct irq_data *data) |
| 826 | { |
| 827 | int coreid = data->irq - OCTEON_IRQ_WDOG0; |
| 828 | int cpu = octeon_cpu_for_coreid(coreid); |
| 829 | |
| 830 | set_bit(coreid, &per_cpu(octeon_irq_ciu1_en_mirror, cpu)); |
| 831 | cvmx_write_csr(CVMX_CIU_INTX_EN1_W1S(coreid * 2 + 1), 1ull << coreid); |
| 832 | } |
| 833 | |
| 834 | |
| 835 | static struct irq_chip octeon_irq_chip_ciu_wd_v2 = { |
| 836 | .name = "CIU-W", |
| 837 | .irq_enable = octeon_irq_ciu1_wd_enable_v2, |
| 838 | .irq_disable = octeon_irq_ciu_disable_all_v2, |
| 839 | .irq_mask = octeon_irq_ciu_disable_local_v2, |
| 840 | .irq_unmask = octeon_irq_ciu_enable_local_v2, |
| 841 | }; |
| 842 | |
| 843 | static struct irq_chip octeon_irq_chip_ciu_wd = { |
| 844 | .name = "CIU-W", |
| 845 | .irq_enable = octeon_irq_ciu_wd_enable, |
| 846 | .irq_disable = octeon_irq_ciu_disable_all, |
| 847 | .irq_mask = octeon_irq_dummy_mask, |
| 848 | }; |
| 849 | |
| 850 | static void octeon_irq_ip2_v1(void) |
| 851 | { |
| 852 | const unsigned long core_id = cvmx_get_core_num(); |
| 853 | u64 ciu_sum = cvmx_read_csr(CVMX_CIU_INTX_SUM0(core_id * 2)); |
| 854 | |
| 855 | ciu_sum &= __get_cpu_var(octeon_irq_ciu0_en_mirror); |
| 856 | clear_c0_status(STATUSF_IP2); |
| 857 | if (likely(ciu_sum)) { |
| 858 | int bit = fls64(ciu_sum) - 1; |
| 859 | int irq = octeon_irq_ciu_to_irq[0][bit]; |
| 860 | if (likely(irq)) |
| 861 | do_IRQ(irq); |
| 862 | else |
| 863 | spurious_interrupt(); |
| 864 | } else { |
| 865 | spurious_interrupt(); |
| 866 | } |
| 867 | set_c0_status(STATUSF_IP2); |
| 868 | } |
| 869 | |
| 870 | static void octeon_irq_ip2_v2(void) |
| 871 | { |
| 872 | const unsigned long core_id = cvmx_get_core_num(); |
| 873 | u64 ciu_sum = cvmx_read_csr(CVMX_CIU_INTX_SUM0(core_id * 2)); |
| 874 | |
| 875 | ciu_sum &= __get_cpu_var(octeon_irq_ciu0_en_mirror); |
| 876 | if (likely(ciu_sum)) { |
| 877 | int bit = fls64(ciu_sum) - 1; |
| 878 | int irq = octeon_irq_ciu_to_irq[0][bit]; |
| 879 | if (likely(irq)) |
| 880 | do_IRQ(irq); |
| 881 | else |
| 882 | spurious_interrupt(); |
| 883 | } else { |
| 884 | spurious_interrupt(); |
| 885 | } |
| 886 | } |
| 887 | static void octeon_irq_ip3_v1(void) |
| 888 | { |
| 889 | u64 ciu_sum = cvmx_read_csr(CVMX_CIU_INT_SUM1); |
| 890 | |
| 891 | ciu_sum &= __get_cpu_var(octeon_irq_ciu1_en_mirror); |
| 892 | clear_c0_status(STATUSF_IP3); |
| 893 | if (likely(ciu_sum)) { |
| 894 | int bit = fls64(ciu_sum) - 1; |
| 895 | int irq = octeon_irq_ciu_to_irq[1][bit]; |
| 896 | if (likely(irq)) |
| 897 | do_IRQ(irq); |
| 898 | else |
| 899 | spurious_interrupt(); |
| 900 | } else { |
| 901 | spurious_interrupt(); |
| 902 | } |
| 903 | set_c0_status(STATUSF_IP3); |
| 904 | } |
| 905 | |
| 906 | static void octeon_irq_ip3_v2(void) |
| 907 | { |
| 908 | u64 ciu_sum = cvmx_read_csr(CVMX_CIU_INT_SUM1); |
| 909 | |
| 910 | ciu_sum &= __get_cpu_var(octeon_irq_ciu1_en_mirror); |
| 911 | if (likely(ciu_sum)) { |
| 912 | int bit = fls64(ciu_sum) - 1; |
| 913 | int irq = octeon_irq_ciu_to_irq[1][bit]; |
| 914 | if (likely(irq)) |
| 915 | do_IRQ(irq); |
| 916 | else |
| 917 | spurious_interrupt(); |
| 918 | } else { |
| 919 | spurious_interrupt(); |
| 920 | } |
| 921 | } |
| 922 | |
| 923 | static void octeon_irq_ip4_mask(void) |
| 924 | { |
| 925 | clear_c0_status(STATUSF_IP4); |
| 926 | spurious_interrupt(); |
| 927 | } |
| 928 | |
| 929 | static void (*octeon_irq_ip2)(void); |
| 930 | static void (*octeon_irq_ip3)(void); |
| 931 | static void (*octeon_irq_ip4)(void); |
| 932 | |
| 933 | void __cpuinitdata (*octeon_irq_setup_secondary)(void); |
| 934 | |
| 935 | static void __cpuinit octeon_irq_percpu_enable(void) |
| 936 | { |
| 937 | irq_cpu_online(); |
| 938 | } |
| 939 | |
| 940 | static void __cpuinit octeon_irq_init_ciu_percpu(void) |
| 941 | { |
| 942 | int coreid = cvmx_get_core_num(); |
| 943 | /* |
| 944 | * Disable All CIU Interrupts. The ones we need will be |
| 945 | * enabled later. Read the SUM register so we know the write |
| 946 | * completed. |
| 947 | */ |
| 948 | cvmx_write_csr(CVMX_CIU_INTX_EN0((coreid * 2)), 0); |
| 949 | cvmx_write_csr(CVMX_CIU_INTX_EN0((coreid * 2 + 1)), 0); |
| 950 | cvmx_write_csr(CVMX_CIU_INTX_EN1((coreid * 2)), 0); |
| 951 | cvmx_write_csr(CVMX_CIU_INTX_EN1((coreid * 2 + 1)), 0); |
| 952 | cvmx_read_csr(CVMX_CIU_INTX_SUM0((coreid * 2))); |
| 953 | } |
| 954 | |
| 955 | static void __cpuinit octeon_irq_setup_secondary_ciu(void) |
| 956 | { |
| 957 | |
| 958 | __get_cpu_var(octeon_irq_ciu0_en_mirror) = 0; |
| 959 | __get_cpu_var(octeon_irq_ciu1_en_mirror) = 0; |
| 960 | |
| 961 | octeon_irq_init_ciu_percpu(); |
| 962 | octeon_irq_percpu_enable(); |
| 963 | |
| 964 | /* Enable the CIU lines */ |
| 965 | set_c0_status(STATUSF_IP3 | STATUSF_IP2); |
| 966 | clear_c0_status(STATUSF_IP4); |
| 967 | } |
| 968 | |
| 969 | static void __init octeon_irq_init_ciu(void) |
| 970 | { |
| 971 | unsigned int i; |
| 972 | struct irq_chip *chip; |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 973 | struct irq_chip *chip_mbox; |
| 974 | struct irq_chip *chip_wd; |
David Daney | 6d1ab4c | 2012-07-05 18:12:37 +0200 | [diff] [blame] | 975 | struct irq_chip *chip_gpio; |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 976 | |
| 977 | octeon_irq_init_ciu_percpu(); |
| 978 | octeon_irq_setup_secondary = octeon_irq_setup_secondary_ciu; |
| 979 | |
| 980 | if (OCTEON_IS_MODEL(OCTEON_CN58XX_PASS2_X) || |
| 981 | OCTEON_IS_MODEL(OCTEON_CN56XX_PASS2_X) || |
| 982 | OCTEON_IS_MODEL(OCTEON_CN52XX_PASS2_X) || |
| 983 | OCTEON_IS_MODEL(OCTEON_CN6XXX)) { |
| 984 | octeon_irq_ip2 = octeon_irq_ip2_v2; |
| 985 | octeon_irq_ip3 = octeon_irq_ip3_v2; |
| 986 | chip = &octeon_irq_chip_ciu_v2; |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 987 | chip_mbox = &octeon_irq_chip_ciu_mbox_v2; |
| 988 | chip_wd = &octeon_irq_chip_ciu_wd_v2; |
David Daney | 6d1ab4c | 2012-07-05 18:12:37 +0200 | [diff] [blame] | 989 | chip_gpio = &octeon_irq_chip_ciu_gpio_v2; |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 990 | } else { |
| 991 | octeon_irq_ip2 = octeon_irq_ip2_v1; |
| 992 | octeon_irq_ip3 = octeon_irq_ip3_v1; |
| 993 | chip = &octeon_irq_chip_ciu; |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 994 | chip_mbox = &octeon_irq_chip_ciu_mbox; |
| 995 | chip_wd = &octeon_irq_chip_ciu_wd; |
David Daney | 6d1ab4c | 2012-07-05 18:12:37 +0200 | [diff] [blame] | 996 | chip_gpio = &octeon_irq_chip_ciu_gpio; |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 997 | } |
| 998 | octeon_irq_ip4 = octeon_irq_ip4_mask; |
| 999 | |
| 1000 | /* Mips internal */ |
| 1001 | octeon_irq_init_core(); |
| 1002 | |
| 1003 | /* CIU_0 */ |
| 1004 | for (i = 0; i < 16; i++) |
| 1005 | octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_WORKQ0, 0, i + 0, chip, handle_level_irq); |
| 1006 | for (i = 0; i < 16; i++) |
David Daney | 6d1ab4c | 2012-07-05 18:12:37 +0200 | [diff] [blame] | 1007 | octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_GPIO0, 0, i + 16, chip_gpio, octeon_irq_handle_gpio); |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 1008 | |
| 1009 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_MBOX0, 0, 32, chip_mbox, handle_percpu_irq); |
| 1010 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_MBOX1, 0, 33, chip_mbox, handle_percpu_irq); |
| 1011 | |
| 1012 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_UART0, 0, 34, chip, handle_level_irq); |
| 1013 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_UART1, 0, 35, chip, handle_level_irq); |
| 1014 | |
| 1015 | for (i = 0; i < 4; i++) |
| 1016 | octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_PCI_INT0, 0, i + 36, chip, handle_level_irq); |
| 1017 | for (i = 0; i < 4; i++) |
| 1018 | octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_PCI_MSI0, 0, i + 40, chip, handle_level_irq); |
| 1019 | |
| 1020 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_TWSI, 0, 45, chip, handle_level_irq); |
| 1021 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_RML, 0, 46, chip, handle_level_irq); |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 1022 | for (i = 0; i < 4; i++) |
David Daney | a339aef | 2012-07-05 18:12:38 +0200 | [diff] [blame^] | 1023 | octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_TIMER0, 0, i + 52, chip, handle_edge_irq); |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 1024 | |
| 1025 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_USB0, 0, 56, chip, handle_level_irq); |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 1026 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_TWSI2, 0, 59, chip, handle_level_irq); |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 1027 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_MII0, 0, 62, chip, handle_level_irq); |
| 1028 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_BOOTDMA, 0, 63, chip, handle_level_irq); |
| 1029 | |
| 1030 | /* CIU_1 */ |
| 1031 | for (i = 0; i < 16; i++) |
| 1032 | octeon_irq_set_ciu_mapping(i + OCTEON_IRQ_WDOG0, 1, i + 0, chip_wd, handle_level_irq); |
| 1033 | |
| 1034 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_UART2, 1, 16, chip, handle_level_irq); |
| 1035 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_USB1, 1, 17, chip, handle_level_irq); |
| 1036 | octeon_irq_set_ciu_mapping(OCTEON_IRQ_MII1, 1, 18, chip, handle_level_irq); |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 1037 | |
| 1038 | /* Enable the CIU lines */ |
| 1039 | set_c0_status(STATUSF_IP3 | STATUSF_IP2); |
| 1040 | clear_c0_status(STATUSF_IP4); |
| 1041 | } |
David Daney | 5aae1fd | 2010-07-23 10:43:46 -0700 | [diff] [blame] | 1042 | |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 1043 | void __init arch_init_irq(void) |
| 1044 | { |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 1045 | #ifdef CONFIG_SMP |
| 1046 | /* Set the default affinity to the boot cpu. */ |
| 1047 | cpumask_clear(irq_default_affinity); |
| 1048 | cpumask_set_cpu(smp_processor_id(), irq_default_affinity); |
| 1049 | #endif |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 1050 | octeon_irq_init_ciu(); |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 1051 | } |
| 1052 | |
| 1053 | asmlinkage void plat_irq_dispatch(void) |
| 1054 | { |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 1055 | unsigned long cop0_cause; |
| 1056 | unsigned long cop0_status; |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 1057 | |
| 1058 | while (1) { |
| 1059 | cop0_cause = read_c0_cause(); |
| 1060 | cop0_status = read_c0_status(); |
| 1061 | cop0_cause &= cop0_status; |
| 1062 | cop0_cause &= ST0_IM; |
| 1063 | |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 1064 | if (unlikely(cop0_cause & STATUSF_IP2)) |
| 1065 | octeon_irq_ip2(); |
| 1066 | else if (unlikely(cop0_cause & STATUSF_IP3)) |
| 1067 | octeon_irq_ip3(); |
| 1068 | else if (unlikely(cop0_cause & STATUSF_IP4)) |
| 1069 | octeon_irq_ip4(); |
| 1070 | else if (likely(cop0_cause)) |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 1071 | do_IRQ(fls(cop0_cause) - 9 + MIPS_CPU_IRQ_BASE); |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 1072 | else |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 1073 | break; |
David Daney | 5b3b168 | 2009-01-08 16:46:40 -0800 | [diff] [blame] | 1074 | } |
| 1075 | } |
Ralf Baechle | 773cb77 | 2009-06-23 10:36:38 +0100 | [diff] [blame] | 1076 | |
| 1077 | #ifdef CONFIG_HOTPLUG_CPU |
Ralf Baechle | 773cb77 | 2009-06-23 10:36:38 +0100 | [diff] [blame] | 1078 | |
| 1079 | void fixup_irqs(void) |
| 1080 | { |
David Daney | 0c32638 | 2011-03-25 12:38:51 -0700 | [diff] [blame] | 1081 | irq_cpu_offline(); |
Ralf Baechle | 773cb77 | 2009-06-23 10:36:38 +0100 | [diff] [blame] | 1082 | } |
| 1083 | |
| 1084 | #endif /* CONFIG_HOTPLUG_CPU */ |