diff options
Diffstat (limited to 'arch/sparc/kernel/leon_kernel.c')
-rw-r--r-- | arch/sparc/kernel/leon_kernel.c | 365 |
1 files changed, 239 insertions, 126 deletions
diff --git a/arch/sparc/kernel/leon_kernel.c b/arch/sparc/kernel/leon_kernel.c index 2969f777fa11..2f538ac2e139 100644 --- a/arch/sparc/kernel/leon_kernel.c +++ b/arch/sparc/kernel/leon_kernel.c | |||
@@ -19,53 +19,70 @@ | |||
19 | #include <asm/leon_amba.h> | 19 | #include <asm/leon_amba.h> |
20 | #include <asm/traps.h> | 20 | #include <asm/traps.h> |
21 | #include <asm/cacheflush.h> | 21 | #include <asm/cacheflush.h> |
22 | #include <asm/smp.h> | ||
23 | #include <asm/setup.h> | ||
22 | 24 | ||
23 | #include "prom.h" | 25 | #include "prom.h" |
24 | #include "irq.h" | 26 | #include "irq.h" |
25 | 27 | ||
26 | struct leon3_irqctrl_regs_map *leon3_irqctrl_regs; /* interrupt controller base address */ | 28 | 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 */ | 29 | struct leon3_gptimer_regs_map *leon3_gptimer_regs; /* timer controller base address */ |
28 | struct amba_apb_device leon_percpu_timer_dev[16]; | ||
29 | 30 | ||
30 | int leondebug_irq_disable; | 31 | int leondebug_irq_disable; |
31 | int leon_debug_irqout; | 32 | int leon_debug_irqout; |
32 | static int dummy_master_l10_counter; | 33 | static int dummy_master_l10_counter; |
33 | unsigned long amba_system_id; | 34 | unsigned long amba_system_id; |
35 | static DEFINE_SPINLOCK(leon_irq_lock); | ||
34 | 36 | ||
35 | unsigned long leon3_gptimer_irq; /* interrupt controller irq number */ | 37 | unsigned long leon3_gptimer_irq; /* interrupt controller irq number */ |
36 | unsigned long leon3_gptimer_idx; /* Timer Index (0..6) within Timer Core */ | 38 | unsigned long leon3_gptimer_idx; /* Timer Index (0..6) within Timer Core */ |
39 | int leon3_ticker_irq; /* Timer ticker IRQ */ | ||
37 | unsigned int sparc_leon_eirq; | 40 | unsigned int sparc_leon_eirq; |
38 | #define LEON_IMASK ((&leon3_irqctrl_regs->mask[0])) | 41 | #define LEON_IMASK(cpu) (&leon3_irqctrl_regs->mask[cpu]) |
42 | #define LEON_IACK (&leon3_irqctrl_regs->iclear) | ||
43 | #define LEON_DO_ACK_HW 1 | ||
39 | 44 | ||
40 | /* Return the IRQ of the pending IRQ on the extended IRQ controller */ | 45 | /* Return the last ACKed IRQ by the Extended IRQ controller. It has already |
41 | int sparc_leon_eirq_get(int eirq, int cpu) | 46 | * been (automatically) ACKed when the CPU takes the trap. |
47 | */ | ||
48 | static inline unsigned int leon_eirq_get(int cpu) | ||
42 | { | 49 | { |
43 | return LEON3_BYPASS_LOAD_PA(&leon3_irqctrl_regs->intid[cpu]) & 0x1f; | 50 | return LEON3_BYPASS_LOAD_PA(&leon3_irqctrl_regs->intid[cpu]) & 0x1f; |
44 | } | 51 | } |
45 | 52 | ||
46 | irqreturn_t sparc_leon_eirq_isr(int dummy, void *dev_id) | 53 | /* Handle one or multiple IRQs from the extended interrupt controller */ |
54 | static void leon_handle_ext_irq(unsigned int irq, struct irq_desc *desc) | ||
47 | { | 55 | { |
48 | printk(KERN_ERR "sparc_leon_eirq_isr: ERROR EXTENDED IRQ\n"); | 56 | unsigned int eirq; |
49 | return IRQ_HANDLED; | 57 | int cpu = sparc_leon3_cpuid(); |
58 | |||
59 | eirq = leon_eirq_get(cpu); | ||
60 | if ((eirq & 0x10) && irq_map[eirq]->irq) /* bit4 tells if IRQ happened */ | ||
61 | generic_handle_irq(irq_map[eirq]->irq); | ||
50 | } | 62 | } |
51 | 63 | ||
52 | /* The extended IRQ controller has been found, this function registers it */ | 64 | /* The extended IRQ controller has been found, this function registers it */ |
53 | void sparc_leon_eirq_register(int eirq) | 65 | void leon_eirq_setup(unsigned int eirq) |
54 | { | 66 | { |
55 | int irq; | 67 | unsigned long mask, oldmask; |
68 | unsigned int veirq; | ||
56 | 69 | ||
57 | /* Register a "BAD" handler for this interrupt, it should never happen */ | 70 | if (eirq < 1 || eirq > 0xf) { |
58 | irq = request_irq(eirq, sparc_leon_eirq_isr, | 71 | printk(KERN_ERR "LEON EXT IRQ NUMBER BAD: %d\n", eirq); |
59 | (IRQF_DISABLED | SA_STATIC_ALLOC), "extirq", NULL); | 72 | return; |
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 | } | 73 | } |
68 | 74 | ||
75 | veirq = leon_build_device_irq(eirq, leon_handle_ext_irq, "extirq", 0); | ||
76 | |||
77 | /* | ||
78 | * Unmask the Extended IRQ, the IRQs routed through the Ext-IRQ | ||
79 | * controller have a mask-bit of their own, so this is safe. | ||
80 | */ | ||
81 | irq_link(veirq); | ||
82 | mask = 1 << eirq; | ||
83 | oldmask = LEON3_BYPASS_LOAD_PA(LEON_IMASK(boot_cpu_id)); | ||
84 | LEON3_BYPASS_STORE_PA(LEON_IMASK(boot_cpu_id), (oldmask | mask)); | ||
85 | sparc_leon_eirq = eirq; | ||
69 | } | 86 | } |
70 | 87 | ||
71 | static inline unsigned long get_irqmask(unsigned int irq) | 88 | static inline unsigned long get_irqmask(unsigned int irq) |
@@ -83,35 +100,151 @@ static inline unsigned long get_irqmask(unsigned int irq) | |||
83 | return mask; | 100 | return mask; |
84 | } | 101 | } |
85 | 102 | ||
86 | static void leon_enable_irq(unsigned int irq_nr) | 103 | #ifdef CONFIG_SMP |
104 | static int irq_choose_cpu(const struct cpumask *affinity) | ||
87 | { | 105 | { |
88 | unsigned long mask, flags; | 106 | cpumask_t mask; |
89 | mask = get_irqmask(irq_nr); | 107 | |
90 | local_irq_save(flags); | 108 | cpus_and(mask, cpu_online_map, *affinity); |
91 | LEON3_BYPASS_STORE_PA(LEON_IMASK, | 109 | if (cpus_equal(mask, cpu_online_map) || cpus_empty(mask)) |
92 | (LEON3_BYPASS_LOAD_PA(LEON_IMASK) | (mask))); | 110 | return boot_cpu_id; |
93 | local_irq_restore(flags); | 111 | else |
112 | return first_cpu(mask); | ||
94 | } | 113 | } |
114 | #else | ||
115 | #define irq_choose_cpu(affinity) boot_cpu_id | ||
116 | #endif | ||
95 | 117 | ||
96 | static void leon_disable_irq(unsigned int irq_nr) | 118 | static int leon_set_affinity(struct irq_data *data, const struct cpumask *dest, |
119 | bool force) | ||
97 | { | 120 | { |
98 | unsigned long mask, flags; | 121 | unsigned long mask, oldmask, flags; |
99 | mask = get_irqmask(irq_nr); | 122 | int oldcpu, newcpu; |
100 | local_irq_save(flags); | 123 | |
101 | LEON3_BYPASS_STORE_PA(LEON_IMASK, | 124 | mask = (unsigned long)data->chip_data; |
102 | (LEON3_BYPASS_LOAD_PA(LEON_IMASK) & ~(mask))); | 125 | oldcpu = irq_choose_cpu(data->affinity); |
103 | local_irq_restore(flags); | 126 | newcpu = irq_choose_cpu(dest); |
127 | |||
128 | if (oldcpu == newcpu) | ||
129 | goto out; | ||
130 | |||
131 | /* unmask on old CPU first before enabling on the selected CPU */ | ||
132 | spin_lock_irqsave(&leon_irq_lock, flags); | ||
133 | oldmask = LEON3_BYPASS_LOAD_PA(LEON_IMASK(oldcpu)); | ||
134 | LEON3_BYPASS_STORE_PA(LEON_IMASK(oldcpu), (oldmask & ~mask)); | ||
135 | oldmask = LEON3_BYPASS_LOAD_PA(LEON_IMASK(newcpu)); | ||
136 | LEON3_BYPASS_STORE_PA(LEON_IMASK(newcpu), (oldmask | mask)); | ||
137 | spin_unlock_irqrestore(&leon_irq_lock, flags); | ||
138 | out: | ||
139 | return IRQ_SET_MASK_OK; | ||
140 | } | ||
141 | |||
142 | static void leon_unmask_irq(struct irq_data *data) | ||
143 | { | ||
144 | unsigned long mask, oldmask, flags; | ||
145 | int cpu; | ||
146 | |||
147 | mask = (unsigned long)data->chip_data; | ||
148 | cpu = irq_choose_cpu(data->affinity); | ||
149 | spin_lock_irqsave(&leon_irq_lock, flags); | ||
150 | oldmask = LEON3_BYPASS_LOAD_PA(LEON_IMASK(cpu)); | ||
151 | LEON3_BYPASS_STORE_PA(LEON_IMASK(cpu), (oldmask | mask)); | ||
152 | spin_unlock_irqrestore(&leon_irq_lock, flags); | ||
153 | } | ||
154 | |||
155 | static void leon_mask_irq(struct irq_data *data) | ||
156 | { | ||
157 | unsigned long mask, oldmask, flags; | ||
158 | int cpu; | ||
159 | |||
160 | mask = (unsigned long)data->chip_data; | ||
161 | cpu = irq_choose_cpu(data->affinity); | ||
162 | spin_lock_irqsave(&leon_irq_lock, flags); | ||
163 | oldmask = LEON3_BYPASS_LOAD_PA(LEON_IMASK(cpu)); | ||
164 | LEON3_BYPASS_STORE_PA(LEON_IMASK(cpu), (oldmask & ~mask)); | ||
165 | spin_unlock_irqrestore(&leon_irq_lock, flags); | ||
166 | } | ||
167 | |||
168 | static unsigned int leon_startup_irq(struct irq_data *data) | ||
169 | { | ||
170 | irq_link(data->irq); | ||
171 | leon_unmask_irq(data); | ||
172 | return 0; | ||
173 | } | ||
104 | 174 | ||
175 | static void leon_shutdown_irq(struct irq_data *data) | ||
176 | { | ||
177 | leon_mask_irq(data); | ||
178 | irq_unlink(data->irq); | ||
179 | } | ||
180 | |||
181 | /* Used by external level sensitive IRQ handlers on the LEON: ACK IRQ ctrl */ | ||
182 | static void leon_eoi_irq(struct irq_data *data) | ||
183 | { | ||
184 | unsigned long mask = (unsigned long)data->chip_data; | ||
185 | |||
186 | if (mask & LEON_DO_ACK_HW) | ||
187 | LEON3_BYPASS_STORE_PA(LEON_IACK, mask & ~LEON_DO_ACK_HW); | ||
188 | } | ||
189 | |||
190 | static struct irq_chip leon_irq = { | ||
191 | .name = "leon", | ||
192 | .irq_startup = leon_startup_irq, | ||
193 | .irq_shutdown = leon_shutdown_irq, | ||
194 | .irq_mask = leon_mask_irq, | ||
195 | .irq_unmask = leon_unmask_irq, | ||
196 | .irq_eoi = leon_eoi_irq, | ||
197 | .irq_set_affinity = leon_set_affinity, | ||
198 | }; | ||
199 | |||
200 | /* | ||
201 | * Build a LEON IRQ for the edge triggered LEON IRQ controller: | ||
202 | * Edge (normal) IRQ - handle_simple_irq, ack=DONT-CARE, never ack | ||
203 | * Level IRQ (PCI|Level-GPIO) - handle_fasteoi_irq, ack=1, ack after ISR | ||
204 | * Per-CPU Edge - handle_percpu_irq, ack=0 | ||
205 | */ | ||
206 | unsigned int leon_build_device_irq(unsigned int real_irq, | ||
207 | irq_flow_handler_t flow_handler, | ||
208 | const char *name, int do_ack) | ||
209 | { | ||
210 | unsigned int irq; | ||
211 | unsigned long mask; | ||
212 | |||
213 | irq = 0; | ||
214 | mask = get_irqmask(real_irq); | ||
215 | if (mask == 0) | ||
216 | goto out; | ||
217 | |||
218 | irq = irq_alloc(real_irq, real_irq); | ||
219 | if (irq == 0) | ||
220 | goto out; | ||
221 | |||
222 | if (do_ack) | ||
223 | mask |= LEON_DO_ACK_HW; | ||
224 | |||
225 | irq_set_chip_and_handler_name(irq, &leon_irq, | ||
226 | flow_handler, name); | ||
227 | irq_set_chip_data(irq, (void *)mask); | ||
228 | |||
229 | out: | ||
230 | return irq; | ||
231 | } | ||
232 | |||
233 | static unsigned int _leon_build_device_irq(struct platform_device *op, | ||
234 | unsigned int real_irq) | ||
235 | { | ||
236 | return leon_build_device_irq(real_irq, handle_simple_irq, "edge", 0); | ||
105 | } | 237 | } |
106 | 238 | ||
107 | void __init leon_init_timers(irq_handler_t counter_fn) | 239 | void __init leon_init_timers(irq_handler_t counter_fn) |
108 | { | 240 | { |
109 | int irq; | 241 | int irq, eirq; |
110 | struct device_node *rootnp, *np, *nnp; | 242 | struct device_node *rootnp, *np, *nnp; |
111 | struct property *pp; | 243 | struct property *pp; |
112 | int len; | 244 | int len; |
113 | int cpu, icsel; | 245 | int icsel; |
114 | int ampopts; | 246 | int ampopts; |
247 | int err; | ||
115 | 248 | ||
116 | leondebug_irq_disable = 0; | 249 | leondebug_irq_disable = 0; |
117 | leon_debug_irqout = 0; | 250 | leon_debug_irqout = 0; |
@@ -173,98 +306,85 @@ void __init leon_init_timers(irq_handler_t counter_fn) | |||
173 | leon3_gptimer_irq = *(unsigned int *)pp->value; | 306 | leon3_gptimer_irq = *(unsigned int *)pp->value; |
174 | } while (0); | 307 | } while (0); |
175 | 308 | ||
176 | if (leon3_gptimer_regs && leon3_irqctrl_regs && leon3_gptimer_irq) { | 309 | if (!(leon3_gptimer_regs && leon3_irqctrl_regs && leon3_gptimer_irq)) |
177 | LEON3_BYPASS_STORE_PA( | 310 | goto bad; |
178 | &leon3_gptimer_regs->e[leon3_gptimer_idx].val, 0); | 311 | |
179 | LEON3_BYPASS_STORE_PA( | 312 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx].val, 0); |
180 | &leon3_gptimer_regs->e[leon3_gptimer_idx].rld, | 313 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx].rld, |
181 | (((1000000 / HZ) - 1))); | 314 | (((1000000 / HZ) - 1))); |
182 | LEON3_BYPASS_STORE_PA( | 315 | LEON3_BYPASS_STORE_PA( |
183 | &leon3_gptimer_regs->e[leon3_gptimer_idx].ctrl, 0); | 316 | &leon3_gptimer_regs->e[leon3_gptimer_idx].ctrl, 0); |
184 | 317 | ||
185 | #ifdef CONFIG_SMP | 318 | #ifdef CONFIG_SMP |
186 | leon_percpu_timer_dev[0].start = (int)leon3_gptimer_regs; | 319 | leon3_ticker_irq = leon3_gptimer_irq + 1 + leon3_gptimer_idx; |
187 | leon_percpu_timer_dev[0].irq = leon3_gptimer_irq + 1 + | ||
188 | leon3_gptimer_idx; | ||
189 | |||
190 | if (!(LEON3_BYPASS_LOAD_PA(&leon3_gptimer_regs->config) & | ||
191 | (1<<LEON3_GPTIMER_SEPIRQ))) { | ||
192 | prom_printf("irq timer not configured with separate irqs\n"); | ||
193 | BUG(); | ||
194 | } | ||
195 | 320 | ||
196 | LEON3_BYPASS_STORE_PA( | 321 | if (!(LEON3_BYPASS_LOAD_PA(&leon3_gptimer_regs->config) & |
197 | &leon3_gptimer_regs->e[leon3_gptimer_idx+1].val, 0); | 322 | (1<<LEON3_GPTIMER_SEPIRQ))) { |
198 | LEON3_BYPASS_STORE_PA( | 323 | printk(KERN_ERR "timer not configured with separate irqs\n"); |
199 | &leon3_gptimer_regs->e[leon3_gptimer_idx+1].rld, | 324 | BUG(); |
200 | (((1000000/HZ) - 1))); | ||
201 | LEON3_BYPASS_STORE_PA( | ||
202 | &leon3_gptimer_regs->e[leon3_gptimer_idx+1].ctrl, 0); | ||
203 | # endif | ||
204 | |||
205 | /* | ||
206 | * The IRQ controller may (if implemented) consist of multiple | ||
207 | * IRQ controllers, each mapped on a 4Kb boundary. | ||
208 | * Each CPU may be routed to different IRQCTRLs, however | ||
209 | * we assume that all CPUs (in SMP system) is routed to the | ||
210 | * same IRQ Controller, and for non-SMP only one IRQCTRL is | ||
211 | * accessed anyway. | ||
212 | * In AMP systems, Linux must run on CPU0 for the time being. | ||
213 | */ | ||
214 | cpu = sparc_leon3_cpuid(); | ||
215 | icsel = LEON3_BYPASS_LOAD_PA(&leon3_irqctrl_regs->icsel[cpu/8]); | ||
216 | icsel = (icsel >> ((7 - (cpu&0x7)) * 4)) & 0xf; | ||
217 | leon3_irqctrl_regs += icsel; | ||
218 | } else { | ||
219 | goto bad; | ||
220 | } | 325 | } |
221 | 326 | ||
222 | irq = request_irq(leon3_gptimer_irq+leon3_gptimer_idx, | 327 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx+1].val, |
223 | counter_fn, | 328 | 0); |
224 | (IRQF_DISABLED | SA_STATIC_ALLOC), "timer", NULL); | 329 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx+1].rld, |
330 | (((1000000/HZ) - 1))); | ||
331 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx+1].ctrl, | ||
332 | 0); | ||
333 | #endif | ||
225 | 334 | ||
226 | if (irq) { | 335 | /* |
227 | printk(KERN_ERR "leon_time_init: unable to attach IRQ%d\n", | 336 | * The IRQ controller may (if implemented) consist of multiple |
228 | LEON_INTERRUPT_TIMER1); | 337 | * IRQ controllers, each mapped on a 4Kb boundary. |
338 | * Each CPU may be routed to different IRQCTRLs, however | ||
339 | * we assume that all CPUs (in SMP system) is routed to the | ||
340 | * same IRQ Controller, and for non-SMP only one IRQCTRL is | ||
341 | * accessed anyway. | ||
342 | * In AMP systems, Linux must run on CPU0 for the time being. | ||
343 | */ | ||
344 | icsel = LEON3_BYPASS_LOAD_PA(&leon3_irqctrl_regs->icsel[boot_cpu_id/8]); | ||
345 | icsel = (icsel >> ((7 - (boot_cpu_id&0x7)) * 4)) & 0xf; | ||
346 | leon3_irqctrl_regs += icsel; | ||
347 | |||
348 | /* Mask all IRQs on boot-cpu IRQ controller */ | ||
349 | LEON3_BYPASS_STORE_PA(&leon3_irqctrl_regs->mask[boot_cpu_id], 0); | ||
350 | |||
351 | /* Probe extended IRQ controller */ | ||
352 | eirq = (LEON3_BYPASS_LOAD_PA(&leon3_irqctrl_regs->mpstatus) | ||
353 | >> 16) & 0xf; | ||
354 | if (eirq != 0) | ||
355 | leon_eirq_setup(eirq); | ||
356 | |||
357 | irq = _leon_build_device_irq(NULL, leon3_gptimer_irq+leon3_gptimer_idx); | ||
358 | err = request_irq(irq, counter_fn, IRQF_TIMER, "timer", NULL); | ||
359 | if (err) { | ||
360 | printk(KERN_ERR "unable to attach timer IRQ%d\n", irq); | ||
229 | prom_halt(); | 361 | prom_halt(); |
230 | } | 362 | } |
231 | 363 | ||
232 | # ifdef CONFIG_SMP | 364 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx].ctrl, |
233 | { | 365 | LEON3_GPTIMER_EN | |
234 | unsigned long flags; | 366 | LEON3_GPTIMER_RL | |
235 | struct tt_entry *trap_table = &sparc_ttable[SP_TRAP_IRQ1 + (leon_percpu_timer_dev[0].irq - 1)]; | 367 | LEON3_GPTIMER_LD | |
236 | 368 | LEON3_GPTIMER_IRQEN); | |
237 | /* For SMP we use the level 14 ticker, however the bootup code | ||
238 | * has copied the firmwares level 14 vector into boot cpu's | ||
239 | * trap table, we must fix this now or we get squashed. | ||
240 | */ | ||
241 | local_irq_save(flags); | ||
242 | |||
243 | patchme_maybe_smp_msg[0] = 0x01000000; /* NOP out the branch */ | ||
244 | |||
245 | /* Adjust so that we jump directly to smpleon_ticker */ | ||
246 | trap_table->inst_three += smpleon_ticker - real_irq_entry; | ||
247 | 369 | ||
248 | local_flush_cache_all(); | 370 | #ifdef CONFIG_SMP |
249 | local_irq_restore(flags); | 371 | /* Install per-cpu IRQ handler for broadcasted ticker */ |
372 | irq = leon_build_device_irq(leon3_ticker_irq, handle_percpu_irq, | ||
373 | "per-cpu", 0); | ||
374 | err = request_irq(irq, leon_percpu_timer_interrupt, | ||
375 | IRQF_PERCPU | IRQF_TIMER, "ticker", | ||
376 | NULL); | ||
377 | if (err) { | ||
378 | printk(KERN_ERR "unable to attach ticker IRQ%d\n", irq); | ||
379 | prom_halt(); | ||
250 | } | 380 | } |
251 | # endif | ||
252 | |||
253 | if (leon3_gptimer_regs) { | ||
254 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx].ctrl, | ||
255 | LEON3_GPTIMER_EN | | ||
256 | LEON3_GPTIMER_RL | | ||
257 | LEON3_GPTIMER_LD | LEON3_GPTIMER_IRQEN); | ||
258 | 381 | ||
259 | #ifdef CONFIG_SMP | 382 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx+1].ctrl, |
260 | LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[leon3_gptimer_idx+1].ctrl, | 383 | LEON3_GPTIMER_EN | |
261 | LEON3_GPTIMER_EN | | 384 | LEON3_GPTIMER_RL | |
262 | LEON3_GPTIMER_RL | | 385 | LEON3_GPTIMER_LD | |
263 | LEON3_GPTIMER_LD | | 386 | LEON3_GPTIMER_IRQEN); |
264 | LEON3_GPTIMER_IRQEN); | ||
265 | #endif | 387 | #endif |
266 | |||
267 | } | ||
268 | return; | 388 | return; |
269 | bad: | 389 | bad: |
270 | printk(KERN_ERR "No Timer/irqctrl found\n"); | 390 | printk(KERN_ERR "No Timer/irqctrl found\n"); |
@@ -281,9 +401,6 @@ void leon_load_profile_irq(int cpu, unsigned int limit) | |||
281 | BUG(); | 401 | BUG(); |
282 | } | 402 | } |
283 | 403 | ||
284 | |||
285 | |||
286 | |||
287 | void __init leon_trans_init(struct device_node *dp) | 404 | void __init leon_trans_init(struct device_node *dp) |
288 | { | 405 | { |
289 | if (strcmp(dp->type, "cpu") == 0 && strcmp(dp->name, "<NULL>") == 0) { | 406 | if (strcmp(dp->type, "cpu") == 0 && strcmp(dp->name, "<NULL>") == 0) { |
@@ -337,22 +454,18 @@ void leon_enable_irq_cpu(unsigned int irq_nr, unsigned int cpu) | |||
337 | { | 454 | { |
338 | unsigned long mask, flags, *addr; | 455 | unsigned long mask, flags, *addr; |
339 | mask = get_irqmask(irq_nr); | 456 | mask = get_irqmask(irq_nr); |
340 | local_irq_save(flags); | 457 | spin_lock_irqsave(&leon_irq_lock, flags); |
341 | addr = (unsigned long *)&(leon3_irqctrl_regs->mask[cpu]); | 458 | addr = (unsigned long *)LEON_IMASK(cpu); |
342 | LEON3_BYPASS_STORE_PA(addr, (LEON3_BYPASS_LOAD_PA(addr) | (mask))); | 459 | LEON3_BYPASS_STORE_PA(addr, (LEON3_BYPASS_LOAD_PA(addr) | mask)); |
343 | local_irq_restore(flags); | 460 | spin_unlock_irqrestore(&leon_irq_lock, flags); |
344 | } | 461 | } |
345 | 462 | ||
346 | #endif | 463 | #endif |
347 | 464 | ||
348 | void __init leon_init_IRQ(void) | 465 | void __init leon_init_IRQ(void) |
349 | { | 466 | { |
350 | sparc_irq_config.init_timers = leon_init_timers; | 467 | sparc_irq_config.init_timers = leon_init_timers; |
351 | 468 | sparc_irq_config.build_device_irq = _leon_build_device_irq; | |
352 | BTFIXUPSET_CALL(enable_irq, leon_enable_irq, BTFIXUPCALL_NORM); | ||
353 | BTFIXUPSET_CALL(disable_irq, leon_disable_irq, BTFIXUPCALL_NORM); | ||
354 | BTFIXUPSET_CALL(enable_pil_irq, leon_enable_irq, BTFIXUPCALL_NORM); | ||
355 | BTFIXUPSET_CALL(disable_pil_irq, leon_disable_irq, BTFIXUPCALL_NORM); | ||
356 | 469 | ||
357 | BTFIXUPSET_CALL(clear_clock_irq, leon_clear_clock_irq, | 470 | BTFIXUPSET_CALL(clear_clock_irq, leon_clear_clock_irq, |
358 | BTFIXUPCALL_NORM); | 471 | BTFIXUPCALL_NORM); |