bcm27xx: add linux 5.4 support
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.4 / 950-0115-irqchip-irq-bcm2835-Calc.-FIQ_START-at-boot-time.patch
1 From f68ce73c7508d674266f048043e0cc390c1f128a Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Thu, 14 Jun 2018 11:21:04 +0100
4 Subject: [PATCH] irqchip: irq-bcm2835: Calc. FIQ_START at boot-time
5
6 ad83c7cb2f37 ("irqchip/irq-bcm2836: Add support for DT interrupt polarity")
7 changed the way that the BCM2836/7 local interrupts are mapped; instead
8 of being pre-mapped they are now mapped on-demand. A side effect of this
9 change is that the call to irq_of_parse_and_map from armctrl_of_init
10 creates a new mapping, forming a gap between the IRQs and the FIQs. This
11 gap breaks the FIQ<->IRQ mapping which up to now has been done by assuming:
12
13 1) that the value of FIQ_START is the same as the number of normal IRQs
14 that will be mapped (still true), and
15
16 2) that this value is also the offset between an IRQ and its equivalent
17 FIQ (which is no longer the case).
18
19 Remove both assumptions by measuring the interval between the last IRQ
20 and the last FIQ, passing it as the parameter to init_FIQ().
21
22 Fixes: https://github.com/raspberrypi/linux/issues/2432
23
24 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
25 ---
26 drivers/irqchip/irq-bcm2835.c | 8 ++++----
27 1 file changed, 4 insertions(+), 4 deletions(-)
28
29 --- a/drivers/irqchip/irq-bcm2835.c
30 +++ b/drivers/irqchip/irq-bcm2835.c
31 @@ -73,8 +73,6 @@
32 #define NR_BANKS 3
33 #define IRQS_PER_BANK 32
34 #define NUMBER_IRQS MAKE_HWIRQ(NR_BANKS, 0)
35 -#undef FIQ_START
36 -#define FIQ_START (NR_IRQS_BANK0 + MAKE_HWIRQ(NR_BANKS - 1, 0))
37
38 static const int reg_pending[] __initconst = { 0x00, 0x04, 0x08 };
39 static const int reg_enable[] __initconst = { 0x18, 0x10, 0x14 };
40 @@ -202,7 +200,7 @@ static int __init armctrl_of_init(struct
41 bool is_2836)
42 {
43 void __iomem *base;
44 - int irq, b, i;
45 + int irq = 0, last_irq, b, i;
46
47 base = of_iomap(node, 0);
48 if (!base)
49 @@ -228,6 +226,8 @@ static int __init armctrl_of_init(struct
50 }
51 }
52
53 + last_irq = irq;
54 +
55 if (is_2836) {
56 int parent_irq = irq_of_parse_and_map(node, 0);
57
58 @@ -258,7 +258,7 @@ static int __init armctrl_of_init(struct
59 }
60 }
61 #ifndef CONFIG_ARM64
62 - init_FIQ(FIQ_START);
63 + init_FIQ(irq - last_irq);
64 #endif
65
66 return 0;