aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/common/gic.c
diff options
context:
space:
mode:
authorLennert Buytenhek <buytenh@wantstofly.org>2010-11-29 04:18:20 -0500
committerLennert Buytenhek <buytenh@wantstofly.org>2011-01-13 11:18:16 -0500
commit7d1f4288ac077b3fc734acd1e034b288b1b9d3d2 (patch)
tree18aec59832406d87d732a30f27d6c59ad63ae033 /arch/arm/common/gic.c
parent4a87bac4c9b3291ade91fe4fc1382f22dd9e9e91 (diff)
ARM: gic: irq_data conversion.
Signed-off-by: Lennert Buytenhek <buytenh@secretlab.ca> Acked-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Diffstat (limited to 'arch/arm/common/gic.c')
-rw-r--r--arch/arm/common/gic.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c
index 0b89ef001330..224377211151 100644
--- a/arch/arm/common/gic.c
+++ b/arch/arm/common/gic.c
@@ -50,57 +50,56 @@ struct gic_chip_data {
50 50
51static struct gic_chip_data gic_data[MAX_GIC_NR] __read_mostly; 51static struct gic_chip_data gic_data[MAX_GIC_NR] __read_mostly;
52 52
53static inline void __iomem *gic_dist_base(unsigned int irq) 53static inline void __iomem *gic_dist_base(struct irq_data *d)
54{ 54{
55 struct gic_chip_data *gic_data = get_irq_chip_data(irq); 55 struct gic_chip_data *gic_data = irq_data_get_irq_chip_data(d);
56 return gic_data->dist_base; 56 return gic_data->dist_base;
57} 57}
58 58
59static inline void __iomem *gic_cpu_base(unsigned int irq) 59static inline void __iomem *gic_cpu_base(struct irq_data *d)
60{ 60{
61 struct gic_chip_data *gic_data = get_irq_chip_data(irq); 61 struct gic_chip_data *gic_data = irq_data_get_irq_chip_data(d);
62 return gic_data->cpu_base; 62 return gic_data->cpu_base;
63} 63}
64 64
65static inline unsigned int gic_irq(unsigned int irq) 65static inline unsigned int gic_irq(struct irq_data *d)
66{ 66{
67 struct gic_chip_data *gic_data = get_irq_chip_data(irq); 67 struct gic_chip_data *gic_data = irq_data_get_irq_chip_data(d);
68 return irq - gic_data->irq_offset; 68 return d->irq - gic_data->irq_offset;
69} 69}
70 70
71/* 71/*
72 * Routines to acknowledge, disable and enable interrupts 72 * Routines to acknowledge, disable and enable interrupts
73 */ 73 */
74static void gic_ack_irq(unsigned int irq) 74static void gic_ack_irq(struct irq_data *d)
75{ 75{
76
77 spin_lock(&irq_controller_lock); 76 spin_lock(&irq_controller_lock);
78 writel(gic_irq(irq), gic_cpu_base(irq) + GIC_CPU_EOI); 77 writel(gic_irq(d), gic_cpu_base(d) + GIC_CPU_EOI);
79 spin_unlock(&irq_controller_lock); 78 spin_unlock(&irq_controller_lock);
80} 79}
81 80
82static void gic_mask_irq(unsigned int irq) 81static void gic_mask_irq(struct irq_data *d)
83{ 82{
84 u32 mask = 1 << (irq % 32); 83 u32 mask = 1 << (d->irq % 32);
85 84
86 spin_lock(&irq_controller_lock); 85 spin_lock(&irq_controller_lock);
87 writel(mask, gic_dist_base(irq) + GIC_DIST_ENABLE_CLEAR + (gic_irq(irq) / 32) * 4); 86 writel(mask, gic_dist_base(d) + GIC_DIST_ENABLE_CLEAR + (gic_irq(d) / 32) * 4);
88 spin_unlock(&irq_controller_lock); 87 spin_unlock(&irq_controller_lock);
89} 88}
90 89
91static void gic_unmask_irq(unsigned int irq) 90static void gic_unmask_irq(struct irq_data *d)
92{ 91{
93 u32 mask = 1 << (irq % 32); 92 u32 mask = 1 << (d->irq % 32);
94 93
95 spin_lock(&irq_controller_lock); 94 spin_lock(&irq_controller_lock);
96 writel(mask, gic_dist_base(irq) + GIC_DIST_ENABLE_SET + (gic_irq(irq) / 32) * 4); 95 writel(mask, gic_dist_base(d) + GIC_DIST_ENABLE_SET + (gic_irq(d) / 32) * 4);
97 spin_unlock(&irq_controller_lock); 96 spin_unlock(&irq_controller_lock);
98} 97}
99 98
100static int gic_set_type(unsigned int irq, unsigned int type) 99static int gic_set_type(struct irq_data *d, unsigned int type)
101{ 100{
102 void __iomem *base = gic_dist_base(irq); 101 void __iomem *base = gic_dist_base(d);
103 unsigned int gicirq = gic_irq(irq); 102 unsigned int gicirq = gic_irq(d);
104 u32 enablemask = 1 << (gicirq % 32); 103 u32 enablemask = 1 << (gicirq % 32);
105 u32 enableoff = (gicirq / 32) * 4; 104 u32 enableoff = (gicirq / 32) * 4;
106 u32 confmask = 0x2 << ((gicirq % 16) * 2); 105 u32 confmask = 0x2 << ((gicirq % 16) * 2);
@@ -143,21 +142,22 @@ static int gic_set_type(unsigned int irq, unsigned int type)
143} 142}
144 143
145#ifdef CONFIG_SMP 144#ifdef CONFIG_SMP
146static int gic_set_cpu(unsigned int irq, const struct cpumask *mask_val) 145static int
146gic_set_cpu(struct irq_data *d, const struct cpumask *mask_val, bool force)
147{ 147{
148 void __iomem *reg = gic_dist_base(irq) + GIC_DIST_TARGET + (gic_irq(irq) & ~3); 148 void __iomem *reg = gic_dist_base(d) + GIC_DIST_TARGET + (gic_irq(d) & ~3);
149 unsigned int shift = (irq % 4) * 8; 149 unsigned int shift = (d->irq % 4) * 8;
150 unsigned int cpu = cpumask_first(mask_val); 150 unsigned int cpu = cpumask_first(mask_val);
151 u32 val; 151 u32 val;
152 struct irq_desc *desc; 152 struct irq_desc *desc;
153 153
154 spin_lock(&irq_controller_lock); 154 spin_lock(&irq_controller_lock);
155 desc = irq_to_desc(irq); 155 desc = irq_to_desc(d->irq);
156 if (desc == NULL) { 156 if (desc == NULL) {
157 spin_unlock(&irq_controller_lock); 157 spin_unlock(&irq_controller_lock);
158 return -EINVAL; 158 return -EINVAL;
159 } 159 }
160 desc->node = cpu; 160 d->node = cpu;
161 val = readl(reg) & ~(0xff << shift); 161 val = readl(reg) & ~(0xff << shift);
162 val |= 1 << (cpu + shift); 162 val |= 1 << (cpu + shift);
163 writel(val, reg); 163 writel(val, reg);
@@ -175,7 +175,7 @@ static void gic_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
175 unsigned long status; 175 unsigned long status;
176 176
177 /* primary controller ack'ing */ 177 /* primary controller ack'ing */
178 chip->ack(irq); 178 chip->irq_ack(&desc->irq_data);
179 179
180 spin_lock(&irq_controller_lock); 180 spin_lock(&irq_controller_lock);
181 status = readl(chip_data->cpu_base + GIC_CPU_INTACK); 181 status = readl(chip_data->cpu_base + GIC_CPU_INTACK);
@@ -193,17 +193,17 @@ static void gic_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
193 193
194 out: 194 out:
195 /* primary controller unmasking */ 195 /* primary controller unmasking */
196 chip->unmask(irq); 196 chip->irq_unmask(&desc->irq_data);
197} 197}
198 198
199static struct irq_chip gic_chip = { 199static struct irq_chip gic_chip = {
200 .name = "GIC", 200 .name = "GIC",
201 .ack = gic_ack_irq, 201 .irq_ack = gic_ack_irq,
202 .mask = gic_mask_irq, 202 .irq_mask = gic_mask_irq,
203 .unmask = gic_unmask_irq, 203 .irq_unmask = gic_unmask_irq,
204 .set_type = gic_set_type, 204 .irq_set_type = gic_set_type,
205#ifdef CONFIG_SMP 205#ifdef CONFIG_SMP
206 .set_affinity = gic_set_cpu, 206 .irq_set_affinity = gic_set_cpu,
207#endif 207#endif
208}; 208};
209 209
@@ -337,7 +337,7 @@ void __cpuinit gic_enable_ppi(unsigned int irq)
337 337
338 local_irq_save(flags); 338 local_irq_save(flags);
339 irq_to_desc(irq)->status |= IRQ_NOPROBE; 339 irq_to_desc(irq)->status |= IRQ_NOPROBE;
340 gic_unmask_irq(irq); 340 gic_unmask_irq(irq_get_irq_data(irq));
341 local_irq_restore(flags); 341 local_irq_restore(flags);
342} 342}
343 343