aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/irqchip
diff options
context:
space:
mode:
authorKevin Cernekee <cernekee@gmail.com>2014-11-07 01:44:28 -0500
committerJason Cooper <jason@lakedaemon.net>2014-11-08 23:03:27 -0500
commitc17261fac3874767bf5478ffb27b843ac66d1f5d (patch)
tree3358b82c95a9e172ea797333c4c2aa0bb2fbd796 /drivers/irqchip
parenta4fcbb8614010ab93e9865607582337791f9be80 (diff)
irqchip: bcm7120-l2: Convert driver to use irq_reg_{readl,writel}
On BE MIPS systems this needs to use the new IRQ_GC_BE_IO gc_flag. In all other cases it will use the standard readl/writel accessors. The initial irq_fwd_mask setup runs before "gc" is initialized, so it is unchanged for now. This could potentially be a problem on an ARM system that boots in LE mode but runs a BE kernel, but currently none of the supported ARM platforms are ever expected to run BE. Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Link: https://lkml.kernel.org/r/1415342669-30640-14-git-send-email-cernekee@gmail.com Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'drivers/irqchip')
-rw-r--r--drivers/irqchip/irq-bcm7120-l2.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/irqchip/irq-bcm7120-l2.c b/drivers/irqchip/irq-bcm7120-l2.c
index e53a3a629a06..e7c6155b23b8 100644
--- a/drivers/irqchip/irq-bcm7120-l2.c
+++ b/drivers/irqchip/irq-bcm7120-l2.c
@@ -13,6 +13,7 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/slab.h> 14#include <linux/slab.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/kconfig.h>
16#include <linux/platform_device.h> 17#include <linux/platform_device.h>
17#include <linux/of.h> 18#include <linux/of.h>
18#include <linux/of_irq.h> 19#include <linux/of_irq.h>
@@ -60,8 +61,7 @@ static void bcm7120_l2_intc_irq_handle(unsigned int irq, struct irq_desc *desc)
60 int hwirq; 61 int hwirq;
61 62
62 irq_gc_lock(gc); 63 irq_gc_lock(gc);
63 pending = __raw_readl(b->base[idx] + IRQSTAT) & 64 pending = irq_reg_readl(gc, IRQSTAT) & gc->mask_cache;
64 gc->mask_cache;
65 irq_gc_unlock(gc); 65 irq_gc_unlock(gc);
66 66
67 for_each_set_bit(hwirq, &pending, IRQS_PER_WORD) { 67 for_each_set_bit(hwirq, &pending, IRQS_PER_WORD) {
@@ -79,10 +79,8 @@ static void bcm7120_l2_intc_suspend(struct irq_data *d)
79 struct bcm7120_l2_intc_data *b = gc->private; 79 struct bcm7120_l2_intc_data *b = gc->private;
80 80
81 irq_gc_lock(gc); 81 irq_gc_lock(gc);
82 if (b->can_wake) { 82 if (b->can_wake)
83 __raw_writel(gc->mask_cache | gc->wake_active, 83 irq_reg_writel(gc, gc->mask_cache | gc->wake_active, IRQEN);
84 gc->reg_base + IRQEN);
85 }
86 irq_gc_unlock(gc); 84 irq_gc_unlock(gc);
87} 85}
88 86
@@ -92,7 +90,7 @@ static void bcm7120_l2_intc_resume(struct irq_data *d)
92 90
93 /* Restore the saved mask */ 91 /* Restore the saved mask */
94 irq_gc_lock(gc); 92 irq_gc_lock(gc);
95 __raw_writel(gc->mask_cache, gc->reg_base + IRQEN); 93 irq_reg_writel(gc, gc->mask_cache, IRQEN);
96 irq_gc_unlock(gc); 94 irq_gc_unlock(gc);
97} 95}
98 96
@@ -132,7 +130,7 @@ int __init bcm7120_l2_intc_of_init(struct device_node *dn,
132 const __be32 *map_mask; 130 const __be32 *map_mask;
133 int num_parent_irqs; 131 int num_parent_irqs;
134 int ret = 0, len; 132 int ret = 0, len;
135 unsigned int idx, irq; 133 unsigned int idx, irq, flags;
136 134
137 data = kzalloc(sizeof(*data), GFP_KERNEL); 135 data = kzalloc(sizeof(*data), GFP_KERNEL);
138 if (!data) 136 if (!data)
@@ -195,9 +193,15 @@ int __init bcm7120_l2_intc_of_init(struct device_node *dn,
195 goto out_unmap; 193 goto out_unmap;
196 } 194 }
197 195
196 /* MIPS chips strapped for BE will automagically configure the
197 * peripheral registers for CPU-native byte order.
198 */
199 flags = IRQ_GC_INIT_MASK_CACHE;
200 if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(CONFIG_CPU_BIG_ENDIAN))
201 flags |= IRQ_GC_BE_IO;
202
198 ret = irq_alloc_domain_generic_chips(data->domain, IRQS_PER_WORD, 1, 203 ret = irq_alloc_domain_generic_chips(data->domain, IRQS_PER_WORD, 1,
199 dn->full_name, handle_level_irq, clr, 0, 204 dn->full_name, handle_level_irq, clr, 0, flags);
200 IRQ_GC_INIT_MASK_CACHE);
201 if (ret) { 205 if (ret) {
202 pr_err("failed to allocate generic irq chip\n"); 206 pr_err("failed to allocate generic irq chip\n");
203 goto out_free_domain; 207 goto out_free_domain;