[PATCH v5 16/27] irqchip/atmel-aic5: Add support to get nr_irqs from DT for sam9x60 & sam9x7

Varshini Rajendran varshini.rajendran at microchip.com
Wed Jul 3 03:28:21 PDT 2024


Add support to get number of IRQs from the respective DT node for sam9x60
and sam9x7 devices. Since only this factor differs between the two SoCs,
this patch adds support for the same. The macro is still used as a
fallback for the sake of old sam9x60 DTs to work so that there is no ABI
breakage. The property is a enforced as a requirement for sam9x7 alone.

Signed-off-by: Varshini Rajendran <varshini.rajendran at microchip.com>
---
Changes in v5:
- Changed the ABI breaking code.
- Added sam9x60 NR_IRQ as fallback for older DTS to work.
---
 drivers/irqchip/irq-atmel-aic5.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-atmel-aic5.c b/drivers/irqchip/irq-atmel-aic5.c
index 145535bd7560..164b5a9b0f9b 100644
--- a/drivers/irqchip/irq-atmel-aic5.c
+++ b/drivers/irqchip/irq-atmel-aic5.c
@@ -403,6 +403,12 @@ IRQCHIP_DECLARE(sama5d4_aic5, "atmel,sama5d4-aic", sama5d4_aic5_of_init);
 static int __init sam9x60_aic5_of_init(struct device_node *node,
 				       struct device_node *parent)
 {
-	return aic5_of_init(node, parent, NR_SAM9X60_IRQS);
+	int ret, nr_irqs;
+
+	ret = of_property_read_u32(node, "microchip,nr-irqs", &nr_irqs);
+	if (ret)
+		return aic5_of_init(node, parent, NR_SAM9X60_IRQS);
+
+	return aic5_of_init(node, parent, nr_irqs);
 }
 IRQCHIP_DECLARE(sam9x60_aic5, "microchip,sam9x60-aic", sam9x60_aic5_of_init);
-- 
2.25.1




More information about the linux-arm-kernel mailing list