diff options
author | Vineet Gupta <vgupta@synopsys.com> | 2017-02-01 12:44:33 -0500 |
---|---|---|
committer | Vineet Gupta <vgupta@synopsys.com> | 2017-02-06 12:37:57 -0500 |
commit | 179cf194e6d153fb6daeca811253502d5c84e4c8 (patch) | |
tree | c6bbe60670787391e3c79264ea4f00b920f20fb4 | |
parent | f33b8cddc8ad8ce83cd3214406bcf68ec6c4d8ec (diff) |
ARCv2: intc: Use runtime value of irq count for setting up intc
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
-rw-r--r-- | arch/arc/include/asm/irq.h | 1 | ||||
-rw-r--r-- | arch/arc/kernel/intc-arcv2.c | 28 |
2 files changed, 18 insertions, 11 deletions
diff --git a/arch/arc/include/asm/irq.h b/arch/arc/include/asm/irq.h index a3880b423925..0618b1ce707c 100644 --- a/arch/arc/include/asm/irq.h +++ b/arch/arc/include/asm/irq.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #ifdef CONFIG_ISA_ARCV2 | 21 | #ifdef CONFIG_ISA_ARCV2 |
22 | #define IPI_IRQ 19 | 22 | #define IPI_IRQ 19 |
23 | #define SOFTIRQ_IRQ 21 | 23 | #define SOFTIRQ_IRQ 21 |
24 | #define FIRST_EXT_IRQ 24 | ||
24 | #endif | 25 | #endif |
25 | 26 | ||
26 | #include <linux/interrupt.h> | 27 | #include <linux/interrupt.h> |
diff --git a/arch/arc/kernel/intc-arcv2.c b/arch/arc/kernel/intc-arcv2.c index 5c5769dd8f5d..4d3166f9bbc9 100644 --- a/arch/arc/kernel/intc-arcv2.c +++ b/arch/arc/kernel/intc-arcv2.c | |||
@@ -14,7 +14,15 @@ | |||
14 | #include <linux/irqchip.h> | 14 | #include <linux/irqchip.h> |
15 | #include <asm/irq.h> | 15 | #include <asm/irq.h> |
16 | 16 | ||
17 | #define NR_CPU_IRQS 32 /* number of irq lines coming in */ | 17 | #define NR_EXCEPTIONS 16 |
18 | |||
19 | struct bcr_irq_arcv2 { | ||
20 | #ifdef CONFIG_CPU_BIG_ENDIAN | ||
21 | unsigned int pad:3, firq:1, prio:4, exts:8, irqs:8, ver:8; | ||
22 | #else | ||
23 | unsigned int ver:8, irqs:8, exts:8, prio:4, firq:1, pad:3; | ||
24 | #endif | ||
25 | }; | ||
18 | 26 | ||
19 | /* | 27 | /* |
20 | * Early Hardware specific Interrupt setup | 28 | * Early Hardware specific Interrupt setup |
@@ -25,14 +33,7 @@ | |||
25 | void arc_init_IRQ(void) | 33 | void arc_init_IRQ(void) |
26 | { | 34 | { |
27 | unsigned int tmp, irq_prio; | 35 | unsigned int tmp, irq_prio; |
28 | 36 | struct bcr_irq_arcv2 irq_bcr; | |
29 | struct irq_build { | ||
30 | #ifdef CONFIG_CPU_BIG_ENDIAN | ||
31 | unsigned int pad:3, firq:1, prio:4, exts:8, irqs:8, ver:8; | ||
32 | #else | ||
33 | unsigned int ver:8, irqs:8, exts:8, prio:4, firq:1, pad:3; | ||
34 | #endif | ||
35 | } irq_bcr; | ||
36 | 37 | ||
37 | struct aux_irq_ctrl { | 38 | struct aux_irq_ctrl { |
38 | #ifdef CONFIG_CPU_BIG_ENDIAN | 39 | #ifdef CONFIG_CPU_BIG_ENDIAN |
@@ -117,7 +118,7 @@ static int arcv2_irq_map(struct irq_domain *d, unsigned int irq, | |||
117 | * core intc IRQs [16, 23]: | 118 | * core intc IRQs [16, 23]: |
118 | * Statically assigned always private-per-core (Timers, WDT, IPI, PCT) | 119 | * Statically assigned always private-per-core (Timers, WDT, IPI, PCT) |
119 | */ | 120 | */ |
120 | if (hw < 24) { | 121 | if (hw < FIRST_EXT_IRQ) { |
121 | /* | 122 | /* |
122 | * A subsequent request_percpu_irq() fails if percpu_devid is | 123 | * A subsequent request_percpu_irq() fails if percpu_devid is |
123 | * not set. That in turns sets NOAUTOEN, meaning each core needs | 124 | * not set. That in turns sets NOAUTOEN, meaning each core needs |
@@ -142,11 +143,16 @@ static int __init | |||
142 | init_onchip_IRQ(struct device_node *intc, struct device_node *parent) | 143 | init_onchip_IRQ(struct device_node *intc, struct device_node *parent) |
143 | { | 144 | { |
144 | struct irq_domain *root_domain; | 145 | struct irq_domain *root_domain; |
146 | struct bcr_irq_arcv2 irq_bcr; | ||
147 | unsigned int nr_cpu_irqs; | ||
148 | |||
149 | READ_BCR(ARC_REG_IRQ_BCR, irq_bcr); | ||
150 | nr_cpu_irqs = irq_bcr.irqs + NR_EXCEPTIONS; | ||
145 | 151 | ||
146 | if (parent) | 152 | if (parent) |
147 | panic("DeviceTree incore intc not a root irq controller\n"); | 153 | panic("DeviceTree incore intc not a root irq controller\n"); |
148 | 154 | ||
149 | root_domain = irq_domain_add_linear(intc, NR_CPU_IRQS, &arcv2_irq_ops, NULL); | 155 | root_domain = irq_domain_add_linear(intc, nr_cpu_irqs, &arcv2_irq_ops, NULL); |
150 | if (!root_domain) | 156 | if (!root_domain) |
151 | panic("root irq domain not avail\n"); | 157 | panic("root irq domain not avail\n"); |
152 | 158 | ||