Skip to content

Commit 502fc04

Browse files
committed
irqchip/apple-aic: Add support for "apple,t8122-aic3"
Introduce support for the new AICv3 hardware block in t8122 and t603x SoCs. AICv3 is similar to AICv2 but has an increased IRQ config offset. These MMIO offsets are coded as properties of the "aic,3" node in Apple's device tree. The actual offsets are the same for all SoCs starting from M3 through at least M5. So do not bother to follow suit but use AICv3 specific defines in the driver. The compatible string is SoC specific so future SoCs with AICv3 and different offsets would just use their own compatible string as base and add their new offsets. Reviewed-by: Sven Peter <sven@kernel.org> Signed-off-by: Janne Grunau <j@jannau.net>
1 parent 05f7e89 commit 502fc04

1 file changed

Lines changed: 21 additions & 3 deletions

File tree

drivers/irqchip/irq-apple-aic.c

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,12 @@
134134

135135
#define AIC2_IRQ_CFG 0x2000
136136

137+
/* AIC v3 registers (MMIO) */
138+
#define AIC3_IRQ_CFG 0x10000
139+
137140
/*
138141
* AIC2 registers are laid out like this, starting at AIC2_IRQ_CFG:
142+
* AIC3 registers use the same layout but start at AIC3_IRQ_CFG:
139143
*
140144
* Repeat for each die:
141145
* IRQ_CFG: u32 * MAX_IRQS
@@ -293,6 +297,15 @@ static const struct aic_info aic2_info __initconst = {
293297
.local_fast_ipi = true,
294298
};
295299

300+
static const struct aic_info aic3_info __initconst = {
301+
.version = 3,
302+
303+
.irq_cfg = AIC3_IRQ_CFG,
304+
305+
.fast_ipi = true,
306+
.local_fast_ipi = true,
307+
};
308+
296309
static const struct of_device_id aic_info_match[] = {
297310
{
298311
.compatible = "apple,t8103-aic",
@@ -310,6 +323,10 @@ static const struct of_device_id aic_info_match[] = {
310323
.compatible = "apple,aic2",
311324
.data = &aic2_info,
312325
},
326+
{
327+
.compatible = "apple,t8122-aic3",
328+
.data = &aic3_info,
329+
},
313330
{}
314331
};
315332

@@ -620,7 +637,7 @@ static int aic_irq_domain_map(struct irq_domain *id, unsigned int irq,
620637
u32 type = FIELD_GET(AIC_EVENT_TYPE, hw);
621638
struct irq_chip *chip = &aic_chip;
622639

623-
if (ic->info.version == 2)
640+
if (ic->info.version == 2 || ic->info.version == 3)
624641
chip = &aic2_chip;
625642

626643
if (type == AIC_EVENT_TYPE_IRQ) {
@@ -991,7 +1008,7 @@ static int __init aic_of_ic_init(struct device_node *node, struct device_node *p
9911008

9921009
break;
9931010
}
994-
case 2: {
1011+
case 2 ... 3: {
9951012
u32 info1, info3;
9961013

9971014
info1 = aic_ic_read(irqc, AIC2_INFO1);
@@ -1065,7 +1082,7 @@ static int __init aic_of_ic_init(struct device_node *node, struct device_node *p
10651082
off += irqc->info.die_stride;
10661083
}
10671084

1068-
if (irqc->info.version == 2) {
1085+
if (irqc->info.version == 2 || irqc->info.version == 3) {
10691086
u32 config = aic_ic_read(irqc, AIC2_CONFIG);
10701087

10711088
config |= AIC2_CONFIG_ENABLE;
@@ -1116,3 +1133,4 @@ static int __init aic_of_ic_init(struct device_node *node, struct device_node *p
11161133

11171134
IRQCHIP_DECLARE(apple_aic, "apple,aic", aic_of_ic_init);
11181135
IRQCHIP_DECLARE(apple_aic2, "apple,aic2", aic_of_ic_init);
1136+
IRQCHIP_DECLARE(apple_aic3, "apple,t8122-aic3", aic_of_ic_init);

0 commit comments

Comments
 (0)