All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] genirq: allow an alternative setup for the mask cache
@ 2013-03-14 16:10 Holger Brunck
  2013-03-14 17:45 ` Simon Guinot
                   ` (4 more replies)
  0 siblings, 5 replies; 45+ messages in thread
From: Holger Brunck @ 2013-03-14 16:10 UTC (permalink / raw)
  To: linux-arm-kernel

The same interrupt mask cache (stored within struct irq_chip_generic)
is shared between all the irq_chip_type instances by default. But this
does not work on Orion SOCs which have separate mask registers for edge
and level interrupts. Therefore refactor the code that we always use a
pointer to access the mask register. By default it points to
gc->mask_cache for Orion SOCs it points to ct->mask_cache which is
setup in irq_setup_alt_chip().

Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
---
 include/linux/irq.h       |    3 +++
 kernel/irq/generic-chip.c |   19 ++++++++++++-------
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/include/linux/irq.h b/include/linux/irq.h
index bc4e066..6bf2447 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -654,6 +654,7 @@ struct irq_chip_type {
 	struct irq_chip_regs	regs;
 	irq_flow_handler_t	handler;
 	u32			type;
+	u32			mask_cache;
 };
 
 /**
@@ -663,6 +664,7 @@ struct irq_chip_type {
  * @irq_base:		Interrupt base nr for this chip
  * @irq_cnt:		Number of interrupts handled by this chip
  * @mask_cache:		Cached mask register
+ * @pmask_cache:	pointer to cached mask register
  * @type_cache:		Cached type register
  * @polarity_cache:	Cached polarity register
  * @wake_enabled:	Interrupt can wakeup from suspend
@@ -684,6 +686,7 @@ struct irq_chip_generic {
 	unsigned int		irq_base;
 	unsigned int		irq_cnt;
 	u32			mask_cache;
+	u32			*pmask_cache;
 	u32			type_cache;
 	u32			polarity_cache;
 	u32			wake_enabled;
diff --git a/kernel/irq/generic-chip.c b/kernel/irq/generic-chip.c
index c89295a..1be14a3 100644
--- a/kernel/irq/generic-chip.c
+++ b/kernel/irq/generic-chip.c
@@ -43,7 +43,7 @@ void irq_gc_mask_disable_reg(struct irq_data *d)
 
 	irq_gc_lock(gc);
 	irq_reg_writel(mask, gc->reg_base + cur_regs(d)->disable);
-	gc->mask_cache &= ~mask;
+	*gc->pmask_cache &= ~mask;
 	irq_gc_unlock(gc);
 }
 
@@ -60,8 +60,8 @@ void irq_gc_mask_set_bit(struct irq_data *d)
 	u32 mask = 1 << (d->irq - gc->irq_base);
 
 	irq_gc_lock(gc);
-	gc->mask_cache |= mask;
-	irq_reg_writel(gc->mask_cache, gc->reg_base + cur_regs(d)->mask);
+	*gc->pmask_cache |= mask;
+	irq_reg_writel(*gc->pmask_cache, gc->reg_base + cur_regs(d)->mask);
 	irq_gc_unlock(gc);
 }
 
@@ -78,8 +78,8 @@ void irq_gc_mask_clr_bit(struct irq_data *d)
 	u32 mask = 1 << (d->irq - gc->irq_base);
 
 	irq_gc_lock(gc);
-	gc->mask_cache &= ~mask;
-	irq_reg_writel(gc->mask_cache, gc->reg_base + cur_regs(d)->mask);
+	*gc->pmask_cache &= ~mask;
+	irq_reg_writel(*gc->pmask_cache, gc->reg_base + cur_regs(d)->mask);
 	irq_gc_unlock(gc);
 }
 
@@ -97,7 +97,7 @@ void irq_gc_unmask_enable_reg(struct irq_data *d)
 
 	irq_gc_lock(gc);
 	irq_reg_writel(mask, gc->reg_base + cur_regs(d)->enable);
-	gc->mask_cache |= mask;
+	*gc->pmask_cache |= mask;
 	irq_gc_unlock(gc);
 }
 
@@ -243,9 +243,12 @@ void irq_setup_generic_chip(struct irq_chip_generic *gc, u32 msk,
 	list_add_tail(&gc->list, &gc_list);
 	raw_spin_unlock(&gc_lock);
 
+	/* Setup pointer to mask_cache */
+	gc->pmask_cache = &gc->mask_cache;
+
 	/* Init mask cache ? */
 	if (flags & IRQ_GC_INIT_MASK_CACHE)
-		gc->mask_cache = irq_reg_readl(gc->reg_base + ct->regs.mask);
+		*gc->pmask_cache = irq_reg_readl(gc->reg_base + ct->regs.mask);
 
 	for (i = gc->irq_base; msk; msk >>= 1, i++) {
 		if (!(msk & 0x01))
@@ -275,6 +278,8 @@ int irq_setup_alt_chip(struct irq_data *d, unsigned int type)
 	struct irq_chip_type *ct = gc->chip_types;
 	unsigned int i;
 
+	/* Setup pointer to the mask_cache */
+	gc->pmask_cache = &ct->mask_cache;
 	for (i = 0; i < gc->num_ct; i++, ct++) {
 		if (ct->type & type) {
 			d->chip = &ct->chip;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2013-04-04  9:31 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-14 16:10 [PATCH] genirq: allow an alternative setup for the mask cache Holger Brunck
2013-03-14 17:45 ` Simon Guinot
2013-03-15 10:43   ` Holger Brunck
2013-03-15 11:02     ` Thomas Gleixner
2013-03-15 16:26   ` Gerlando Falauto
2013-03-15 19:55     ` Thomas Gleixner
2013-03-14 19:08 ` Thomas Gleixner
2013-03-14 19:42 ` Ezequiel Garcia
2013-03-18 11:05   ` Gerlando Falauto
2013-03-15 19:36 ` [PATCH v2 0/2] refactoring for mask_cache Gerlando Falauto
2013-03-15 19:36   ` [PATCH 1/2] genirq: cosmetic: remove cur_regs Gerlando Falauto
2013-03-15 19:36   ` [PATCH 2/2] genirq: move mask_cache into struct irq_chip_type Gerlando Falauto
2013-03-15 20:47     ` Thomas Gleixner
2013-03-18  7:59       ` Gerlando Falauto
2013-03-18  8:56         ` Thomas Gleixner
2013-03-15 21:25   ` [PATCH v2 0/2] refactoring for mask_cache Andrew Lunn
2013-03-15 23:34     ` Simon Guinot
2013-03-18 14:00 ` [PATCH v3 0/9] " Gerlando Falauto
2013-03-18 14:00   ` [PATCH v3 1/9] genirq: cosmetic: remove cur_regs Gerlando Falauto
2013-03-18 14:00   ` [PATCH v3 2/9] genirq: add mask_cache and pmask_cache into struct irq_chip_type Gerlando Falauto
2013-03-19 11:32     ` Thomas Gleixner
2013-03-18 14:00   ` [PATCH v3 3/9] gpio: mvebu: convert to usage of *pmask_cache within irq_chip_type Gerlando Falauto
2013-03-18 14:00   ` [PATCH v3 4/9] MIPS: JZ4740: " Gerlando Falauto
2013-03-18 14:00   ` [PATCH v3 5/9] ARM: SAMSUNG: " Gerlando Falauto
2013-03-18 14:00   ` [PATCH v3 6/9] genirq: rename mask_cache to shared_mask_cache Gerlando Falauto
2013-03-18 14:00   ` [PATCH v3 7/9] genirq: handle separate mask registers Gerlando Falauto
2013-03-18 14:00   ` [PATCH v3 8/9] orion-gpio: enable IRQ_GC_SEPARATE_MASK_REGISTERS Gerlando Falauto
2013-03-18 14:00   ` [PATCH v3 9/9] gpio: mvebu: " Gerlando Falauto
2013-03-18 14:28   ` [PATCH v3 0/9] refactoring for mask_cache Simon Guinot
2013-03-18 14:39     ` Simon Guinot
2013-03-19 10:03   ` Ezequiel Garcia
2013-03-19 10:09     ` Gerlando Falauto
2013-03-19 11:25       ` Ezequiel Garcia
2013-03-19 11:06     ` Jason Cooper
2013-03-19 11:10       ` Gerlando Falauto
2013-03-19 11:44         ` Jason Cooper
2013-03-19 11:56           ` Jason Cooper
2013-03-20 17:40             ` Gerlando Falauto
2013-03-20 21:42               ` Thomas Gleixner
2013-03-21 10:37                 ` Gerlando Falauto
2013-03-21 10:59               ` Simon Guinot
2013-03-19 11:19       ` Ezequiel Garcia
2013-03-21 10:51   ` Simon Guinot
2013-03-21 11:24     ` Gerlando Falauto
2013-04-04  9:31   ` Ezequiel Garcia

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.