Skip to content

Commit 474aa3d

Browse files
committed
Merge tag 'irqchip-core-4.9' of git://git.infradead.org/users/jcooper/linux into irq/core
Pull irqchip core changes for v4.9 from Jason Cooper - jcore: Add AIC driver - mips-gic: Use for_each_set_bit - mvebu: Add PIC driver
2 parents 5a79d59 + f61f860 commit 474aa3d

File tree

10 files changed

+359
-8
lines changed

10 files changed

+359
-8
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
J-Core Advanced Interrupt Controller
2+
3+
Required properties:
4+
5+
- compatible: Should be "jcore,aic1" for the (obsolete) first-generation aic
6+
with 8 interrupt lines with programmable priorities, or "jcore,aic2" for
7+
the "aic2" core with 64 interrupts.
8+
9+
- reg: Memory region(s) for configuration. For SMP, there should be one
10+
region per cpu, indexed by the sequential, zero-based hardware cpu
11+
number.
12+
13+
- interrupt-controller: Identifies the node as an interrupt controller
14+
15+
- #interrupt-cells: Specifies the number of cells needed to encode an
16+
interrupt source. The value shall be 1.
17+
18+
19+
Example:
20+
21+
aic: interrupt-controller@200 {
22+
compatible = "jcore,aic2";
23+
reg = < 0x200 0x30 0x500 0x30 >;
24+
interrupt-controller;
25+
#interrupt-cells = <1>;
26+
};
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Marvell Armada 7K/8K PIC Interrupt controller
2+
---------------------------------------------
3+
4+
This is the Device Tree binding for the PIC, a secondary interrupt
5+
controller available on the Marvell Armada 7K/8K ARM64 SoCs, and
6+
typically connected to the GIC as the primary interrupt controller.
7+
8+
Required properties:
9+
- compatible: should be "marvell,armada-8k-pic"
10+
- interrupt-controller: identifies the node as an interrupt controller
11+
- #interrupt-cells: the number of cells to define interrupts on this
12+
controller. Should be 1
13+
- reg: the register area for the PIC interrupt controller
14+
- interrupts: the interrupt to the primary interrupt controller,
15+
typically the GIC
16+
17+
Example:
18+
19+
pic: interrupt-controller@3f0100 {
20+
compatible = "marvell,armada-8k-pic";
21+
reg = <0x3f0100 0x10>;
22+
#interrupt-cells = <1>;
23+
interrupt-controller;
24+
interrupts = <GIC_PPI 15 IRQ_TYPE_LEVEL_HIGH>;
25+
};

Documentation/devicetree/bindings/interrupt-controller/marvell,odmi-controller.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Required properties:
3131
Example:
3232

3333
odmi: odmi@300000 {
34-
compatible = "marvell,ap806-odm-controller",
34+
compatible = "marvell,ap806-odmi-controller",
3535
"marvell,odmi-controller";
3636
interrupt-controller;
3737
msi-controller;

arch/arm64/Kconfig.platforms

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ config ARCH_MVEBU
9393
select ARMADA_CP110_SYSCON
9494
select ARMADA_37XX_CLK
9595
select MVEBU_ODMI
96+
select MVEBU_PIC
9697
help
9798
This enables support for Marvell EBU familly, including:
9899
- Armada 3700 SoC Family

drivers/irqchip/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,13 @@ config PIC32_EVIC
157157
select GENERIC_IRQ_CHIP
158158
select IRQ_DOMAIN
159159

160+
config JCORE_AIC
161+
bool "J-Core integrated AIC"
162+
depends on OF && (SUPERH || COMPILE_TEST)
163+
select IRQ_DOMAIN
164+
help
165+
Support for the J-Core integrated AIC.
166+
160167
config RENESAS_INTC_IRQPIN
161168
bool
162169
select IRQ_DOMAIN
@@ -252,6 +259,9 @@ config IRQ_MXS
252259
config MVEBU_ODMI
253260
bool
254261

262+
config MVEBU_PIC
263+
bool
264+
255265
config LS_SCFG_MSI
256266
def_bool y if SOC_LS1021A || ARCH_LAYERSCAPE
257267
depends on PCI && PCI_MSI

drivers/irqchip/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ obj-$(CONFIG_I8259) += irq-i8259.o
4040
obj-$(CONFIG_IMGPDC_IRQ) += irq-imgpdc.o
4141
obj-$(CONFIG_IRQ_MIPS_CPU) += irq-mips-cpu.o
4242
obj-$(CONFIG_SIRF_IRQ) += irq-sirfsoc.o
43+
obj-$(CONFIG_JCORE_AIC) += irq-jcore-aic.o
4344
obj-$(CONFIG_RENESAS_INTC_IRQPIN) += irq-renesas-intc-irqpin.o
4445
obj-$(CONFIG_RENESAS_IRQC) += irq-renesas-irqc.o
4546
obj-$(CONFIG_VERSATILE_FPGA_IRQ) += irq-versatile-fpga.o
@@ -68,6 +69,7 @@ obj-$(CONFIG_INGENIC_IRQ) += irq-ingenic.o
6869
obj-$(CONFIG_IMX_GPCV2) += irq-imx-gpcv2.o
6970
obj-$(CONFIG_PIC32_EVIC) += irq-pic32-evic.o
7071
obj-$(CONFIG_MVEBU_ODMI) += irq-mvebu-odmi.o
72+
obj-$(CONFIG_MVEBU_PIC) += irq-mvebu-pic.o
7173
obj-$(CONFIG_LS_SCFG_MSI) += irq-ls-scfg-msi.o
7274
obj-$(CONFIG_EZNPS_GIC) += irq-eznps.o
7375
obj-$(CONFIG_ARCH_ASPEED) += irq-aspeed-vic.o

drivers/irqchip/irq-jcore-aic.c

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/*
2+
* J-Core SoC AIC driver
3+
*
4+
* Copyright (C) 2015-2016 Smart Energy Instruments, Inc.
5+
*
6+
* This file is subject to the terms and conditions of the GNU General Public
7+
* License. See the file "COPYING" in the main directory of this archive
8+
* for more details.
9+
*/
10+
11+
#include <linux/irq.h>
12+
#include <linux/io.h>
13+
#include <linux/irqchip.h>
14+
#include <linux/irqdomain.h>
15+
#include <linux/cpu.h>
16+
#include <linux/of.h>
17+
#include <linux/of_address.h>
18+
#include <linux/of_irq.h>
19+
20+
#define JCORE_AIC_MAX_HWIRQ 127
21+
#define JCORE_AIC1_MIN_HWIRQ 16
22+
#define JCORE_AIC2_MIN_HWIRQ 64
23+
24+
#define JCORE_AIC1_INTPRI_REG 8
25+
26+
static struct irq_chip jcore_aic;
27+
28+
static int jcore_aic_irqdomain_map(struct irq_domain *d, unsigned int irq,
29+
irq_hw_number_t hwirq)
30+
{
31+
struct irq_chip *aic = d->host_data;
32+
33+
irq_set_chip_and_handler(irq, aic, handle_simple_irq);
34+
35+
return 0;
36+
}
37+
38+
static const struct irq_domain_ops jcore_aic_irqdomain_ops = {
39+
.map = jcore_aic_irqdomain_map,
40+
.xlate = irq_domain_xlate_onecell,
41+
};
42+
43+
static void noop(struct irq_data *data)
44+
{
45+
}
46+
47+
static int __init aic_irq_of_init(struct device_node *node,
48+
struct device_node *parent)
49+
{
50+
unsigned min_irq = JCORE_AIC2_MIN_HWIRQ;
51+
unsigned dom_sz = JCORE_AIC_MAX_HWIRQ+1;
52+
struct irq_domain *domain;
53+
54+
pr_info("Initializing J-Core AIC\n");
55+
56+
/* AIC1 needs priority initialization to receive interrupts. */
57+
if (of_device_is_compatible(node, "jcore,aic1")) {
58+
unsigned cpu;
59+
60+
for_each_present_cpu(cpu) {
61+
void __iomem *base = of_iomap(node, cpu);
62+
63+
if (!base) {
64+
pr_err("Unable to map AIC for cpu %u\n", cpu);
65+
return -ENOMEM;
66+
}
67+
__raw_writel(0xffffffff, base + JCORE_AIC1_INTPRI_REG);
68+
iounmap(base);
69+
}
70+
min_irq = JCORE_AIC1_MIN_HWIRQ;
71+
}
72+
73+
/*
74+
* The irq chip framework requires either mask/unmask or enable/disable
75+
* function pointers to be provided, but the hardware does not have any
76+
* such mechanism; the only interrupt masking is at the cpu level and
77+
* it affects all interrupts. We provide dummy mask/unmask. The hardware
78+
* handles all interrupt control and clears pending status when the cpu
79+
* accepts the interrupt.
80+
*/
81+
jcore_aic.irq_mask = noop;
82+
jcore_aic.irq_unmask = noop;
83+
jcore_aic.name = "AIC";
84+
85+
domain = irq_domain_add_linear(node, dom_sz, &jcore_aic_irqdomain_ops,
86+
&jcore_aic);
87+
if (!domain)
88+
return -ENOMEM;
89+
irq_create_strict_mappings(domain, min_irq, min_irq, dom_sz - min_irq);
90+
91+
return 0;
92+
}
93+
94+
IRQCHIP_DECLARE(jcore_aic2, "jcore,aic2", aic_irq_of_init);
95+
IRQCHIP_DECLARE(jcore_aic1, "jcore,aic1", aic_irq_of_init);

drivers/irqchip/irq-keystone.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static void keystone_irq_handler(struct irq_desc *desc)
109109
dev_dbg(kirq->dev, "dispatch bit %d, virq %d\n",
110110
src, virq);
111111
if (!virq)
112-
dev_warn(kirq->dev, "sporious irq detected hwirq %d, virq %d\n",
112+
dev_warn(kirq->dev, "spurious irq detected hwirq %d, virq %d\n",
113113
src, virq);
114114
generic_handle_irq(virq);
115115
}

drivers/irqchip/irq-mips-gic.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -371,18 +371,13 @@ static void gic_handle_shared_int(bool chained)
371371
bitmap_and(pending, pending, intrmask, gic_shared_intrs);
372372
bitmap_and(pending, pending, pcpu_mask, gic_shared_intrs);
373373

374-
intr = find_first_bit(pending, gic_shared_intrs);
375-
while (intr != gic_shared_intrs) {
374+
for_each_set_bit(intr, pending, gic_shared_intrs) {
376375
virq = irq_linear_revmap(gic_irq_domain,
377376
GIC_SHARED_TO_HWIRQ(intr));
378377
if (chained)
379378
generic_handle_irq(virq);
380379
else
381380
do_IRQ(virq);
382-
383-
/* go to next pending bit */
384-
bitmap_clear(pending, intr, 1);
385-
intr = find_first_bit(pending, gic_shared_intrs);
386381
}
387382
}
388383

0 commit comments

Comments
 (0)