1 From 0d6484eb61b794ef795ff569f5f066922d554156 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org>
3 Date: Fri, 23 Oct 2015 16:26:55 +0200
4 Subject: [PATCH] irqchip: irq-bcm2835: Add 2836 FIQ support
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
11 drivers/irqchip/irq-bcm2835.c | 42 ++++++++++++++++++++++++++++++++++++++++--
12 1 file changed, 40 insertions(+), 2 deletions(-)
14 --- a/drivers/irqchip/irq-bcm2835.c
15 +++ b/drivers/irqchip/irq-bcm2835.c
17 #include <linux/of_irq.h>
18 #include <linux/irqchip.h>
19 #include <linux/irqdomain.h>
20 +#include <linux/mfd/syscon.h>
21 +#include <linux/regmap.h>
23 #include <asm/exception.h>
24 #include <asm/mach/irq.h>
26 #define BANK0_VALID_MASK (BANK0_HWIRQ_MASK | BANK1_HWIRQ | BANK2_HWIRQ \
27 | SHORTCUT1_MASK | SHORTCUT2_MASK)
29 +#undef ARM_LOCAL_GPU_INT_ROUTING
30 +#define ARM_LOCAL_GPU_INT_ROUTING 0x0c
32 #define REG_FIQ_CONTROL 0x0c
33 #define REG_FIQ_ENABLE 0x80
34 #define REG_FIQ_DISABLE 0
35 @@ -95,6 +100,7 @@ struct armctrl_ic {
36 void __iomem *enable[NR_BANKS];
37 void __iomem *disable[NR_BANKS];
38 struct irq_domain *domain;
39 + struct regmap *local_regmap;
42 static struct armctrl_ic intc __read_mostly;
43 @@ -128,12 +134,35 @@ static void armctrl_mask_irq(struct irq_
45 static void armctrl_unmask_irq(struct irq_data *d)
47 - if (d->hwirq >= NUMBER_IRQS)
48 + if (d->hwirq >= NUMBER_IRQS) {
49 + if (num_online_cpus() > 1) {
53 + if (!intc.local_regmap) {
54 + pr_err("FIQ is disabled due to missing regmap\n");
58 + ret = regmap_read(intc.local_regmap,
59 + ARM_LOCAL_GPU_INT_ROUTING, &data);
61 + pr_err("Failed to read int routing %d\n", ret);
67 + regmap_write(intc.local_regmap,
68 + ARM_LOCAL_GPU_INT_ROUTING, data);
71 writel_relaxed(REG_FIQ_ENABLE | hwirq_to_fiq(d->hwirq),
72 intc.base + REG_FIQ_CONTROL);
75 writel_relaxed(HWIRQ_BIT(d->hwirq),
76 intc.enable[HWIRQ_BANK(d->hwirq)]);
80 static struct irq_chip armctrl_chip = {
81 @@ -211,6 +240,15 @@ static int __init armctrl_of_init(struct
82 set_handle_irq(bcm2835_handle_irq);
87 + syscon_regmap_lookup_by_compatible("brcm,bcm2836-arm-local");
88 + if (IS_ERR(intc.local_regmap)) {
89 + pr_err("Failed to get local register map. FIQ is disabled for cpus > 1\n");
90 + intc.local_regmap = NULL;
94 /* Make a duplicate irq range which is used to enable FIQ */
95 for (b = 0; b < NR_BANKS; b++) {
96 for (i = 0; i < bank_irqs[b]; i++) {