diff mbox series

[5.10.y-cip,10/36] of: platform: Skip populating IRQ to device resource table

Message ID 20240327081756.2228036-11-claudiu.beznea.uj@bp.renesas.com (mailing list archive)
State New
Headers show
Series Add IA55 interrupt controller support | expand

Commit Message

Claudiu Beznea March 27, 2024, 8:17 a.m. UTC
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

IA55 IRQ controller is connected to GIC and pin controller, the topology
being the following:

                                     ┌──────────┐          ┌──────────┐
                                     │          │ SPIX     │          │
                                     │          ├─────────►│          │
                                     │          │          │          │
                                     │          │          │          │
             ┌────────┐IRQ0-7        │  IA55    │          │  GIC     │
Pin0 ───────►│        ├─────────────►│          │          │          │
             │        │              │          │ PPIY     │          │
...          │  GPIO  │              │          ├─────────►│          │
             │        │GPIOINT0-127  │          │          │          │
PinN ───────►│        ├─────────────►│          │          │          │
             └────────┘              └──────────┘          └──────────┘

where:
 - Pin0 is the first GPIO controller pin
 - PinN is the last GPIO controller pin

 - SPIX is the SPI interrupt with identifier X
 - PPIY is the PPI interrupt with identifier Y

While the initial driver has been developed it has been discovered that
there are issues with this kind of topology because the
platform_get_resource(pdev, IORESOURCE_IRQ, ...) relies on static
allocation of IRQ resources in DT core code (though of_device_alloc()).

When hierarchical interrupt domains with "interrupts" property in the node
are present the usage of platform_get_resource(pdev, IORESOURCE_IRQ, ...),
relying on IRQ resource allocation in DT core, bypasses the hierarchical
setup and breaks the IRQ chaining.

In the mainline kernel this has been addressed by converting all the IRQ
drivers to use platform_get_irq() instead of
platform_get_resource(pdev, IORESOURCE_IRQ, ...) and removing the
of_irq_to_resource_table() and associated code from of_device_alloc()
with commit a1a2b7125e10 ("of/platform: Drop static setup of IRQ resource
from DT core")"

To keep the same driver code and device tree bindings for IA55 IRQC the
of_device_alloc() has been adjusted to not allocate and parse the IA55
IRQ resources.

Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
 drivers/of/platform.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 43748c6480c8..f7ce5f0faf85 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -119,7 +119,10 @@  struct platform_device *of_device_alloc(struct device_node *np,
 	/* count the io and irq resources */
 	while (of_address_to_resource(np, num_reg, &temp_res) == 0)
 		num_reg++;
-	num_irq = of_irq_count(np);
+	if (of_device_is_compatible(np, "renesas,rzg2l-irqc"))
+		num_irq = 0;
+	else
+		num_irq = of_irq_count(np);
 
 	/* Populate the resource table */
 	if (num_irq || num_reg) {