From: Antonio Borneo <antonio.borneo@foss.st.com> To: Thomas Gleixner <tglx@linutronix.de>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org>, Maxime Coquelin <mcoquelin.stm32@gmail.com>, Alexandre Torgue <alexandre.torgue@foss.st.com>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org> Cc: Antonio Borneo <antonio.borneo@foss.st.com>, Fabrice Gasnier <fabrice.gasnier@foss.st.com>, <linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>, <linux-stm32@st-md-mailman.stormreply.com>, <linux-arm-kernel@lists.infradead.org> Subject: [PATCH v2 03/11] irqchip/stm32-exti: Map interrupts through interrupts-extended Date: Mon, 15 Apr 2024 15:49:18 +0200 [thread overview] Message-ID: <20240415134926.1254428-4-antonio.borneo@foss.st.com> (raw) In-Reply-To: <20240216094758.916722-1-antonio.borneo@foss.st.com> 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 DTs 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> --- drivers/irqchip/irq-stm32-exti.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/irqchip/irq-stm32-exti.c b/drivers/irqchip/irq-stm32-exti.c index 3b35f138ed3d7..e5714a0111e7b 100644 --- a/drivers/irqchip/irq-stm32-exti.c +++ b/drivers/irqchip/irq-stm32-exti.c @@ -61,6 +61,7 @@ struct stm32_exti_host_data { struct stm32_exti_chip_data *chips_data; const struct stm32_exti_drv_data *drv_data; struct hwspinlock *hwlock; + bool dt_has_irqs_desc; /* skip internal desc_irqs array and get it from DT */ }; static struct stm32_exti_host_data *stm32_host_data; @@ -731,6 +732,23 @@ static int stm32_exti_h_domain_alloc(struct irq_domain *dm, irq_domain_set_hwirq_and_chip(dm, virq, hwirq, chip, chip_data); + if (host_data->dt_has_irqs_desc) { + struct of_phandle_args out_irq; + int ret; + + ret = of_irq_parse_one(host_data->dev->of_node, hwirq, &out_irq); + if (ret) + return ret; + /* we only support one parent, so far */ + if (of_node_to_fwnode(out_irq.np) != dm->parent->fwnode) + return -EINVAL; + + of_phandle_args_to_fwspec(out_irq.np, out_irq.args, + out_irq.args_count, &p_fwspec); + + return irq_domain_alloc_irqs_parent(dm, virq, 1, &p_fwspec); + } + if (!host_data->drv_data->desc_irqs) return -EINVAL; @@ -975,6 +993,9 @@ static int stm32_exti_probe(struct platform_device *pdev) if (ret) return ret; + if (of_property_read_bool(np, "interrupts-extended")) + host_data->dt_has_irqs_desc = true; + stm32_exti_h_syscore_init(host_data); return 0; -- 2.34.1
WARNING: multiple messages have this Message-ID (diff)
From: Antonio Borneo <antonio.borneo@foss.st.com> To: Thomas Gleixner <tglx@linutronix.de>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org>, Maxime Coquelin <mcoquelin.stm32@gmail.com>, Alexandre Torgue <alexandre.torgue@foss.st.com>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org> Cc: Antonio Borneo <antonio.borneo@foss.st.com>, Fabrice Gasnier <fabrice.gasnier@foss.st.com>, <linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>, <linux-stm32@st-md-mailman.stormreply.com>, <linux-arm-kernel@lists.infradead.org> Subject: [PATCH v2 03/11] irqchip/stm32-exti: Map interrupts through interrupts-extended Date: Mon, 15 Apr 2024 15:49:18 +0200 [thread overview] Message-ID: <20240415134926.1254428-4-antonio.borneo@foss.st.com> (raw) In-Reply-To: <20240216094758.916722-1-antonio.borneo@foss.st.com> 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 DTs 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> --- drivers/irqchip/irq-stm32-exti.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/irqchip/irq-stm32-exti.c b/drivers/irqchip/irq-stm32-exti.c index 3b35f138ed3d7..e5714a0111e7b 100644 --- a/drivers/irqchip/irq-stm32-exti.c +++ b/drivers/irqchip/irq-stm32-exti.c @@ -61,6 +61,7 @@ struct stm32_exti_host_data { struct stm32_exti_chip_data *chips_data; const struct stm32_exti_drv_data *drv_data; struct hwspinlock *hwlock; + bool dt_has_irqs_desc; /* skip internal desc_irqs array and get it from DT */ }; static struct stm32_exti_host_data *stm32_host_data; @@ -731,6 +732,23 @@ static int stm32_exti_h_domain_alloc(struct irq_domain *dm, irq_domain_set_hwirq_and_chip(dm, virq, hwirq, chip, chip_data); + if (host_data->dt_has_irqs_desc) { + struct of_phandle_args out_irq; + int ret; + + ret = of_irq_parse_one(host_data->dev->of_node, hwirq, &out_irq); + if (ret) + return ret; + /* we only support one parent, so far */ + if (of_node_to_fwnode(out_irq.np) != dm->parent->fwnode) + return -EINVAL; + + of_phandle_args_to_fwspec(out_irq.np, out_irq.args, + out_irq.args_count, &p_fwspec); + + return irq_domain_alloc_irqs_parent(dm, virq, 1, &p_fwspec); + } + if (!host_data->drv_data->desc_irqs) return -EINVAL; @@ -975,6 +993,9 @@ static int stm32_exti_probe(struct platform_device *pdev) if (ret) return ret; + if (of_property_read_bool(np, "interrupts-extended")) + host_data->dt_has_irqs_desc = true; + stm32_exti_h_syscore_init(host_data); return 0; -- 2.34.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2024-04-15 13:51 UTC|newest] Thread overview: 75+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-02-16 9:47 [PATCH 00/12] irqchip/stm32-exti: add irq-map and STM32MP25 support Antonio Borneo 2024-02-16 9:47 ` Antonio Borneo 2024-02-16 9:47 ` [PATCH 01/12] irqchip/stm32-exti: Fix minor indentation issue Antonio Borneo 2024-02-16 9:47 ` Antonio Borneo 2024-02-19 14:16 ` Thomas Gleixner 2024-02-19 14:16 ` Thomas Gleixner 2024-02-16 9:47 ` [PATCH 02/12] dt-bindings: interrupt-controller: stm32-exti: Add irq nexus child node Antonio Borneo 2024-02-16 9:47 ` Antonio Borneo 2024-02-19 14:19 ` Thomas Gleixner 2024-02-19 14:19 ` Thomas Gleixner 2024-04-15 13:37 ` Antonio Borneo 2024-04-15 13:37 ` Antonio Borneo 2024-02-22 23:43 ` Rob Herring 2024-02-22 23:43 ` Rob Herring 2024-02-23 13:39 ` Antonio Borneo 2024-02-23 13:39 ` Antonio Borneo 2024-02-16 9:47 ` [PATCH 03/12] irqchip/stm32-exti: Map interrupts through interrupt nexus node Antonio Borneo 2024-02-16 9:47 ` Antonio Borneo 2024-02-19 14:22 ` Thomas Gleixner 2024-02-19 14:22 ` Thomas Gleixner 2024-02-16 9:47 ` [PATCH 04/12] irqchip/stm32-exti: Convert driver to standard PM Antonio Borneo 2024-02-16 9:47 ` Antonio Borneo 2024-02-16 9:47 ` [PATCH 05/12] irqchip/stm32-exti: Skip secure events Antonio Borneo 2024-02-16 9:47 ` Antonio Borneo 2024-02-16 9:47 ` [PATCH 06/12] irqchip/stm32-exti: Mark events reserved with RIF configuration check Antonio Borneo 2024-02-16 9:47 ` Antonio Borneo 2024-02-16 9:47 ` [PATCH 07/12] arm64: Kconfig.platforms: Enable STM32_EXTI for ARCH_STM32 Antonio Borneo 2024-02-16 9:47 ` Antonio Borneo 2024-02-16 9:47 ` [PATCH 08/12] ARM: dts: stm32: Use exti interrupt-map on stm32mp151 Antonio Borneo 2024-02-16 9:47 ` Antonio Borneo 2024-02-16 9:47 ` [PATCH 09/12] ARM: dts: stm32: Use exti interrupt-map on stm32mp131 Antonio Borneo 2024-02-16 9:47 ` Antonio Borneo 2024-02-16 9:47 ` [PATCH 10/12] arm64: dts: st: Add v2m to GIC node on stm32mp251 Antonio Borneo 2024-02-16 9:47 ` Antonio Borneo 2024-02-16 9:47 ` [PATCH 11/12] arm64: dts: st: Add exti1 and exti2 nodes " Antonio Borneo 2024-02-16 9:47 ` Antonio Borneo 2024-02-16 9:47 ` [PATCH 12/12] arm64: dts: st: Add interrupt parent to pinctrl " Antonio Borneo 2024-02-16 9:47 ` Antonio Borneo 2024-04-15 13:49 ` [PATCH v2 00/11] irqchip/stm32-exti: add irq map in DT and STM32MP25 support Antonio Borneo 2024-04-15 13:49 ` Antonio Borneo 2024-04-15 13:49 ` [PATCH v2 01/11] irqchip/stm32-exti: Fix minor indentation issue Antonio Borneo 2024-04-15 13:49 ` Antonio Borneo 2024-04-22 22:45 ` [tip: irq/core] " tip-bot2 for Antonio Borneo 2024-04-15 13:49 ` [PATCH v2 02/11] dt-bindings: interrupt-controller: stm32-exti: Add irq mapping to parent Antonio Borneo 2024-04-15 13:49 ` Antonio Borneo 2024-04-17 18:09 ` Rob Herring 2024-04-17 18:09 ` Rob Herring 2024-04-22 22:45 ` [tip: irq/core] " tip-bot2 for Antonio Borneo 2024-04-15 13:49 ` Antonio Borneo [this message] 2024-04-15 13:49 ` [PATCH v2 03/11] irqchip/stm32-exti: Map interrupts through interrupts-extended Antonio Borneo 2024-04-22 22:45 ` [tip: irq/core] " tip-bot2 for Antonio Borneo 2024-04-15 13:49 ` [PATCH v2 04/11] irqchip/stm32-exti: Convert driver to standard PM Antonio Borneo 2024-04-15 13:49 ` Antonio Borneo 2024-04-22 22:45 ` [tip: irq/core] " tip-bot2 for Antonio Borneo 2024-04-15 13:49 ` [PATCH v2 05/11] irqchip/stm32-exti: Skip secure events Antonio Borneo 2024-04-15 13:49 ` Antonio Borneo 2024-04-22 22:45 ` [tip: irq/core] " tip-bot2 for Antonio Borneo 2024-04-15 13:49 ` [PATCH v2 06/11] irqchip/stm32-exti: Mark events reserved with RIF configuration check Antonio Borneo 2024-04-15 13:49 ` Antonio Borneo 2024-04-22 22:45 ` [tip: irq/core] " tip-bot2 for Antonio Borneo 2024-04-15 13:49 ` [PATCH v2 07/11] arm64: Kconfig.platforms: Enable STM32_EXTI for ARCH_STM32 Antonio Borneo 2024-04-15 13:49 ` Antonio Borneo 2024-04-22 22:45 ` [tip: irq/core] " tip-bot2 for Antonio Borneo 2024-04-15 13:49 ` [PATCH v2 08/11] ARM: dts: stm32: List exti parent interrupts on stm32mp151 Antonio Borneo 2024-04-15 13:49 ` Antonio Borneo 2024-04-22 22:45 ` [tip: irq/core] " tip-bot2 for Antonio Borneo 2024-04-15 13:49 ` [PATCH v2 09/11] ARM: dts: stm32: List exti parent interrupts on stm32mp131 Antonio Borneo 2024-04-15 13:49 ` Antonio Borneo 2024-04-22 22:45 ` [tip: irq/core] " tip-bot2 for Antonio Borneo 2024-04-15 13:49 ` [PATCH v2 10/11] arm64: dts: st: Add exti1 and exti2 nodes on stm32mp251 Antonio Borneo 2024-04-15 13:49 ` Antonio Borneo 2024-04-22 22:45 ` [tip: irq/core] " tip-bot2 for Antonio Borneo 2024-04-15 13:49 ` [PATCH v2 11/11] arm64: dts: st: Add interrupt parent to pinctrl " Antonio Borneo 2024-04-15 13:49 ` Antonio Borneo 2024-04-22 22:45 ` [tip: irq/core] " tip-bot2 for Antonio Borneo
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240415134926.1254428-4-antonio.borneo@foss.st.com \ --to=antonio.borneo@foss.st.com \ --cc=alexandre.torgue@foss.st.com \ --cc=catalin.marinas@arm.com \ --cc=conor+dt@kernel.org \ --cc=devicetree@vger.kernel.org \ --cc=fabrice.gasnier@foss.st.com \ --cc=krzysztof.kozlowski+dt@linaro.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-stm32@st-md-mailman.stormreply.com \ --cc=mcoquelin.stm32@gmail.com \ --cc=robh+dt@kernel.org \ --cc=tglx@linutronix.de \ --cc=will@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.