Skip to content

Commit ffce73d

Browse files
gclementMarc Zyngier
authored and
Marc Zyngier
committed
irqchip/ocelot: Add support for Luton platforms
This patch extends irqchip driver for oceleot to be used with an other vcoreiii base platform: Luton. For this platform there is a few differences: - the interrupt must be enabled for the parent controller - there is no trigger register needed to be managed Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20201125103206.136498-5-gregory.clement@bootlin.com
1 parent 5f0c75e commit ffce73d

File tree

1 file changed

+34
-4
lines changed

1 file changed

+34
-4
lines changed

drivers/irqchip/irq-mscc-ocelot.c

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#define ICPU_CFG_INTR_INTR_TRIGGER(_p, x) ((_p)->reg_off_trigger + 0x4 * (x))
1717

1818
#define FLAGS_HAS_TRIGGER BIT(0)
19+
#define FLAGS_NEED_INIT_ENABLE BIT(1)
1920

2021
struct chip_props {
2122
u8 flags;
@@ -40,6 +41,17 @@ static struct chip_props ocelot_props = {
4041
.n_irq = 24,
4142
};
4243

44+
static struct chip_props luton_props = {
45+
.flags = FLAGS_NEED_INIT_ENABLE,
46+
.reg_off_sticky = 0,
47+
.reg_off_ena = 0x4,
48+
.reg_off_ena_clr = 0x8,
49+
.reg_off_ena_set = 0xc,
50+
.reg_off_ident = 0x18,
51+
.reg_off_ena_irq0 = 0x14,
52+
.n_irq = 28,
53+
};
54+
4355
static void ocelot_irq_unmask(struct irq_data *data)
4456
{
4557
struct irq_chip_generic *gc = irq_data_get_irq_chip_data(data);
@@ -115,17 +127,27 @@ static int __init vcoreiii_irq_init(struct device_node *node,
115127
goto err_gc_free;
116128
}
117129

118-
gc->chip_types[0].regs.ack = p->reg_off_sticky;
119-
gc->chip_types[0].regs.mask = p->reg_off_ena_clr;
120130
gc->chip_types[0].chip.irq_ack = irq_gc_ack_set_bit;
121-
gc->chip_types[0].chip.irq_mask = irq_gc_mask_set_bit;
122-
if (p->flags & FLAGS_HAS_TRIGGER)
131+
gc->chip_types[0].regs.ack = p->reg_off_sticky;
132+
if (p->flags & FLAGS_HAS_TRIGGER) {
133+
gc->chip_types[0].regs.mask = p->reg_off_ena_clr;
123134
gc->chip_types[0].chip.irq_unmask = ocelot_irq_unmask;
135+
gc->chip_types[0].chip.irq_mask = irq_gc_mask_set_bit;
136+
} else {
137+
gc->chip_types[0].regs.enable = p->reg_off_ena_set;
138+
gc->chip_types[0].regs.disable = p->reg_off_ena_clr;
139+
gc->chip_types[0].chip.irq_mask = irq_gc_mask_disable_reg;
140+
gc->chip_types[0].chip.irq_unmask = irq_gc_unmask_enable_reg;
141+
}
124142

125143
/* Mask and ack all interrupts */
126144
irq_reg_writel(gc, 0, p->reg_off_ena);
127145
irq_reg_writel(gc, 0xffffffff, p->reg_off_sticky);
128146

147+
/* Overall init */
148+
if (p->flags & FLAGS_NEED_INIT_ENABLE)
149+
irq_reg_writel(gc, BIT(0), p->reg_off_ena_irq0);
150+
129151
domain->host_data = p;
130152
irq_set_chained_handler_and_data(parent_irq, ocelot_irq_handler,
131153
domain);
@@ -148,3 +170,11 @@ static int __init ocelot_irq_init(struct device_node *node,
148170
}
149171

150172
IRQCHIP_DECLARE(ocelot_icpu, "mscc,ocelot-icpu-intr", ocelot_irq_init);
173+
174+
static int __init luton_irq_init(struct device_node *node,
175+
struct device_node *parent)
176+
{
177+
return vcoreiii_irq_init(node, parent, &luton_props);
178+
}
179+
180+
IRQCHIP_DECLARE(luton_icpu, "mscc,luton-icpu-intr", luton_irq_init);

0 commit comments

Comments
 (0)