1 From f1905bc5137db49ef155f835d52d68cb86c4c9a9 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Tue, 23 Jan 2018 16:52:45 +0000
4 Subject: [PATCH] irqchip: irq-bcm2836: Remove regmap and syscon use
6 The syscon node defines a register range that duplicates that used by
7 the local_intc node on bcm2836/7. Since irq-bcm2835 and irq-bcm2836 are
8 built in and always present together (both drivers are enabled by
9 CONFIG_ARCH_BCM2835), it is possible to replace the syscon usage with a
10 global variable that simplifies the code. Doing so does lose the
11 locking provided by regmap, but as only one side is using the regmap
12 interface (irq-bcm2835 uses readl and write) there is no loss of
15 See: https://github.com/raspberrypi/firmware/issues/926
17 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
19 drivers/irqchip/irq-bcm2835.c | 32 ++++++++++++--------------------
20 drivers/irqchip/irq-bcm2836.c | 5 +++++
21 2 files changed, 17 insertions(+), 20 deletions(-)
23 --- a/drivers/irqchip/irq-bcm2835.c
24 +++ b/drivers/irqchip/irq-bcm2835.c
26 #include <linux/of_irq.h>
27 #include <linux/irqchip.h>
28 #include <linux/irqdomain.h>
29 -#include <linux/mfd/syscon.h>
30 -#include <linux/regmap.h>
32 #include <asm/exception.h>
33 #include <asm/mach/irq.h>
34 @@ -100,7 +98,7 @@ struct armctrl_ic {
35 void __iomem *enable[NR_BANKS];
36 void __iomem *disable[NR_BANKS];
37 struct irq_domain *domain;
38 - struct regmap *local_regmap;
39 + void __iomem *local_base;
42 static struct armctrl_ic intc __read_mostly;
43 @@ -137,24 +135,20 @@ static void armctrl_unmask_irq(struct ir
44 if (d->hwirq >= NUMBER_IRQS) {
45 if (num_online_cpus() > 1) {
49 - if (!intc.local_regmap) {
50 - pr_err("FIQ is disabled due to missing regmap\n");
51 + if (!intc.local_base) {
52 + pr_err("FIQ is disabled due to missing arm_local_intc\n");
56 - ret = regmap_read(intc.local_regmap,
57 - ARM_LOCAL_GPU_INT_ROUTING, &data);
59 - pr_err("Failed to read int routing %d\n", ret);
62 + data = readl_relaxed(intc.local_base +
63 + ARM_LOCAL_GPU_INT_ROUTING);
67 - regmap_write(intc.local_regmap,
68 - ARM_LOCAL_GPU_INT_ROUTING, data);
69 + writel_relaxed(data,
71 + ARM_LOCAL_GPU_INT_ROUTING);
74 writel_relaxed(REG_FIQ_ENABLE | hwirq_to_fiq(d->hwirq),
75 @@ -240,12 +234,10 @@ static int __init armctrl_of_init(struct
80 - syscon_regmap_lookup_by_compatible("brcm,bcm2836-arm-local");
81 - if (IS_ERR(intc.local_regmap)) {
82 - pr_err("Failed to get local register map. FIQ is disabled for cpus > 1\n");
83 - intc.local_regmap = NULL;
85 + extern void __iomem * __attribute__((weak)) arm_local_intc;
86 + intc.local_base = arm_local_intc;
87 + if (!intc.local_base)
88 + pr_err("Failed to get local intc base. FIQ is disabled for cpus > 1\n");
91 /* Make a duplicate irq range which is used to enable FIQ */
92 --- a/drivers/irqchip/irq-bcm2836.c
93 +++ b/drivers/irqchip/irq-bcm2836.c
94 @@ -30,6 +30,9 @@ struct bcm2836_arm_irqchip_intc {
96 static struct bcm2836_arm_irqchip_intc intc __read_mostly;
98 +void __iomem *arm_local_intc;
99 +EXPORT_SYMBOL_GPL(arm_local_intc);
101 static void bcm2836_arm_irqchip_mask_per_cpu_irq(unsigned int reg_offset,
104 @@ -234,6 +237,8 @@ static int __init bcm2836_arm_irqchip_l1
105 panic("%pOF: unable to map local interrupt registers\n", node);
108 + arm_local_intc = intc.base;
110 bcm2835_init_local_timer_frequency();
112 intc.domain = irq_domain_add_linear(node, LAST_IRQ + 1,