11 #include <linux/module.h>
16 #include <asm/setup.h>
17 #include <asm/serial-regs.h>
20 [0 ...
NR_CPUS - 1] = EPSW_IE | EPSW_IM_7
25 static char irq_affinity_online[
NR_IRQS] = {
29 #define NR_IRQ_WORDS ((NR_IRQS + 31) / 32)
30 static unsigned long irq_affinity_request[NR_IRQ_WORDS] = {
31 [0 ... NR_IRQ_WORDS - 1] = 0
40 static void mn10300_cpupic_ack(
struct irq_data *
d)
46 flags = arch_local_cli_save();
47 GxICR_u8(irq) = GxICR_DETECT;
52 static void __mask_and_set_icr(
unsigned int irq,
53 unsigned int mask,
unsigned int set)
58 flags = arch_local_cli_save();
60 GxICR(irq) = (tmp &
mask) |
set;
65 static void mn10300_cpupic_mask(
struct irq_data *
d)
67 __mask_and_set_icr(d->
irq, GxICR_LEVEL, 0);
70 static void mn10300_cpupic_mask_ack(
struct irq_data *
d)
77 flags = arch_local_cli_save();
81 GxICR(irq) = (tmp & GxICR_LEVEL) | GxICR_DETECT;
86 GxICR(irq) = (tmp & GxICR_LEVEL);
89 irq_affinity_online[irq] =
91 CROSS_GxICR(irq, irq_affinity_online[irq]) =
92 (tmp & (GxICR_LEVEL | GxICR_ENABLE)) | GxICR_DETECT;
93 tmp = CROSS_GxICR(irq, irq_affinity_online[irq]);
98 __mask_and_set_icr(irq, GxICR_LEVEL, GxICR_DETECT);
102 static void mn10300_cpupic_unmask(
struct irq_data *d)
104 __mask_and_set_icr(d->
irq, GxICR_LEVEL, GxICR_ENABLE);
107 static void mn10300_cpupic_unmask_clear(
struct irq_data *d)
109 unsigned int irq = d->
irq;
118 flags = arch_local_cli_save();
122 GxICR(irq) = (tmp & GxICR_LEVEL) | GxICR_ENABLE | GxICR_DETECT;
129 CROSS_GxICR(irq, irq_affinity_online[irq]) = (tmp & GxICR_LEVEL) | GxICR_ENABLE | GxICR_DETECT;
130 tmp = CROSS_GxICR(irq, irq_affinity_online[irq]);
135 __mask_and_set_icr(irq, GxICR_LEVEL, GxICR_ENABLE | GxICR_DETECT);
147 flags = arch_local_cli_save();
153 case CALL_FUNC_SINGLE_IPI:
154 case LOCAL_TIMER_IPI:
155 case FLUSH_CACHE_IPI:
156 case CALL_FUNCTION_NMI_IPI:
157 case DEBUGGER_NMI_IPI:
158 #ifdef CONFIG_MN10300_TTYSM0
161 #ifdef CONFIG_MN10300_TTYSM0_TIMER8
163 #elif CONFIG_MN10300_TTYSM0_TIMER2
168 #ifdef CONFIG_MN10300_TTYSM1
171 #ifdef CONFIG_MN10300_TTYSM1_TIMER12
173 #elif defined(CONFIG_MN10300_TTYSM1_TIMER9)
175 #elif defined(CONFIG_MN10300_TTYSM1_TIMER3)
180 #ifdef CONFIG_MN10300_TTYSM2
209 static struct irq_chip mn10300_cpu_pic_level = {
211 .irq_disable = mn10300_cpupic_mask,
212 .irq_enable = mn10300_cpupic_unmask_clear,
214 .irq_mask = mn10300_cpupic_mask,
215 .irq_mask_ack = mn10300_cpupic_mask,
216 .irq_unmask = mn10300_cpupic_unmask_clear,
218 .irq_set_affinity = mn10300_cpupic_setaffinity,
227 static struct irq_chip mn10300_cpu_pic_edge = {
229 .irq_disable = mn10300_cpupic_mask,
230 .irq_enable = mn10300_cpupic_unmask,
231 .irq_ack = mn10300_cpupic_ack,
232 .irq_mask = mn10300_cpupic_mask,
233 .irq_mask_ack = mn10300_cpupic_mask_ack,
234 .irq_unmask = mn10300_cpupic_unmask,
236 .irq_set_affinity = mn10300_cpupic_setaffinity,
257 __mask_and_set_icr(irq, GxICR_ENABLE, level);
266 irq_set_chip_and_handler(irq, &mn10300_cpu_pic_level,
277 for (irq = 0; irq <
NR_IRQS; irq++)
283 irq_set_chip_and_handler(irq, &mn10300_cpu_pic_edge,
294 unsigned long sp, epsw, irq_disabled_epsw, old_irq_enabled_epsw;
298 sp = current_stack_pointer();
308 #ifdef CONFIG_MN10300_WD_TIMER
340 #ifdef CONFIG_MN10300_WD_TIMER
355 #ifdef CONFIG_HOTPLUG_CPU
359 unsigned int self,
new;
363 for (irq = 0; irq <
NR_IRQS; irq++) {
366 if (irqd_is_per_cpu(data))
370 !cpumask_intersects(&irq_affinity[irq], cpu_online_mask)) {
372 cpu_id = cpumask_first(cpu_online_mask);
373 cpumask_set_cpu(cpu_id, &data->
affinity);
376 arch_local_cli_save(flags);
377 if (irq_affinity_online[irq] ==
self) {
381 GxICR(irq) = x & GxICR_LEVEL;
386 irq_affinity_online[
irq] =
new;
388 CROSS_GxICR(irq,
new) =
389 (x & GxICR_LEVEL) | GxICR_DETECT;
390 tmp = CROSS_GxICR(irq,
new);
392 x &= GxICR_LEVEL | GxICR_ENABLE;
393 if (GxICR(irq) & GxICR_REQUEST)
394 x |= GxICR_REQUEST | GxICR_DETECT;
395 CROSS_GxICR(irq,
new) =
x;
396 tmp = CROSS_GxICR(irq,
new);