aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/common
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2012-04-20 03:02:36 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-04-25 07:57:07 -0400
commitce94df9c099d2a828610576f31dddfa552243edc (patch)
tree9d6026e4f6be2305886ad2a78c7bc11039504d14 /arch/arm/common
parentfa943bed68c85e1ebac4b9dd6398ad6fd0f53567 (diff)
ARM: 7395/1: VIC: use the domain mapping function to assign handlers
This removes the internal functions for assigning IRQ handlers to each interrupt in favor of using the internal map iterator in the irq domain code. Cc: Will Deacon <will.deacon@arm.com> Cc: Grant Likely <grant.likely@secretlab.ca> Cc: Rob Herring <rob.herring@calxeda.com> Acked-by: Jamie Iles <jamie@jamieiles.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/common')
-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