Skip to contentSkip to conversation

irqchip: irq-imx-irqsteer: Update the CHAN_MAX_OUTPUT_INT to 15

PATCH Applied Jacky Bai 2 participants 2 messages Mar 5, 2025 – Mar 7, 2025

Subsystems (2)
lore
Share & tools
lore

Jacky Bai

author
#0 lore raw

PATCH v2 1/1 irqchip: irq-imx-irqsteer: Update the CHAN_MAX_OUTPUT_INT to 15

From: Shengjiu Wang <[email protected]>

For the irqsteer channel, it can support up to 960 interrupt inputs. All the interrupt inputs are divided into groups of 64 each. Each group of interrupts uses one irqsteer interrupt output connected to the parent interrupt controller like GIC.

The CHAN_MAX_OUTPUT_INT is used to define the max interrupt outputs from the irqsteer. For previous i.MX SoCs, the irqsteer instance is designed with max 512 interrupt inputs. If the max interrupt inputs is 512, the max interrupt outputs is 512 / 64 = 8. But for i.MX94 family, the irqsteer is design with max 960 interrupt inputs capability, The CHAN_MAX_OUTPUT_INT is 15.

Update the CHAN_MAX_OUTPUT_INT to 15 and do necessary code changes to support the max 960 interrupt inputs case.

---
- v2 changes:
- Improve the changelog

---
 drivers/irqchip/irq-imx-irqsteer.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/irqchip/irq-imx-irqsteer.c +8 -6
index b0e9788c0045..afbfcce3b1e3 100644
@@ -24,7 +24,7 @@
 #define CHAN_MINTDIS(t)		(CTRL_STRIDE_OFF(t, 3) + 0x4)
 #define CHAN_MASTRSTAT(t)	(CTRL_STRIDE_OFF(t, 3) + 0x8)
 
-#define CHAN_MAX_OUTPUT_INT	0x8
+#define CHAN_MAX_OUTPUT_INT	0xF
 
 struct irqsteer_data {
 	void __iomem		*regs;
@@ -228,10 +228,8 @@ static int imx_irqsteer_probe(struct platform_device *pdev)
 
 	for (i = 0; i < data->irq_count; i++) {
 		data->irq[i] = irq_of_parse_and_map(np, i);
-		if (!data->irq[i]) {
-			ret = -EINVAL;
-			goto out;
-		}
+		if (!data->irq[i])
+			break;
 
 		irq_set_chained_handler_and_data(data->irq[i],
 						 imx_irqsteer_irq_handler,
@@ -254,9 +252,13 @@ static void imx_irqsteer_remove(struct platform_device *pdev)
 	struct irqsteer_data *irqsteer_data = platform_get_drvdata(pdev);
 	int i;
 
-	for (i = 0; i < irqsteer_data->irq_count; i++)
+	for (i = 0; i < irqsteer_data->irq_count; i++) {
+		if (!irqsteer_data->irq[i])
+			break;
+
 		irq_set_chained_handler_and_data(irqsteer_data->irq[i],
 						 NULL, NULL);
+	}
 
 	irq_domain_remove(irqsteer_data->domain);
 
Signature · 1 line
2.34.1
merge bot Applied
#1 lore raw

[tip: irq/drivers] irqchip/imx-irqsteer: Support up to 960 input interrupts

The following commit has been merged into the irq/drivers branch of tip:

The following commit has been merged into the irq/drivers branch of tip:

Commit-ID:     7db5fd6b751fbcaca253efc4de68f4346299948f
Gitweb:        https://git.kernel.org/tip/7db5fd6b751fbcaca253efc4de68f4346299948f
Author:        Shengjiu Wang <[email protected]>
AuthorDate:    Wed, 05 Mar 2025 17:55:22 +08:00
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Fri, 07 Mar 2025 09:42:46 +01:00

irqchip/imx-irqsteer: Support up to 960 input interrupts

The irqsteer IP routes groups of input interrupts to a dedicated system interrupt per group. Each group handles 64 input interrupts.

The current driver is limited to 8 groups, i.e. 512 input interrupts, which is sufficient for the existing i.MX SoCs. The upcoming i.MX94 family extends the irqsteer IP to 15 groups, i.e. 960 interrupts.

Extending the group limit to 15 enables this, but the new SoCs are not guaranteed to utilize all 15 groups. Unused groups have no mapping for the underlying output interrupt, which makes the probe function fail as it expects a valid mapping for each group output.

Remove this limitation and stop the mapping loop, when no valid mapping is detected.

[ tglx: Massage change log ]

---
 drivers/irqchip/irq-imx-irqsteer.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/irqchip/irq-imx-irqsteer.c +8 -6
index b0e9788..afbfcce 100644
@@ -24,7 +24,7 @@
 #define CHAN_MINTDIS(t)		(CTRL_STRIDE_OFF(t, 3) + 0x4)
 #define CHAN_MASTRSTAT(t)	(CTRL_STRIDE_OFF(t, 3) + 0x8)
 
-#define CHAN_MAX_OUTPUT_INT	0x8
+#define CHAN_MAX_OUTPUT_INT	0xF
 
 struct irqsteer_data {
 	void __iomem		*regs;
@@ -228,10 +228,8 @@ static int imx_irqsteer_probe(struct platform_device *pdev)
 
 	for (i = 0; i < data->irq_count; i++) {
 		data->irq[i] = irq_of_parse_and_map(np, i);
-		if (!data->irq[i]) {
-			ret = -EINVAL;
-			goto out;
-		}
+		if (!data->irq[i])
+			break;
 
 		irq_set_chained_handler_and_data(data->irq[i],
 						 imx_irqsteer_irq_handler,
@@ -254,9 +252,13 @@ static void imx_irqsteer_remove(struct platform_device *pdev)
 	struct irqsteer_data *irqsteer_data = platform_get_drvdata(pdev);
 	int i;
 
-	for (i = 0; i < irqsteer_data->irq_count; i++)
+	for (i = 0; i < irqsteer_data->irq_count; i++) {
+		if (!irqsteer_data->irq[i])
+			break;
+
 		irq_set_chained_handler_and_data(irqsteer_data->irq[i],
 						 NULL, NULL);
+	}
 
 	irq_domain_remove(irqsteer_data->domain);