diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2006-07-01 17:32:14 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-07-01 17:32:14 -0400 |
commit | c4bfa28aec58c588de55babe99f4c172ec534704 (patch) | |
tree | dc105fc1c44b26e19a82b076b37370812192bd0c /arch/arm/common/gic.c | |
parent | 4a2581a080098ca3a0c4e416d7a282e96c75ebf8 (diff) |
[ARM] 3686/1: ARM: arm/common: convert irq handling
Patch from Thomas Gleixner
From: Thomas Gleixner <tglx@linutronix.de>
Convert the files in arch/arm/common to use the generic
irq handling functions.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/common/gic.c')
-rw-r--r-- | arch/arm/common/gic.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c index c02dc8116a18..f3c1ebfdd0aa 100644 --- a/arch/arm/common/gic.c +++ b/arch/arm/common/gic.c | |||
@@ -33,6 +33,7 @@ | |||
33 | 33 | ||
34 | static void __iomem *gic_dist_base; | 34 | static void __iomem *gic_dist_base; |
35 | static void __iomem *gic_cpu_base; | 35 | static void __iomem *gic_cpu_base; |
36 | static DEFINE_SPINLOCK(irq_controller_lock); | ||
36 | 37 | ||
37 | /* | 38 | /* |
38 | * Routines to acknowledge, disable and enable interrupts | 39 | * Routines to acknowledge, disable and enable interrupts |
@@ -52,32 +53,45 @@ static void __iomem *gic_cpu_base; | |||
52 | static void gic_ack_irq(unsigned int irq) | 53 | static void gic_ack_irq(unsigned int irq) |
53 | { | 54 | { |
54 | u32 mask = 1 << (irq % 32); | 55 | u32 mask = 1 << (irq % 32); |
56 | |||
57 | spin_lock(&irq_controller_lock); | ||
55 | writel(mask, gic_dist_base + GIC_DIST_ENABLE_CLEAR + (irq / 32) * 4); | 58 | writel(mask, gic_dist_base + GIC_DIST_ENABLE_CLEAR + (irq / 32) * 4); |
56 | writel(irq, gic_cpu_base + GIC_CPU_EOI); | 59 | writel(irq, gic_cpu_base + GIC_CPU_EOI); |
60 | spin_unlock(&irq_controller_lock); | ||
57 | } | 61 | } |
58 | 62 | ||
59 | static void gic_mask_irq(unsigned int irq) | 63 | static void gic_mask_irq(unsigned int irq) |
60 | { | 64 | { |
61 | u32 mask = 1 << (irq % 32); | 65 | u32 mask = 1 << (irq % 32); |
66 | |||
67 | spin_lock(&irq_controller_lock); | ||
62 | writel(mask, gic_dist_base + GIC_DIST_ENABLE_CLEAR + (irq / 32) * 4); | 68 | writel(mask, gic_dist_base + GIC_DIST_ENABLE_CLEAR + (irq / 32) * 4); |
69 | spin_unlock(&irq_controller_lock); | ||
63 | } | 70 | } |
64 | 71 | ||
65 | static void gic_unmask_irq(unsigned int irq) | 72 | static void gic_unmask_irq(unsigned int irq) |
66 | { | 73 | { |
67 | u32 mask = 1 << (irq % 32); | 74 | u32 mask = 1 << (irq % 32); |
75 | |||
76 | spin_lock(&irq_controller_lock); | ||
68 | writel(mask, gic_dist_base + GIC_DIST_ENABLE_SET + (irq / 32) * 4); | 77 | writel(mask, gic_dist_base + GIC_DIST_ENABLE_SET + (irq / 32) * 4); |
78 | spin_unlock(&irq_controller_lock); | ||
69 | } | 79 | } |
70 | 80 | ||
71 | #ifdef CONFIG_SMP | 81 | #ifdef CONFIG_SMP |
72 | static void gic_set_cpu(struct irqdesc *desc, unsigned int irq, unsigned int cpu) | 82 | static void gic_set_cpu(unsigned int irq, cpumask_t mask_val) |
73 | { | 83 | { |
74 | void __iomem *reg = gic_dist_base + GIC_DIST_TARGET + (irq & ~3); | 84 | void __iomem *reg = gic_dist_base + GIC_DIST_TARGET + (irq & ~3); |
75 | unsigned int shift = (irq % 4) * 8; | 85 | unsigned int shift = (irq % 4) * 8; |
86 | unsigned int cpu = first_cpu(mask_val); | ||
76 | u32 val; | 87 | u32 val; |
77 | 88 | ||
89 | spin_lock(&irq_controller_lock); | ||
90 | irq_desc[irq].cpu = cpu; | ||
78 | val = readl(reg) & ~(0xff << shift); | 91 | val = readl(reg) & ~(0xff << shift); |
79 | val |= 1 << (cpu + shift); | 92 | val |= 1 << (cpu + shift); |
80 | writel(val, reg); | 93 | writel(val, reg); |
94 | spin_unlock(&irq_controller_lock); | ||
81 | } | 95 | } |
82 | #endif | 96 | #endif |
83 | 97 | ||
@@ -86,7 +100,7 @@ static struct irqchip gic_chip = { | |||
86 | .mask = gic_mask_irq, | 100 | .mask = gic_mask_irq, |
87 | .unmask = gic_unmask_irq, | 101 | .unmask = gic_unmask_irq, |
88 | #ifdef CONFIG_SMP | 102 | #ifdef CONFIG_SMP |
89 | .set_cpu = gic_set_cpu, | 103 | .set_affinity = gic_set_cpu, |
90 | #endif | 104 | #endif |
91 | }; | 105 | }; |
92 | 106 | ||