Skip to contentSkip to conversation

irq: imx-irqsteer: irq_count can larger than registered irq

PATCH In review Jacky Bai 2 participants 3 messages Mar 4, 2025

Subsystems (2)
lore
Share & tools
lore

Jacky Bai

author
#0 lore raw

PATCH 1/1 irq: imx-irqsteer: irq_count can larger than registered irq

From: Shengjiu Wang <[email protected]>

The irqsteer IP itself can support up to 5 channels and each channel can support max 960 IRQs per. The actual number of channels and IRQ per channel implemented in HW is SoC related.

For previous i.MX SoCs, normally only one channel and max 512 IRQ is implemented, But for i.MX94, the irqsteer HW is implemented for 960 IRQs, even it only has 384 IRQs connected.

That means on i.MX94, the 'irq_number' is 6 but the 'irq_count' is 15, so we need to increase the CHAN_MAX_OUTPUT_INT to 0xF(960 / 64) to make sure the irqsteer can work correctly on i.MX94.

---
 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
#1 lore raw
Quoted 1 line · Jacky Bai

From: Shengjiu Wang <[email protected]>

Please use the proper subsystem prefix as documented:

https://www.kernel.org/doc/html/latest/process/maintainer-tip.html#patch-submission-notes

Also 'irq_count can larger than registered irq' is not a sentence and tells absolutely nothing what this patch is about.

Quoted 2 lines

The irqsteer IP itself can support up to 5 channels and each channel can support max 960 IRQs per. The actual number of

Can you please write out words, i.e. interrupts, hardware etc.. This is a changelog and not twatter.

Aside of that: 'per.' does not make any sense. 'per' wants to be followed by a noun: '...per $WHAT.'

Quoted 7 lines

channels and IRQ per channel implemented in HW is SoC related.

For previous i.MX SoCs, normally only one channel and max 512 IRQ is implemented, But for i.MX94, the irqsteer HW is implemented for 960 IRQs, even it only has 384 IRQs connected.

That means on i.MX94, the 'irq_number' is 6 but the 'irq_count' is

What means irq_number and irq_count here?

Quoted 1 line

15, so we need to increase the CHAN_MAX_OUTPUT_INT to 0xF(960 / 64)

What kind of math is 0xF(960 / 64) ? And what has this to do with irq_number=6 ad irq_count=15?

Thanks,

tglx

author
#2 lore raw
Quoted 4 lines

Subject: Re: [PATCH] irq: imx-irqsteer: irq_count can larger than registered irq

Quoted 1 line · Jacky Bai

From: Shengjiu Wang <[email protected]>

Hi Thomas,

Quoted 4 lines

Please use the proper subsystem prefix as documented:

...

Quoted 4 lines

Also 'irq_count can larger than registered irq' is not a sentence and tells absolutely nothing what this patch is about.

My fault, will fix it.

Quoted 9 lines
Quoted 2 lines

The irqsteer IP itself can support up to 5 channels and each channel can support max 960 IRQs per. The actual number of

Can you please write out words, i.e. interrupts, hardware etc.. This is a changelog and not twatter.

Aside of that: 'per.' does not make any sense. 'per' wants to be followed by a
noun: '...per $WHAT.'

Thx, will improve and fix in v2.

Quoted 9 lines
Quoted 7 lines

channels and IRQ per channel implemented in HW is SoC related.

For previous i.MX SoCs, normally only one channel and max 512 IRQ is implemented, But for i.MX94, the irqsteer HW is implemented for 960 IRQs, even it only has 384 IRQs connected.

That means on i.MX94, the 'irq_number' is 6 but the 'irq_count' is

What means irq_number and irq_count here?

For irqsteer, the interrupt inputs are divided into groups, each group has 64 interrupt Inputs and use one irqsteer's interrupt output line to raise interrupt to parent interrupt controller.

The irq_number means how many interrupt output lines from irqsteer are really connected to the parent interrupt controller, while the irq_count means the max interrupt input line groups in the irqsteer instance.

If the irq_count is 15, as each group has 64 interrupts, it means the irqsteer can support up to 960 interrupt inputs.

Quoted 5 lines
Quoted 2 lines

15, so we need to increase the CHAN_MAX_OUTPUT_INT to 0xF(960 / 64)

What kind of math is 0xF(960 / 64) ? And what has this to do with irq_number=6 ad irq_count=15?

As mentioned above, if the irqsteer is designed in HW with max 960 interrupt inputs, It needs 15 interrupt outputs: 960 / 16 = 15. Even if we only 384, 512, or any number of interrupt inputs less than 960 are actually connected to valid peripheral interrupt.

For i.MX94, In the SoC design, the irqsteer is designed with max 960 interrupt inputs, the irq_count is 15. But only 384 inputs are really connected in HW. For these 384 interrupts, it need 6 irqsteer interrupt output(384 / 64 = 6), the irq_number is 6.

In other world, the irq_number means the number of used interrupt outputs, while irq_count means the max interrupt outputs that can be supported by an irqsteer instance.

I will refine the changelog to make it more clear. Sorry for the confusion,^_^

BR
Jacky

Quoted 4 lines

Thanks,

tglx