aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/common/vic.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/common/vic.c')
-rw-r--r--arch/arm/common/vic.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/arch/arm/common/vic.c b/arch/arm/common/vic.c
index c558a3e7f52e..e0d538803cc3 100644
--- a/arch/arm/common/vic.c
+++ b/arch/arm/common/vic.c
@@ -39,6 +39,7 @@
39 * struct vic_device - VIC PM device 39 * struct vic_device - VIC PM device
40 * @irq: The IRQ number for the base of the VIC. 40 * @irq: The IRQ number for the base of the VIC.
41 * @base: The register base for the VIC. 41 * @base: The register base for the VIC.
42 * @valid_sources: A bitmask of valid interrupts
42 * @resume_sources: A bitmask of interrupts for resume. 43 * @resume_sources: A bitmask of interrupts for resume.
43 * @resume_irqs: The IRQs enabled for resume. 44 * @resume_irqs: The IRQs enabled for resume.
44 * @int_select: Save for VIC_INT_SELECT. 45 * @int_select: Save for VIC_INT_SELECT.
@@ -50,6 +51,7 @@
50struct vic_device { 51struct vic_device {
51 void __iomem *base; 52 void __iomem *base;
52 int irq; 53 int irq;
54 u32 valid_sources;
53 u32 resume_sources; 55 u32 resume_sources;
54 u32 resume_irqs; 56 u32 resume_irqs;
55 u32 int_select; 57 u32 int_select;
@@ -164,6 +166,27 @@ static int __init vic_pm_init(void)
164late_initcall(vic_pm_init); 166late_initcall(vic_pm_init);
165#endif /* CONFIG_PM */ 167#endif /* CONFIG_PM */
166 168
169static struct irq_chip vic_chip;
170
171static int vic_irqdomain_map(struct irq_domain *d, unsigned int irq,
172 irq_hw_number_t hwirq)
173{
174 struct vic_device *v = d->host_data;
175
176 /* Skip invalid IRQs, only register handlers for the real ones */
177 if (!(v->valid_sources & (1 << hwirq)))
178 return -ENOTSUPP;
179 irq_set_chip_and_handler(irq, &vic_chip, handle_level_irq);
180 irq_set_chip_data(irq, v->base);
181 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
182 return 0;
183}
184
185static struct irq_domain_ops vic_irqdomain_ops = {
186 .map = vic_irqdomain_map,
187 .xlate = irq_domain_xlate_onetwocell,
188};
189
167/** 190/**
168 * vic_register() - Register a VIC. 191 * vic_register() - Register a VIC.
169 * @base: The base address of the VIC. 192 * @base: The base address of the VIC.
@@ -191,6 +214,7 @@ static void __init vic_register(void __iomem *base, unsigned int irq,
191 214
192 v = &vic_devices[vic_id]; 215 v = &vic_devices[vic_id];
193 v->base = base; 216 v->base = base;
217 v->valid_sources = valid_sources;
194 v->resume_sources = resume_sources; 218 v->resume_sources = resume_sources;
195 v->irq = irq; 219 v->irq = irq;
196 vic_id++; 220 vic_id++;
@@ -289,23 +313,6 @@ static void __init vic_clear_interrupts(void __iomem *base)
289 } 313 }
290} 314}
291 315
292static void __init vic_set_irq_sources(void __iomem *base,
293 unsigned int irq_start, u32 vic_sources)
294{
295 unsigned int i;
296
297 for (i = 0; i < 32; i++) {
298 if (vic_sources & (1 << i)) {
299 unsigned int irq = irq_start + i;
300
301 irq_set_chip_and_handler(irq, &vic_chip,
302 handle_level_irq);
303 irq_set_chip_data(irq, base);
304 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
305 }
306 }
307}
308
309/* 316/*
310 * The PL190 cell from ARM has been modified by ST to handle 64 interrupts. 317 * The PL190 cell from ARM has been modified by ST to handle 64 interrupts.
311 * The original cell has 32 interrupts, while the modified one has 64, 318 * The original cell has 32 interrupts, while the modified one has 64,
@@ -340,7 +347,6 @@ static void __init vic_init_st(void __iomem *base, unsigned int irq_start,
340 writel(32, base + VIC_PL190_DEF_VECT_ADDR); 347 writel(32, base + VIC_PL190_DEF_VECT_ADDR);
341 } 348 }
342 349
343 vic_set_irq_sources(base, irq_start, vic_sources);
344 vic_register(base, irq_start, vic_sources, 0, node); 350 vic_register(base, irq_start, vic_sources, 0, node);
345} 351}
346 352
@@ -381,8 +387,6 @@ void __init __vic_init(void __iomem *base, unsigned int irq_start,
381 387
382 vic_init2(base); 388 vic_init2(base);
383 389
384 vic_set_irq_sources(base, irq_start, vic_sources);
385
386 vic_register(base, irq_start, vic_sources, resume_sources, node); 390 vic_register(base, irq_start, vic_sources, resume_sources, node);
387} 391}
388 392