diff options
author | Gerlando Falauto <gerlando.falauto@keymile.com> | 2013-05-06 10:30:21 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2013-05-29 04:57:10 -0400 |
commit | af80b0fed67261dcba2ce2406db1d553d07cbe75 (patch) | |
tree | 002d93bdc9e20eb11602e6ed3792e743f5a8e869 | |
parent | 899f0e66fff36ebb6dd6a83af9aa631f6cb7e0dc (diff) |
genirq: Generic chip: Handle separate mask registers
There are cases where all irq_chip_type instances have separate mask
registers, making a shared mask register cache unsuitable for the
purpose.
Introduce a new flag IRQ_GC_MASK_CACHE_PER_TYPE. If set, point the per
chip mask pointer to the per chip private mask cache instead.
[ tglx: Simplified code, renamed flag and massaged changelog ]
Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Joey Oravec <joravec@drewtech.com>
Cc: Lennert Buytenhek <kernel@wantstofly.org>
Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Cc: Holger Brunck <Holger.Brunck@keymile.com>
Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Acked-by: Grant Likely <grant.likely@linaro.org>
Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: devicetree-discuss@lists.ozlabs.org
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Gregory Clement <gregory.clement@free-electrons.com>
Cc: Simon Guinot <simon@sequanux.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Jean-Francois Moine <moinejf@free.fr>
Cc: Nicolas Pitre <nico@fluxnic.net>
Cc: Rob Landley <rob@landley.net>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: http://lkml.kernel.org/r/20130506142539.152569748@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | include/linux/irq.h | 2 | ||||
-rw-r--r-- | kernel/irq/generic-chip.c | 17 |
2 files changed, 12 insertions, 7 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h index 38709a3ab1c0..7f1f0157fd00 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -704,10 +704,12 @@ struct irq_chip_generic { | |||
704 | * @IRQ_GC_INIT_NESTED_LOCK: Set the lock class of the irqs to nested for | 704 | * @IRQ_GC_INIT_NESTED_LOCK: Set the lock class of the irqs to nested for |
705 | * irq chips which need to call irq_set_wake() on | 705 | * irq chips which need to call irq_set_wake() on |
706 | * the parent irq. Usually GPIO implementations | 706 | * the parent irq. Usually GPIO implementations |
707 | * @IRQ_GC_MASK_CACHE_PER_TYPE: Mask cache is chip type private | ||
707 | */ | 708 | */ |
708 | enum irq_gc_flags { | 709 | enum irq_gc_flags { |
709 | IRQ_GC_INIT_MASK_CACHE = 1 << 0, | 710 | IRQ_GC_INIT_MASK_CACHE = 1 << 0, |
710 | IRQ_GC_INIT_NESTED_LOCK = 1 << 1, | 711 | IRQ_GC_INIT_NESTED_LOCK = 1 << 1, |
712 | IRQ_GC_MASK_CACHE_PER_TYPE = 1 << 2, | ||
711 | }; | 713 | }; |
712 | 714 | ||
713 | /* Generic chip callback functions */ | 715 | /* Generic chip callback functions */ |
diff --git a/kernel/irq/generic-chip.c b/kernel/irq/generic-chip.c index 113d9ebfe0aa..da2a94191fc5 100644 --- a/kernel/irq/generic-chip.c +++ b/kernel/irq/generic-chip.c | |||
@@ -241,18 +241,21 @@ void irq_setup_generic_chip(struct irq_chip_generic *gc, u32 msk, | |||
241 | { | 241 | { |
242 | struct irq_chip_type *ct = gc->chip_types; | 242 | struct irq_chip_type *ct = gc->chip_types; |
243 | unsigned int i; | 243 | unsigned int i; |
244 | u32 *mskptr = &gc->mask_cache, mskreg = ct->regs.mask; | ||
244 | 245 | ||
245 | raw_spin_lock(&gc_lock); | 246 | raw_spin_lock(&gc_lock); |
246 | list_add_tail(&gc->list, &gc_list); | 247 | list_add_tail(&gc->list, &gc_list); |
247 | raw_spin_unlock(&gc_lock); | 248 | raw_spin_unlock(&gc_lock); |
248 | 249 | ||
249 | /* Init mask cache ? */ | 250 | for (i = 0; i < gc->num_ct; i++) { |
250 | if (flags & IRQ_GC_INIT_MASK_CACHE) | 251 | if (flags & IRQ_GC_MASK_CACHE_PER_TYPE) { |
251 | gc->mask_cache = irq_reg_readl(gc->reg_base + ct->regs.mask); | 252 | mskptr = &ct[i].mask_cache_priv; |
252 | 253 | mskreg = ct[i].regs.mask; | |
253 | /* Initialize mask cache pointer */ | 254 | } |
254 | for (i = 0; i < gc->num_ct; i++) | 255 | ct[i].mask_cache = mskptr; |
255 | ct[i].mask_cache = &gc->mask_cache; | 256 | if (flags & IRQ_GC_INIT_MASK_CACHE) |
257 | *mskptr = irq_reg_readl(gc->reg_base + mskreg); | ||
258 | } | ||
256 | 259 | ||
257 | for (i = gc->irq_base; msk; msk >>= 1, i++) { | 260 | for (i = gc->irq_base; msk; msk >>= 1, i++) { |
258 | if (!(msk & 0x01)) | 261 | if (!(msk & 0x01)) |