diff options
| author | Thomas Gleixner <tglx@linutronix.de> | 2013-05-06 10:30:24 -0400 |
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2013-05-29 04:57:10 -0400 |
| commit | d0051816e619f8f082582bec07ffa51bdb4f2104 (patch) | |
| tree | 5ae8874599ad25d7ac35847f7a25c44a70e2a5b7 | |
| parent | 966dc736b819999cd2d3a6408d47d33b579f7d56 (diff) | |
genirq: irqchip: Add a mask calculation function
Some chips have weird bit mask access patterns instead of the linear
you expect. Allow them to calculate the cached mask themself.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Jean-Francois Moine <moinejf@free.fr>
Cc: devicetree-discuss@lists.ozlabs.org
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Cc: Gregory Clement <gregory.clement@free-electrons.com>
Cc: Gerlando Falauto <gerlando.falauto@keymile.com>
Cc: Rob Landley <rob@landley.net>
Acked-by: Grant Likely <grant.likely@linaro.org>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Link: http://lkml.kernel.org/r/20130506142539.302898834@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
| -rw-r--r-- | include/linux/irq.h | 3 | ||||
| -rw-r--r-- | kernel/irq/generic-chip.c | 8 |
2 files changed, 9 insertions, 2 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h index d5fc7f5a49b8..ab8169faaa65 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
| @@ -296,6 +296,7 @@ static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d) | |||
| 296 | * @irq_suspend: function called from core code on suspend once per chip | 296 | * @irq_suspend: function called from core code on suspend once per chip |
| 297 | * @irq_resume: function called from core code on resume once per chip | 297 | * @irq_resume: function called from core code on resume once per chip |
| 298 | * @irq_pm_shutdown: function called from core code on shutdown once per chip | 298 | * @irq_pm_shutdown: function called from core code on shutdown once per chip |
| 299 | * @irq_calc_mask: Optional function to set irq_data.mask for special cases | ||
| 299 | * @irq_print_chip: optional to print special chip info in show_interrupts | 300 | * @irq_print_chip: optional to print special chip info in show_interrupts |
| 300 | * @flags: chip specific flags | 301 | * @flags: chip specific flags |
| 301 | */ | 302 | */ |
| @@ -327,6 +328,8 @@ struct irq_chip { | |||
| 327 | void (*irq_resume)(struct irq_data *data); | 328 | void (*irq_resume)(struct irq_data *data); |
| 328 | void (*irq_pm_shutdown)(struct irq_data *data); | 329 | void (*irq_pm_shutdown)(struct irq_data *data); |
| 329 | 330 | ||
| 331 | void (*irq_calc_mask)(struct irq_data *data); | ||
| 332 | |||
| 330 | void (*irq_print_chip)(struct irq_data *data, struct seq_file *p); | 333 | void (*irq_print_chip)(struct irq_data *data, struct seq_file *p); |
| 331 | 334 | ||
| 332 | unsigned long flags; | 335 | unsigned long flags; |
diff --git a/kernel/irq/generic-chip.c b/kernel/irq/generic-chip.c index 957155cebbac..5068fe3ae1af 100644 --- a/kernel/irq/generic-chip.c +++ b/kernel/irq/generic-chip.c | |||
| @@ -240,6 +240,7 @@ void irq_setup_generic_chip(struct irq_chip_generic *gc, u32 msk, | |||
| 240 | unsigned int set) | 240 | unsigned int set) |
| 241 | { | 241 | { |
| 242 | struct irq_chip_type *ct = gc->chip_types; | 242 | struct irq_chip_type *ct = gc->chip_types; |
| 243 | struct irq_chip *chip = &ct->chip; | ||
| 243 | unsigned int i; | 244 | unsigned int i; |
| 244 | u32 *mskptr = &gc->mask_cache, mskreg = ct->regs.mask; | 245 | u32 *mskptr = &gc->mask_cache, mskreg = ct->regs.mask; |
| 245 | 246 | ||
| @@ -267,9 +268,12 @@ void irq_setup_generic_chip(struct irq_chip_generic *gc, u32 msk, | |||
| 267 | if (!(flags & IRQ_GC_NO_MASK)) { | 268 | if (!(flags & IRQ_GC_NO_MASK)) { |
| 268 | struct irq_data *d = irq_get_irq_data(i); | 269 | struct irq_data *d = irq_get_irq_data(i); |
| 269 | 270 | ||
| 270 | d->mask = 1 << (i - gc->irq_base); | 271 | if (chip->irq_calc_mask) |
| 272 | chip->irq_calc_mask(d); | ||
| 273 | else | ||
| 274 | d->mask = 1 << (i - gc->irq_base); | ||
| 271 | } | 275 | } |
| 272 | irq_set_chip_and_handler(i, &ct->chip, ct->handler); | 276 | irq_set_chip_and_handler(i, chip, ct->handler); |
| 273 | irq_set_chip_data(i, gc); | 277 | irq_set_chip_data(i, gc); |
| 274 | irq_modify_status(i, clr, set); | 278 | irq_modify_status(i, clr, set); |
| 275 | } | 279 | } |
