aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerlando Falauto <gerlando.falauto@keymile.com>2013-05-06 10:30:19 -0400
committerThomas Gleixner <tglx@linutronix.de>2013-05-29 04:57:10 -0400
commit899f0e66fff36ebb6dd6a83af9aa631f6cb7e0dc (patch)
treeae6f3d0ee7f7c55c103aae9e987427709fe70b33
parentcfeaa93f8a13ae9117ae20933a38a406de80849e (diff)
genirq: Generic chip: Add support for per chip type mask cache
Today the same interrupt mask cache (stored within struct irq_chip_generic) is shared between all the irq_chip_type instances. As there are instances where each irq_chip_type uses a distinct mask register (as it is the case for Orion SoCs), sharing a single mask cache may be incorrect. So add a distinct pointer for each irq_chip_type, which for now points to the original mask register within irq_chip_generic. So no functional changes here. [ tglx: Minor cosmetic tweaks ] Reported-by: Joey Oravec <joravec@drewtech.com> Signed-off-by: Simon Guinot <sguinot@lacie.com> Signed-off-by: Holger Brunck <holger.brunck@keymile.com> Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com> Cc: Andrew Lunn <andrew@lunn.ch> 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.082226607@linutronix.de Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--include/linux/irq.h6
-rw-r--r--kernel/irq/generic-chip.c16
2 files changed, 15 insertions, 7 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h
index bc4e06611958..38709a3ab1c0 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -644,6 +644,8 @@ struct irq_chip_regs {
644 * @regs: Register offsets for this chip 644 * @regs: Register offsets for this chip
645 * @handler: Flow handler associated with this chip 645 * @handler: Flow handler associated with this chip
646 * @type: Chip can handle these flow types 646 * @type: Chip can handle these flow types
647 * @mask_cache_priv: Cached mask register private to the chip type
648 * @mask_cache: Pointer to cached mask register
647 * 649 *
648 * A irq_generic_chip can have several instances of irq_chip_type when 650 * A irq_generic_chip can have several instances of irq_chip_type when
649 * it requires different functions and register offsets for different 651 * it requires different functions and register offsets for different
@@ -654,6 +656,8 @@ struct irq_chip_type {
654 struct irq_chip_regs regs; 656 struct irq_chip_regs regs;
655 irq_flow_handler_t handler; 657 irq_flow_handler_t handler;
656 u32 type; 658 u32 type;
659 u32 mask_cache_priv;
660 u32 *mask_cache;
657}; 661};
658 662
659/** 663/**
@@ -662,7 +666,7 @@ struct irq_chip_type {
662 * @reg_base: Register base address (virtual) 666 * @reg_base: Register base address (virtual)
663 * @irq_base: Interrupt base nr for this chip 667 * @irq_base: Interrupt base nr for this chip
664 * @irq_cnt: Number of interrupts handled by this chip 668 * @irq_cnt: Number of interrupts handled by this chip
665 * @mask_cache: Cached mask register 669 * @mask_cache: Cached mask register shared between all chip types
666 * @type_cache: Cached type register 670 * @type_cache: Cached type register
667 * @polarity_cache: Cached polarity register 671 * @polarity_cache: Cached polarity register
668 * @wake_enabled: Interrupt can wakeup from suspend 672 * @wake_enabled: Interrupt can wakeup from suspend
diff --git a/kernel/irq/generic-chip.c b/kernel/irq/generic-chip.c
index 0e6ba789056c..113d9ebfe0aa 100644
--- a/kernel/irq/generic-chip.c
+++ b/kernel/irq/generic-chip.c
@@ -39,7 +39,7 @@ void irq_gc_mask_disable_reg(struct irq_data *d)
39 39
40 irq_gc_lock(gc); 40 irq_gc_lock(gc);
41 irq_reg_writel(mask, gc->reg_base + ct->regs.disable); 41 irq_reg_writel(mask, gc->reg_base + ct->regs.disable);
42 gc->mask_cache &= ~mask; 42 *ct->mask_cache &= ~mask;
43 irq_gc_unlock(gc); 43 irq_gc_unlock(gc);
44} 44}
45 45
@@ -57,8 +57,8 @@ void irq_gc_mask_set_bit(struct irq_data *d)
57 u32 mask = 1 << (d->irq - gc->irq_base); 57 u32 mask = 1 << (d->irq - gc->irq_base);
58 58
59 irq_gc_lock(gc); 59 irq_gc_lock(gc);
60 gc->mask_cache |= mask; 60 *ct->mask_cache |= mask;
61 irq_reg_writel(gc->mask_cache, gc->reg_base + ct->regs.mask); 61 irq_reg_writel(*ct->mask_cache, gc->reg_base + ct->regs.mask);
62 irq_gc_unlock(gc); 62 irq_gc_unlock(gc);
63} 63}
64 64
@@ -76,8 +76,8 @@ void irq_gc_mask_clr_bit(struct irq_data *d)
76 u32 mask = 1 << (d->irq - gc->irq_base); 76 u32 mask = 1 << (d->irq - gc->irq_base);
77 77
78 irq_gc_lock(gc); 78 irq_gc_lock(gc);
79 gc->mask_cache &= ~mask; 79 *ct->mask_cache &= ~mask;
80 irq_reg_writel(gc->mask_cache, gc->reg_base + ct->regs.mask); 80 irq_reg_writel(*ct->mask_cache, gc->reg_base + ct->regs.mask);
81 irq_gc_unlock(gc); 81 irq_gc_unlock(gc);
82} 82}
83 83
@@ -96,7 +96,7 @@ void irq_gc_unmask_enable_reg(struct irq_data *d)
96 96
97 irq_gc_lock(gc); 97 irq_gc_lock(gc);
98 irq_reg_writel(mask, gc->reg_base + ct->regs.enable); 98 irq_reg_writel(mask, gc->reg_base + ct->regs.enable);
99 gc->mask_cache |= mask; 99 *ct->mask_cache |= mask;
100 irq_gc_unlock(gc); 100 irq_gc_unlock(gc);
101} 101}
102 102
@@ -250,6 +250,10 @@ void irq_setup_generic_chip(struct irq_chip_generic *gc, u32 msk,
250 if (flags & IRQ_GC_INIT_MASK_CACHE) 250 if (flags & IRQ_GC_INIT_MASK_CACHE)
251 gc->mask_cache = irq_reg_readl(gc->reg_base + ct->regs.mask); 251 gc->mask_cache = irq_reg_readl(gc->reg_base + ct->regs.mask);
252 252
253 /* Initialize mask cache pointer */
254 for (i = 0; i < gc->num_ct; i++)
255 ct[i].mask_cache = &gc->mask_cache;
256
253 for (i = gc->irq_base; msk; msk >>= 1, i++) { 257 for (i = gc->irq_base; msk; msk >>= 1, i++) {
254 if (!(msk & 0x01)) 258 if (!(msk & 0x01))
255 continue; 259 continue;