74
87
static void gic_ack_irq(struct irq_data *d)
76
89
spin_lock(&irq_controller_lock);
90
if (gic_arch_extn.irq_ack)
91
gic_arch_extn.irq_ack(d);
77
92
writel(gic_irq(d), gic_cpu_base(d) + GIC_CPU_EOI);
78
93
spin_unlock(&irq_controller_lock);
85
100
spin_lock(&irq_controller_lock);
86
101
writel(mask, gic_dist_base(d) + GIC_DIST_ENABLE_CLEAR + (gic_irq(d) / 32) * 4);
102
if (gic_arch_extn.irq_mask)
103
gic_arch_extn.irq_mask(d);
87
104
spin_unlock(&irq_controller_lock);
92
109
u32 mask = 1 << (d->irq % 32);
94
111
spin_lock(&irq_controller_lock);
112
if (gic_arch_extn.irq_unmask)
113
gic_arch_extn.irq_unmask(d);
95
114
writel(mask, gic_dist_base(d) + GIC_DIST_ENABLE_SET + (gic_irq(d) / 32) * 4);
96
115
spin_unlock(&irq_controller_lock);
117
136
spin_lock(&irq_controller_lock);
138
if (gic_arch_extn.irq_set_type)
139
gic_arch_extn.irq_set_type(d, type);
119
141
val = readl(base + GIC_DIST_CONFIG + confoff);
120
142
if (type == IRQ_TYPE_LEVEL_HIGH)
121
143
val &= ~confmask;
166
static int gic_retrigger(struct irq_data *d)
168
if (gic_arch_extn.irq_retrigger)
169
return gic_arch_extn.irq_retrigger(d);
144
174
#ifdef CONFIG_SMP
146
gic_set_cpu(struct irq_data *d, const struct cpumask *mask_val, bool force)
175
static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
148
178
void __iomem *reg = gic_dist_base(d) + GIC_DIST_TARGET + (gic_irq(d) & ~3);
149
179
unsigned int shift = (d->irq % 4) * 8;
150
180
unsigned int cpu = cpumask_first(mask_val);
152
struct irq_desc *desc;
186
mask = 0xff << shift;
187
bit = 1 << (cpu + shift);
154
189
spin_lock(&irq_controller_lock);
155
desc = irq_to_desc(d->irq);
157
spin_unlock(&irq_controller_lock);
161
val = readl(reg) & ~(0xff << shift);
162
val |= 1 << (cpu + shift);
191
val = readl(reg) & ~mask;
192
writel(val | bit, reg);
164
193
spin_unlock(&irq_controller_lock);
200
static int gic_set_wake(struct irq_data *d, unsigned int on)
204
if (gic_arch_extn.irq_set_wake)
205
ret = gic_arch_extn.irq_set_wake(d, on);
211
#define gic_set_wake NULL
170
214
static void gic_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
172
216
struct gic_chip_data *chip_data = get_irq_data(irq);
202
246
.irq_mask = gic_mask_irq,
203
247
.irq_unmask = gic_unmask_irq,
204
248
.irq_set_type = gic_set_type,
249
.irq_retrigger = gic_retrigger,
205
250
#ifdef CONFIG_SMP
206
.irq_set_affinity = gic_set_cpu,
251
.irq_set_affinity = gic_set_affinity,
253
.irq_set_wake = gic_set_wake,
210
256
void __init gic_cascade_irq(unsigned int gic_nr, unsigned int irq)