kernel: bump 4.14 to 4.14.93
[openwrt/staging/chunkeey.git] / target / linux / brcm2708 / patches-4.14 / 950-0169-irqchip-irq-bcm2836-Remove-regmap-and-syscon-use.patch
1 From bb79a484a01f8f3645bd9b8fc6b15ea0ba961589 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 169/454] irqchip: irq-bcm2836: Remove regmap and syscon use
5
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
13 atomicity.
14
15 See: https://github.com/raspberrypi/firmware/issues/926
16
17 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
18 ---
19 arch/arm/boot/dts/bcm2709.dtsi | 5 -----
20 arch/arm/boot/dts/bcm2710.dtsi | 5 -----
21 drivers/irqchip/irq-bcm2835.c | 32 ++++++++++++--------------------
22 drivers/irqchip/irq-bcm2836.c | 5 +++++
23 4 files changed, 17 insertions(+), 30 deletions(-)
24
25 --- a/arch/arm/boot/dts/bcm2709.dtsi
26 +++ b/arch/arm/boot/dts/bcm2709.dtsi
27 @@ -6,11 +6,6 @@
28 soc {
29 ranges = <0x7e000000 0x3f000000 0x01000000>,
30 <0x40000000 0x40000000 0x00040000>;
31 -
32 - syscon@40000000 {
33 - compatible = "brcm,bcm2836-arm-local", "syscon";
34 - reg = <0x40000000 0x100>;
35 - };
36 };
37
38 __overrides__ {
39 --- a/arch/arm/boot/dts/bcm2710.dtsi
40 +++ b/arch/arm/boot/dts/bcm2710.dtsi
41 @@ -16,11 +16,6 @@
42 interrupt-parent = <&local_intc>;
43 interrupts = <9>;
44 };
45 -
46 - syscon@40000000 {
47 - compatible = "brcm,bcm2836-arm-local", "syscon";
48 - reg = <0x40000000 0x100>;
49 - };
50 };
51
52 __overrides__ {
53 --- a/drivers/irqchip/irq-bcm2835.c
54 +++ b/drivers/irqchip/irq-bcm2835.c
55 @@ -50,8 +50,6 @@
56 #include <linux/of_irq.h>
57 #include <linux/irqchip.h>
58 #include <linux/irqdomain.h>
59 -#include <linux/mfd/syscon.h>
60 -#include <linux/regmap.h>
61
62 #include <asm/exception.h>
63 #ifndef CONFIG_ARM64
64 @@ -103,7 +101,7 @@ struct armctrl_ic {
65 void __iomem *enable[NR_BANKS];
66 void __iomem *disable[NR_BANKS];
67 struct irq_domain *domain;
68 - struct regmap *local_regmap;
69 + void __iomem *local_base;
70 };
71
72 static struct armctrl_ic intc __read_mostly;
73 @@ -140,24 +138,20 @@ static void armctrl_unmask_irq(struct ir
74 if (d->hwirq >= NUMBER_IRQS) {
75 if (num_online_cpus() > 1) {
76 unsigned int data;
77 - int ret;
78
79 - if (!intc.local_regmap) {
80 - pr_err("FIQ is disabled due to missing regmap\n");
81 + if (!intc.local_base) {
82 + pr_err("FIQ is disabled due to missing arm_local_intc\n");
83 return;
84 }
85
86 - ret = regmap_read(intc.local_regmap,
87 - ARM_LOCAL_GPU_INT_ROUTING, &data);
88 - if (ret) {
89 - pr_err("Failed to read int routing %d\n", ret);
90 - return;
91 - }
92 + data = readl_relaxed(intc.local_base +
93 + ARM_LOCAL_GPU_INT_ROUTING);
94
95 data &= ~0xc;
96 data |= (1 << 2);
97 - regmap_write(intc.local_regmap,
98 - ARM_LOCAL_GPU_INT_ROUTING, data);
99 + writel_relaxed(data,
100 + intc.local_base +
101 + ARM_LOCAL_GPU_INT_ROUTING);
102 }
103
104 writel_relaxed(REG_FIQ_ENABLE | hwirq_to_fiq(d->hwirq),
105 @@ -256,12 +250,10 @@ static int __init armctrl_of_init(struct
106 }
107
108 if (is_2836) {
109 - intc.local_regmap =
110 - syscon_regmap_lookup_by_compatible("brcm,bcm2836-arm-local");
111 - if (IS_ERR(intc.local_regmap)) {
112 - pr_err("Failed to get local register map. FIQ is disabled for cpus > 1\n");
113 - intc.local_regmap = NULL;
114 - }
115 + extern void __iomem * __attribute__((weak)) arm_local_intc;
116 + intc.local_base = arm_local_intc;
117 + if (!intc.local_base)
118 + pr_err("Failed to get local intc base. FIQ is disabled for cpus > 1\n");
119 }
120
121 /* Make a duplicate irq range which is used to enable FIQ */
122 --- a/drivers/irqchip/irq-bcm2836.c
123 +++ b/drivers/irqchip/irq-bcm2836.c
124 @@ -83,6 +83,9 @@ struct bcm2836_arm_irqchip_intc {
125
126 static struct bcm2836_arm_irqchip_intc intc __read_mostly;
127
128 +void __iomem *arm_local_intc;
129 +EXPORT_SYMBOL_GPL(arm_local_intc);
130 +
131 static void bcm2836_arm_irqchip_mask_per_cpu_irq(unsigned int reg_offset,
132 unsigned int bit,
133 int cpu)
134 @@ -310,6 +313,8 @@ static int __init bcm2836_arm_irqchip_l1
135 panic("%pOF: unable to map local interrupt registers\n", node);
136 }
137
138 + arm_local_intc = intc.base;
139 +
140 bcm2835_init_local_timer_frequency();
141
142 intc.domain = irq_domain_add_linear(node, LAST_IRQ + 1,