Konrad Eisele | 5213a78 | 2009-08-17 00:13:29 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2009 Daniel Hellstrom (daniel@gaisler.com) Aeroflex Gaisler AB |
| 3 | * Copyright (C) 2009 Konrad Eisele (konrad@gaisler.com) Aeroflex Gaisler AB |
| 4 | */ |
| 5 | |
| 6 | #include <linux/kernel.h> |
| 7 | #include <linux/module.h> |
| 8 | #include <linux/errno.h> |
| 9 | #include <linux/mutex.h> |
Konrad Eisele | 5213a78 | 2009-08-17 00:13:29 +0000 | [diff] [blame] | 10 | #include <linux/of.h> |
| 11 | #include <linux/of_platform.h> |
| 12 | #include <linux/interrupt.h> |
| 13 | #include <linux/of_device.h> |
Konrad Eisele | 8401707 | 2009-08-31 22:08:13 +0000 | [diff] [blame] | 14 | |
Konrad Eisele | 5213a78 | 2009-08-17 00:13:29 +0000 | [diff] [blame] | 15 | #include <asm/oplib.h> |
| 16 | #include <asm/timer.h> |
| 17 | #include <asm/prom.h> |
| 18 | #include <asm/leon.h> |
| 19 | #include <asm/leon_amba.h> |
Konrad Eisele | 8401707 | 2009-08-31 22:08:13 +0000 | [diff] [blame] | 20 | #include <asm/traps.h> |
| 21 | #include <asm/cacheflush.h> |
Konrad Eisele | 5213a78 | 2009-08-17 00:13:29 +0000 | [diff] [blame] | 22 | |
| 23 | #include "prom.h" |
| 24 | #include "irq.h" |
| 25 | |
Daniel Hellstrom | 53aea7c | 2011-01-04 01:41:29 +0000 | [diff] [blame] | 26 | struct leon3_irqctrl_regs_map *leon3_irqctrl_regs; /* interrupt controller base address */ |
| 27 | struct leon3_gptimer_regs_map *leon3_gptimer_regs; /* timer controller base address */ |
Konrad Eisele | 5213a78 | 2009-08-17 00:13:29 +0000 | [diff] [blame] | 28 | struct amba_apb_device leon_percpu_timer_dev[16]; |
| 29 | |
| 30 | int leondebug_irq_disable; |
| 31 | int leon_debug_irqout; |
| 32 | static int dummy_master_l10_counter; |
Daniel Hellstrom | 7279b82 | 2011-01-27 01:26:58 +0000 | [diff] [blame] | 33 | unsigned long amba_system_id; |
Konrad Eisele | 5213a78 | 2009-08-17 00:13:29 +0000 | [diff] [blame] | 34 | |
Daniel Hellstrom | 53aea7c | 2011-01-04 01:41:29 +0000 | [diff] [blame] | 35 | unsigned long leon3_gptimer_irq; /* interrupt controller irq number */ |
Daniel Hellstrom | 2791c1a | 2011-01-04 01:41:32 +0000 | [diff] [blame] | 36 | unsigned long leon3_gptimer_idx; /* Timer Index (0..6) within Timer Core */ |
Konrad Eisele | 5213a78 | 2009-08-17 00:13:29 +0000 | [diff] [blame] | 37 | unsigned int sparc_leon_eirq; |
| 38 | #define LEON_IMASK ((&leon3_irqctrl_regs->mask[0])) |
| 39 | |
| 40 | /* Return the IRQ of the pending IRQ on the extended IRQ controller */ |
| 41 | int sparc_leon_eirq_get(int eirq, int cpu) |
| 42 | { |
| 43 | return LEON3_BYPASS_LOAD_PA(&leon3_irqctrl_regs->intid[cpu]) & 0x1f; |
| 44 | } |
| 45 | |
| 46 | irqreturn_t sparc_leon_eirq_isr(int dummy, void *dev_id) |
| 47 | { |
| 48 | printk(KERN_ERR "sparc_leon_eirq_isr: ERROR EXTENDED IRQ\n"); |
| 49 | return IRQ_HANDLED; |
| 50 | } |
| 51 | |
| 52 | /* The extended IRQ controller has been found, this function registers it */ |
| 53 | void sparc_leon_eirq_register(int eirq) |
| 54 | { |
| 55 | int irq; |
| 56 | |
| 57 | /* Register a "BAD" handler for this interrupt, it should never happen */ |
| 58 | irq = request_irq(eirq, sparc_leon_eirq_isr, |
| 59 | (IRQF_DISABLED | SA_STATIC_ALLOC), "extirq", NULL); |
| 60 | |
| 61 | if (irq) { |
| 62 | printk(KERN_ERR |
| 63 | "sparc_leon_eirq_register: unable to attach IRQ%d\n", |
| 64 | eirq); |
| 65 | } else { |
| 66 | sparc_leon_eirq = eirq; |
| 67 | } |
| 68 | |
| 69 | } |
| 70 | |
| 71 | static inline unsigned long get_irqmask(unsigned int irq) |
| 72 | { |
| 73 | unsigned long mask; |
| 74 | |
| 75 | if (!irq || ((irq > 0xf) && !sparc_leon_eirq) |
| 76 | || ((irq > 0x1f) && sparc_leon_eirq)) { |
| 77 | printk(KERN_ERR |
| 78 | "leon_get_irqmask: false irq number: %d\n", irq); |
| 79 | mask = 0; |
| 80 | } else { |
| 81 | mask = LEON_HARD_INT(irq); |
| 82 | } |
| 83 | return mask; |
| 84 | } |
| 85 | |
Sam Ravnborg | 6baa9b2 | 2011-04-18 11:25:44 +0000 | [diff] [blame^] | 86 | static void leon_unmask_irq(struct irq_data *data) |
Konrad Eisele | 5213a78 | 2009-08-17 00:13:29 +0000 | [diff] [blame] | 87 | { |
| 88 | unsigned long mask, flags; |
Sam Ravnborg | 6baa9b2 | 2011-04-18 11:25:44 +0000 | [diff] [blame^] | 89 | |
| 90 | mask = (unsigned long)data->chip_data; |
Konrad Eisele | 5213a78 | 2009-08-17 00:13:29 +0000 | [diff] [blame] | 91 | local_irq_save(flags); |
| 92 | LEON3_BYPASS_STORE_PA(LEON_IMASK, |
| 93 | (LEON3_BYPASS_LOAD_PA(LEON_IMASK) | (mask))); |
| 94 | local_irq_restore(flags); |
| 95 | } |
| 96 | |
Sam Ravnborg | 6baa9b2 | 2011-04-18 11:25:44 +0000 | [diff] [blame^] | 97 | static void leon_mask_irq(struct irq_data *data) |
Konrad Eisele | 5213a78 | 2009-08-17 00:13:29 +0000 | [diff] [blame] | 98 | { |
| 99 | unsigned long mask, flags; |
Sam Ravnborg | 6baa9b2 | 2011-04-18 11:25:44 +0000 | [diff] [blame^] | 100 | |
| 101 | mask = (unsigned long)data->chip_data; |
Konrad Eisele | 5213a78 | 2009-08-17 00:13:29 +0000 | [diff] [blame] | 102 | local_irq_save(flags); |
| 103 | LEON3_BYPASS_STORE_PA(LEON_IMASK, |
| 104 | (LEON3_BYPASS_LOAD_PA(LEON_IMASK) & ~(mask))); |
| 105 | local_irq_restore(flags); |
| 106 | |
| 107 | } |
| 108 | |
Sam Ravnborg | 6baa9b2 | 2011-04-18 11:25:44 +0000 | [diff] [blame^] | 109 | static unsigned int leon_startup_irq(struct irq_data *data) |
| 110 | { |
| 111 | irq_link(data->irq); |
| 112 | leon_unmask_irq(data); |
| 113 | return 0; |
| 114 | } |
| 115 | |
| 116 | static void leon_shutdown_irq(struct irq_data *data) |
| 117 | { |
| 118 | leon_mask_irq(data); |
| 119 | irq_unlink(data->irq); |
| 120 | } |
| 121 | |
| 122 | static struct irq_chip leon_irq = { |
| 123 | .name = "leon", |
| 124 | .irq_startup = leon_startup_irq, |
| 125 | .irq_shutdown = leon_shutdown_irq, |
| 126 | .irq_mask = leon_mask_irq, |
| 127 | .irq_unmask = leon_unmask_irq, |
| 128 | }; |
| 129 | |
| 130 | static unsigned int leon_build_device_irq(struct platform_device *op, |
| 131 | unsigned int real_irq) |
| 132 | { |
| 133 | unsigned int irq; |
| 134 | unsigned long mask; |
| 135 | |
| 136 | irq = 0; |
| 137 | mask = get_irqmask(real_irq); |
| 138 | if (mask == 0) |
| 139 | goto out; |
| 140 | |
| 141 | irq = irq_alloc(real_irq, real_irq); |
| 142 | if (irq == 0) |
| 143 | goto out; |
| 144 | |
| 145 | irq_set_chip_and_handler_name(irq, &leon_irq, |
| 146 | handle_simple_irq, "edge"); |
| 147 | irq_set_chip_data(irq, (void *)mask); |
| 148 | |
| 149 | out: |
| 150 | return irq; |
| 151 | } |
| 152 | |
Konrad Eisele | 5213a78 | 2009-08-17 00:13:29 +0000 | [diff] [blame] | 153 | void __init leon_init_timers(irq_handler_t counter_fn) |
| 154 | { |
| 155 | int irq; |
Daniel Hellstrom | 2791c1a | 2011-01-04 01:41:32 +0000 | [diff] [blame] | 156 | struct device_node *rootnp, *np, *nnp; |
Daniel Hellstrom | 53aea7c | 2011-01-04 01:41:29 +0000 | [diff] [blame] | 157 | struct property *pp; |
| 158 | int len; |
Daniel Hellstrom | e2305e3 | 2011-01-04 01:41:30 +0000 | [diff] [blame] | 159 | int cpu, icsel; |
Daniel Hellstrom | 2791c1a | 2011-01-04 01:41:32 +0000 | [diff] [blame] | 160 | int ampopts; |
Sam Ravnborg | 6baa9b2 | 2011-04-18 11:25:44 +0000 | [diff] [blame^] | 161 | int err; |
Konrad Eisele | 5213a78 | 2009-08-17 00:13:29 +0000 | [diff] [blame] | 162 | |
| 163 | leondebug_irq_disable = 0; |
| 164 | leon_debug_irqout = 0; |
| 165 | master_l10_counter = (unsigned int *)&dummy_master_l10_counter; |
| 166 | dummy_master_l10_counter = 0; |
| 167 | |
Daniel Hellstrom | 53aea7c | 2011-01-04 01:41:29 +0000 | [diff] [blame] | 168 | rootnp = of_find_node_by_path("/ambapp0"); |
| 169 | if (!rootnp) |
| 170 | goto bad; |
Daniel Hellstrom | 7279b82 | 2011-01-27 01:26:58 +0000 | [diff] [blame] | 171 | |
| 172 | /* Find System ID: GRLIB build ID and optional CHIP ID */ |
| 173 | pp = of_find_property(rootnp, "systemid", &len); |
| 174 | if (pp) |
| 175 | amba_system_id = *(unsigned long *)pp->value; |
| 176 | |
| 177 | /* Find IRQMP IRQ Controller Registers base adr otherwise bail out */ |
Daniel Hellstrom | 53aea7c | 2011-01-04 01:41:29 +0000 | [diff] [blame] | 178 | np = of_find_node_by_name(rootnp, "GAISLER_IRQMP"); |
Daniel Hellstrom | 9742e72 | 2011-01-04 01:41:31 +0000 | [diff] [blame] | 179 | if (!np) { |
| 180 | np = of_find_node_by_name(rootnp, "01_00d"); |
| 181 | if (!np) |
| 182 | goto bad; |
| 183 | } |
Daniel Hellstrom | 53aea7c | 2011-01-04 01:41:29 +0000 | [diff] [blame] | 184 | pp = of_find_property(np, "reg", &len); |
| 185 | if (!pp) |
| 186 | goto bad; |
| 187 | leon3_irqctrl_regs = *(struct leon3_irqctrl_regs_map **)pp->value; |
| 188 | |
| 189 | /* Find GPTIMER Timer Registers base address otherwise bail out. */ |
Daniel Hellstrom | 2791c1a | 2011-01-04 01:41:32 +0000 | [diff] [blame] | 190 | nnp = rootnp; |
| 191 | do { |
| 192 | np = of_find_node_by_name(nnp, "GAISLER_GPTIMER"); |
| 193 | if (!np) { |
| 194 | np = of_find_node_by_name(nnp, "01_011"); |
| 195 | if (!np) |
| 196 | goto bad; |
| 197 | } |
| 198 | |
| 199 | ampopts = 0; |
| 200 | pp = of_find_property(np, "ampopts", &len); |
| 201 | if (pp) { |
| 202 | ampopts = *(int *)pp->value; |
| 203 | if (ampopts == 0) { |
| 204 | /* Skip this instance, resource already |
| 205 | * allocated by other OS */ |
| 206 | nnp = np; |
| 207 | continue; |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | /* Select Timer-Instance on Timer Core. Default is zero */ |
| 212 | leon3_gptimer_idx = ampopts & 0x7; |
| 213 | |
| 214 | pp = of_find_property(np, "reg", &len); |
| 215 | if (pp) |
| 216 | leon3_gptimer_regs = *(struct leon3_gptimer_regs_map **) |
| 217 | pp->value; |
| 218 | pp = of_find_property(np, "interrupts", &len); |
| 219 | if (pp) |
| 220 | leon3_gptimer_irq = *(unsigned int *)pp->value; |
| 221 | } while (0); |
Daniel Hellstrom | 53aea7c | 2011-01-04 01:41:29 +0000 | [diff] [blame] | 222 | |
| 223 | if (leon3_gptimer_regs && leon3_irqctrl_regs && leon3_gptimer_irq) { |
Daniel Hellstrom | 2791c1a | 2011-01-04 01:41:32 +0000 | [diff] [blame] | 224 | LEON3_BYPASS_STORE_PA( |
| 225 | &leon3_gptimer_regs->e[leon3_gptimer_idx].val, 0); |
| 226 | LEON3_BYPASS_STORE_PA( |
| 227 | &leon3_gptimer_regs->e[leon3_gptimer_idx].rld, |
| 228 | (((1000000 / HZ) - 1))); |
| 229 | LEON3_BYPASS_STORE_PA( |
| 230 | &leon3_gptimer_regs->e[leon3_gptimer_idx].ctrl, 0); |
Konrad Eisele | 5213a78 | 2009-08-17 00:13:29 +0000 | [diff] [blame] | 231 | |
Konrad Eisele | 8401707 | 2009-08-31 22:08:13 +0000 | [diff] [blame] | 232 | #ifdef CONFIG_SMP |
| 233 | leon_percpu_timer_dev[0].start = (int)leon3_gptimer_regs; |
Daniel Hellstrom | 2791c1a | 2011-01-04 01:41:32 +0000 | [diff] [blame] | 234 | leon_percpu_timer_dev[0].irq = leon3_gptimer_irq + 1 + |
| 235 | leon3_gptimer_idx; |
Konrad Eisele | 8401707 | 2009-08-31 22:08:13 +0000 | [diff] [blame] | 236 | |
| 237 | if (!(LEON3_BYPASS_LOAD_PA(&leon3_gptimer_regs->config) & |
| 238 | (1<<LEON3_GPTIMER_SEPIRQ))) { |
Frans Pop | 0da2b30 | 2010-02-12 12:08:51 -0800 | [diff] [blame] | 239 | prom_printf("irq timer not configured with separate irqs\n"); |
Konrad Eisele | 8401707 | 2009-08-31 22:08:13 +0000 | [diff] [blame] | 240 | BUG(); |
| 241 | } |
| 242 | |
Daniel Hellstrom | 2791c1a | 2011-01-04 01:41:32 +0000 | [diff] [blame] | 243 | LEON3_BYPASS_STORE_PA( |
| 244 | &leon3_gptimer_regs->e[leon3_gptimer_idx+1].val, 0); |
| 245 | LEON3_BYPASS_STORE_PA( |
| 246 | &leon3_gptimer_regs->e[leon3_gptimer_idx+1].rld, |
| 247 | (((1000000/HZ) - 1))); |
| 248 | LEON3_BYPASS_STORE_PA( |
| 249 | &leon3_gptimer_regs->e[leon3_gptimer_idx+1].ctrl, 0); |
Konrad Eisele | 8401707 | 2009-08-31 22:08:13 +0000 | [diff] [blame] | 250 | # endif |
| 251 | |
Daniel Hellstrom | e2305e3 | 2011-01-04 01:41:30 +0000 | [diff] [blame] | 252 | /* |
| 253 | * The IRQ controller may (if implemented) consist of multiple |
| 254 | * IRQ controllers, each mapped on a 4Kb boundary. |
| 255 | * Each CPU may be routed to different IRQCTRLs, however |
| 256 | * we assume that all CPUs (in SMP system) is routed to the |
| 257 | * same IRQ Controller, and for non-SMP only one IRQCTRL is |
| 258 | * accessed anyway. |
| 259 | * In AMP systems, Linux must run on CPU0 for the time being. |
| 260 | */ |
| 261 | cpu = sparc_leon3_cpuid(); |
| 262 | icsel = LEON3_BYPASS_LOAD_PA(&leon3_irqctrl_regs->icsel[cpu/8]); |
| 263 | icsel = (icsel >> ((7 - (cpu&0x7)) * 4)) & 0xf; |
| 264 | leon3_irqctrl_regs += icsel; |
Konrad Eisele | 5213a78 | 2009-08-17 00:13:29 +0000 | [diff] [blame] | 265 | } else { |
Daniel Hellstrom | 53aea7c | 2011-01-04 01:41:29 +0000 | [diff] [blame] | 266 | goto bad; |
Konrad Eisele | 5213a78 | 2009-08-17 00:13:29 +0000 | [diff] [blame] | 267 | } |
| 268 | |
Sam Ravnborg | 6baa9b2 | 2011-04-18 11:25:44 +0000 | [diff] [blame^] | 269 | irq = leon_build_device_irq(NULL, leon3_gptimer_irq + leon3_gptimer_idx); |
| 270 | err = request_irq(irq, counter_fn, IRQF_TIMER, "timer", NULL); |
Konrad Eisele | 5213a78 | 2009-08-17 00:13:29 +0000 | [diff] [blame] | 271 | |
Sam Ravnborg | 6baa9b2 | 2011-04-18 11:25:44 +0000 | [diff] [blame^] | 272 | if (err) { |
Konrad Eisele | 5213a78 | 2009-08-17 00:13:29 +0000 | [diff] [blame] | 273 | printk(KERN_ERR "leon_time_init: unable to attach IRQ%d\n", |
| 274 | LEON_INTERRUPT_TIMER1); |
| 275 | prom_halt(); |
| 276 | } |
| 277 | |
Konrad Eisele | 8401707 | 2009-08-31 22:08:13 +0000 | [diff] [blame] | 278 | # ifdef CONFIG_SMP |
| 279 | { |
| 280 | unsigned long flags; |
| 281 | struct tt_entry *trap_table = &sparc_ttable[SP_TRAP_IRQ1 + (leon_percpu_timer_dev[0].irq - 1)]; |
| 282 | |
| 283 | /* For SMP we use the level 14 ticker, however the bootup code |
| 284 | * has copied the firmwares level 14 vector into boot cpu's |
| 285 | * trap table, we must fix this now or we get squashed. |
| 286 | */ |
| 287 | local_irq_save(flags); |
| 288 | |
| 289 | patchme_maybe_smp_msg[0] = 0x01000000; /* NOP out the branch */ |
| 290 | |
| 291 | /* Adjust so that we jump directly to smpleon_ticker */ |
| 292 | trap_table->inst_three += smpleon_ticker - real_irq_entry; |
| 293 | |
| 294 | local_flush_cache_all(); |
| 295 | local_irq_restore(flags); |
| 296 | } |
| 297 | # endif |
| 298 | |
Konrad Eisele | 5213a78 | 2009-08-17 00:13:29 +0000 | [diff] [blame] | 299 | if (leon3_gptimer_regs) { |
Daniel Hellstrom | 2791c1a | 2011-01-04 01:41:32 +0000 | [diff] [blame] | 300 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx].ctrl, |
Konrad Eisele | 5213a78 | 2009-08-17 00:13:29 +0000 | [diff] [blame] | 301 | LEON3_GPTIMER_EN | |
| 302 | LEON3_GPTIMER_RL | |
| 303 | LEON3_GPTIMER_LD | LEON3_GPTIMER_IRQEN); |
Konrad Eisele | 8401707 | 2009-08-31 22:08:13 +0000 | [diff] [blame] | 304 | |
| 305 | #ifdef CONFIG_SMP |
Daniel Hellstrom | 2791c1a | 2011-01-04 01:41:32 +0000 | [diff] [blame] | 306 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx+1].ctrl, |
Konrad Eisele | 8401707 | 2009-08-31 22:08:13 +0000 | [diff] [blame] | 307 | LEON3_GPTIMER_EN | |
| 308 | LEON3_GPTIMER_RL | |
| 309 | LEON3_GPTIMER_LD | |
| 310 | LEON3_GPTIMER_IRQEN); |
| 311 | #endif |
| 312 | |
Konrad Eisele | 5213a78 | 2009-08-17 00:13:29 +0000 | [diff] [blame] | 313 | } |
Daniel Hellstrom | 53aea7c | 2011-01-04 01:41:29 +0000 | [diff] [blame] | 314 | return; |
| 315 | bad: |
| 316 | printk(KERN_ERR "No Timer/irqctrl found\n"); |
| 317 | BUG(); |
| 318 | return; |
Konrad Eisele | 5213a78 | 2009-08-17 00:13:29 +0000 | [diff] [blame] | 319 | } |
| 320 | |
| 321 | void leon_clear_clock_irq(void) |
| 322 | { |
| 323 | } |
| 324 | |
| 325 | void leon_load_profile_irq(int cpu, unsigned int limit) |
| 326 | { |
| 327 | BUG(); |
| 328 | } |
| 329 | |
| 330 | |
| 331 | |
| 332 | |
| 333 | void __init leon_trans_init(struct device_node *dp) |
| 334 | { |
| 335 | if (strcmp(dp->type, "cpu") == 0 && strcmp(dp->name, "<NULL>") == 0) { |
| 336 | struct property *p; |
| 337 | p = of_find_property(dp, "mid", (void *)0); |
| 338 | if (p) { |
| 339 | int mid; |
| 340 | dp->name = prom_early_alloc(5 + 1); |
| 341 | memcpy(&mid, p->value, p->length); |
| 342 | sprintf((char *)dp->name, "cpu%.2d", mid); |
| 343 | } |
| 344 | } |
| 345 | } |
| 346 | |
| 347 | void __initdata (*prom_amba_init)(struct device_node *dp, struct device_node ***nextp) = 0; |
| 348 | |
| 349 | void __init leon_node_init(struct device_node *dp, struct device_node ***nextp) |
| 350 | { |
| 351 | if (prom_amba_init && |
| 352 | strcmp(dp->type, "ambapp") == 0 && |
| 353 | strcmp(dp->name, "ambapp0") == 0) { |
| 354 | prom_amba_init(dp, nextp); |
| 355 | } |
| 356 | } |
| 357 | |
Konrad Eisele | 8401707 | 2009-08-31 22:08:13 +0000 | [diff] [blame] | 358 | #ifdef CONFIG_SMP |
| 359 | |
| 360 | void leon_set_cpu_int(int cpu, int level) |
| 361 | { |
| 362 | unsigned long mask; |
| 363 | mask = get_irqmask(level); |
| 364 | LEON3_BYPASS_STORE_PA(&leon3_irqctrl_regs->force[cpu], mask); |
| 365 | } |
| 366 | |
| 367 | static void leon_clear_ipi(int cpu, int level) |
| 368 | { |
| 369 | unsigned long mask; |
| 370 | mask = get_irqmask(level); |
| 371 | LEON3_BYPASS_STORE_PA(&leon3_irqctrl_regs->force[cpu], mask<<16); |
| 372 | } |
| 373 | |
| 374 | static void leon_set_udt(int cpu) |
| 375 | { |
| 376 | } |
| 377 | |
| 378 | void leon_clear_profile_irq(int cpu) |
| 379 | { |
| 380 | } |
| 381 | |
| 382 | void leon_enable_irq_cpu(unsigned int irq_nr, unsigned int cpu) |
| 383 | { |
| 384 | unsigned long mask, flags, *addr; |
| 385 | mask = get_irqmask(irq_nr); |
| 386 | local_irq_save(flags); |
| 387 | addr = (unsigned long *)&(leon3_irqctrl_regs->mask[cpu]); |
| 388 | LEON3_BYPASS_STORE_PA(addr, (LEON3_BYPASS_LOAD_PA(addr) | (mask))); |
| 389 | local_irq_restore(flags); |
| 390 | } |
| 391 | |
| 392 | #endif |
| 393 | |
Konrad Eisele | 5213a78 | 2009-08-17 00:13:29 +0000 | [diff] [blame] | 394 | void __init leon_init_IRQ(void) |
| 395 | { |
Sam Ravnborg | 6baa9b2 | 2011-04-18 11:25:44 +0000 | [diff] [blame^] | 396 | sparc_irq_config.init_timers = leon_init_timers; |
| 397 | sparc_irq_config.build_device_irq = leon_build_device_irq; |
Konrad Eisele | 5213a78 | 2009-08-17 00:13:29 +0000 | [diff] [blame] | 398 | |
| 399 | BTFIXUPSET_CALL(clear_clock_irq, leon_clear_clock_irq, |
| 400 | BTFIXUPCALL_NORM); |
| 401 | BTFIXUPSET_CALL(load_profile_irq, leon_load_profile_irq, |
| 402 | BTFIXUPCALL_NOP); |
| 403 | |
| 404 | #ifdef CONFIG_SMP |
| 405 | BTFIXUPSET_CALL(set_cpu_int, leon_set_cpu_int, BTFIXUPCALL_NORM); |
| 406 | BTFIXUPSET_CALL(clear_cpu_int, leon_clear_ipi, BTFIXUPCALL_NORM); |
| 407 | BTFIXUPSET_CALL(set_irq_udt, leon_set_udt, BTFIXUPCALL_NORM); |
| 408 | #endif |
| 409 | |
| 410 | } |
| 411 | |
| 412 | void __init leon_init(void) |
| 413 | { |
Andres Salomon | ed41850 | 2010-10-10 21:51:25 -0600 | [diff] [blame] | 414 | of_pdt_build_more = &leon_node_init; |
Konrad Eisele | 5213a78 | 2009-08-17 00:13:29 +0000 | [diff] [blame] | 415 | } |