Skip to content

Commit 77ec258

Browse files
AntonioBorneoKAGA-KOKO
authored andcommitted
irqchip/stm32-exti: Map interrupts through interrupts-extended
The mapping of EXTI events to its parent interrupt controller is both SoC and instance dependent. The current implementation requires adding a new mapping table to the driver's code and a new compatible for each new EXTI instance. Check for the presence of the optional interrupts-extended property and use it to map EXTI events to the parent's interrupts. For old device trees without the optional interrupts-extended property, the driver's behavior is unchanged, thus keeps backward compatibility. Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20240415134926.1254428-4-antonio.borneo@foss.st.com
1 parent e9c17d9 commit 77ec258

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

drivers/irqchip/irq-stm32-exti.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ struct stm32_exti_host_data {
6161
struct stm32_exti_chip_data *chips_data;
6262
const struct stm32_exti_drv_data *drv_data;
6363
struct hwspinlock *hwlock;
64+
bool dt_has_irqs_desc; /* skip internal desc_irqs array and get it from DT */
6465
};
6566

6667
static struct stm32_exti_host_data *stm32_host_data;
@@ -731,6 +732,23 @@ static int stm32_exti_h_domain_alloc(struct irq_domain *dm,
731732

732733
irq_domain_set_hwirq_and_chip(dm, virq, hwirq, chip, chip_data);
733734

735+
if (host_data->dt_has_irqs_desc) {
736+
struct of_phandle_args out_irq;
737+
int ret;
738+
739+
ret = of_irq_parse_one(host_data->dev->of_node, hwirq, &out_irq);
740+
if (ret)
741+
return ret;
742+
/* we only support one parent, so far */
743+
if (of_node_to_fwnode(out_irq.np) != dm->parent->fwnode)
744+
return -EINVAL;
745+
746+
of_phandle_args_to_fwspec(out_irq.np, out_irq.args,
747+
out_irq.args_count, &p_fwspec);
748+
749+
return irq_domain_alloc_irqs_parent(dm, virq, 1, &p_fwspec);
750+
}
751+
734752
if (!host_data->drv_data->desc_irqs)
735753
return -EINVAL;
736754

@@ -975,6 +993,9 @@ static int stm32_exti_probe(struct platform_device *pdev)
975993
if (ret)
976994
return ret;
977995

996+
if (of_property_read_bool(np, "interrupts-extended"))
997+
host_data->dt_has_irqs_desc = true;
998+
978999
stm32_exti_h_syscore_init(host_data);
9791000

9801001
return 0;

0 commit comments

Comments
 (0)