Skip to content

Commit 76721d2

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. Signed-off-by: Janne Grunau <j@jannau.net>
1 parent 534f486 commit 76721d2

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

drivers/irqchip/irq-apple-aic.c

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
#include <linux/irqdomain.h>
5555
#include <linux/jump_label.h>
5656
#include <linux/limits.h>
57+
#include <linux/of.h>
5758
#include <linux/of_address.h>
5859
#include <linux/slab.h>
5960
#include <asm/apple_m1_pmu.h>
@@ -134,8 +135,15 @@
134135

135136
#define AIC2_IRQ_CFG 0x2000
136137

138+
/*
139+
* AIC v3 registers (MMIO)
140+
*/
141+
142+
#define AIC3_IRQ_CFG 0x10000
143+
137144
/*
138145
* AIC2 registers are laid out like this, starting at AIC2_IRQ_CFG:
146+
* AIC3 registers use the same layout but start at AIC3_IRQ_CFG:
139147
*
140148
* Repeat for each die:
141149
* IRQ_CFG: u32 * MAX_IRQS
@@ -293,6 +301,15 @@ static const struct aic_info aic2_info __initconst = {
293301
.local_fast_ipi = true,
294302
};
295303

304+
static const struct aic_info aic3_info __initconst = {
305+
.version = 3,
306+
307+
.irq_cfg = AIC3_IRQ_CFG,
308+
309+
.fast_ipi = true,
310+
.local_fast_ipi = true,
311+
};
312+
296313
static const struct of_device_id aic_info_match[] = {
297314
{
298315
.compatible = "apple,t8103-aic",
@@ -310,6 +327,10 @@ static const struct of_device_id aic_info_match[] = {
310327
.compatible = "apple,aic2",
311328
.data = &aic2_info,
312329
},
330+
{
331+
.compatible = "apple,t8122-aic3",
332+
.data = &aic3_info,
333+
},
313334
{}
314335
};
315336

@@ -624,7 +645,7 @@ static int aic_irq_domain_map(struct irq_domain *id, unsigned int irq,
624645
u32 type = FIELD_GET(AIC_EVENT_TYPE, hw);
625646
struct irq_chip *chip = &aic_chip;
626647

627-
if (ic->info.version == 2)
648+
if (ic->info.version == 2 || ic->info.version == 3)
628649
chip = &aic2_chip;
629650

630651
if (type == AIC_EVENT_TYPE_IRQ) {
@@ -974,6 +995,7 @@ static int __init aic_of_ic_init(struct device_node *node, struct device_node *p
974995

975996
break;
976997
}
998+
case 3:
977999
case 2: {
9781000
u32 info1, info3;
9791001

@@ -1048,7 +1070,7 @@ static int __init aic_of_ic_init(struct device_node *node, struct device_node *p
10481070
off += irqc->info.die_stride;
10491071
}
10501072

1051-
if (irqc->info.version == 2) {
1073+
if (irqc->info.version == 2 || irqc->info.version == 3) {
10521074
u32 config = aic_ic_read(irqc, AIC2_CONFIG);
10531075

10541076
config |= AIC2_CONFIG_ENABLE;
@@ -1099,3 +1121,4 @@ static int __init aic_of_ic_init(struct device_node *node, struct device_node *p
10991121

11001122
IRQCHIP_DECLARE(apple_aic, "apple,aic", aic_of_ic_init);
11011123
IRQCHIP_DECLARE(apple_aic2, "apple,aic2", aic_of_ic_init);
1124+
IRQCHIP_DECLARE(apple_aic3, "apple,t8122-aic3", aic_of_ic_init);

0 commit comments

Comments
 (0)