[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260204180632.249139-7-biju.das.jz@bp.renesas.com>
Date: Wed, 4 Feb 2026 18:06:22 +0000
From: Biju <biju.das.au@...il.com>
To: Thomas Gleixner <tglx@...nel.org>
Cc: Biju Das <biju.das.jz@...renesas.com>,
linux-kernel@...r.kernel.org,
Geert Uytterhoeven <geert+renesas@...der.be>,
Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@...renesas.com>,
Biju Das <biju.das.au@...il.com>,
linux-renesas-soc@...r.kernel.org
Subject: [PATCH v2 6/9] irqchip/renesas-rzg2l: Drop IRQC_IRQ_COUNT macro
From: Biju Das <biju.das.jz@...renesas.com>
The total number of External IRQs in RZ/G2L and RZ/G3L SoC are different.
The RZ/G3L has 16 external IRQs where as RZ/G2L has only 8 external IRQ.
Add irq_count variable in struct rzg2l_hw_info to handle this differences
and drop the macro IRQC_IRQ_COUNT.
Signed-off-by: Biju Das <biju.das.jz@...renesas.com>
---
v1->v2:
* No change
---
drivers/irqchip/irq-renesas-rzg2l.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/irqchip/irq-renesas-rzg2l.c b/drivers/irqchip/irq-renesas-rzg2l.c
index e5393306f610..0de7db45d4c8 100644
--- a/drivers/irqchip/irq-renesas-rzg2l.c
+++ b/drivers/irqchip/irq-renesas-rzg2l.c
@@ -21,7 +21,6 @@
#include <linux/syscore_ops.h>
#define IRQC_IRQ_START 1
-#define IRQC_IRQ_COUNT 8
#define IRQC_TINT_COUNT 32
#define ISCR 0x10
@@ -68,10 +67,12 @@ struct rzg2l_irqc_reg_cache {
/**
* struct rzg2l_hw_info - Interrupt Control Unit controller hardware info structure.
+ * @irq_count: Number of IRQC interrupts
* @tint_start: Start of TINT interrupts
* @num_irq: Total Number of interrupts
*/
struct rzg2l_hw_info {
+ u8 irq_count;
u8 tint_start;
u8 num_irq;
};
@@ -144,7 +145,7 @@ static void rzg2l_irqc_eoi(struct irq_data *d)
unsigned int hw_irq = irqd_to_hwirq(d);
raw_spin_lock(&priv->lock);
- if (hw_irq >= IRQC_IRQ_START && hw_irq <= IRQC_IRQ_COUNT)
+ if (hw_irq >= IRQC_IRQ_START && hw_irq <= priv->info->irq_count)
rzg2l_clear_irq_int(priv, hw_irq);
else if (hw_irq >= priv->info->tint_start && hw_irq < priv->info->num_irq)
rzg2l_clear_tint_int(priv, hw_irq);
@@ -190,7 +191,7 @@ static void rzfive_irqc_mask(struct irq_data *d)
unsigned int hwirq = irqd_to_hwirq(d);
raw_spin_lock(&priv->lock);
- if (hwirq >= IRQC_IRQ_START && hwirq <= IRQC_IRQ_COUNT)
+ if (hwirq >= IRQC_IRQ_START && hwirq <= priv->info->irq_count)
rzfive_irqc_mask_irq_interrupt(priv, hwirq);
else if (hwirq >= priv->info->tint_start && hwirq < priv->info->num_irq)
rzfive_irqc_mask_tint_interrupt(priv, hwirq);
@@ -204,7 +205,7 @@ static void rzfive_irqc_unmask(struct irq_data *d)
unsigned int hwirq = irqd_to_hwirq(d);
raw_spin_lock(&priv->lock);
- if (hwirq >= IRQC_IRQ_START && hwirq <= IRQC_IRQ_COUNT)
+ if (hwirq >= IRQC_IRQ_START && hwirq <= priv->info->irq_count)
rzfive_irqc_unmask_irq_interrupt(priv, hwirq);
else if (hwirq >= priv->info->tint_start && hwirq < priv->info->num_irq)
rzfive_irqc_unmask_tint_interrupt(priv, hwirq);
@@ -400,7 +401,7 @@ static int rzg2l_irqc_set_type(struct irq_data *d, unsigned int type)
unsigned int hw_irq = irqd_to_hwirq(d);
int ret = -EINVAL;
- if (hw_irq >= IRQC_IRQ_START && hw_irq <= IRQC_IRQ_COUNT)
+ if (hw_irq >= IRQC_IRQ_START && hw_irq <= priv->info->irq_count)
ret = rzg2l_irq_set_type(d, type);
else if (hw_irq >= priv->info->tint_start && hw_irq < priv->info->num_irq)
ret = rzg2l_tint_set_edge(d, type);
@@ -500,7 +501,7 @@ static int rzg2l_irqc_alloc(struct irq_domain *domain, unsigned int virq,
* from 16-31 bits. TINT from the pinctrl driver needs to be programmed
* in IRQC registers to enable a given gpio pin as interrupt.
*/
- if (hwirq > IRQC_IRQ_COUNT) {
+ if (hwirq > priv->info->irq_count) {
tint = TINT_EXTRACT_GPIOINT(hwirq);
hwirq = TINT_EXTRACT_HWIRQ(hwirq);
@@ -607,8 +608,9 @@ static int rzg2l_irqc_common_probe(struct platform_device *pdev, struct device_n
}
static const struct rzg2l_hw_info rzg2l_hw_params = {
- .tint_start = IRQC_IRQ_START + IRQC_IRQ_COUNT,
- .num_irq = IRQC_IRQ_START + IRQC_IRQ_COUNT + IRQC_TINT_COUNT,
+ .irq_count = 8,
+ .tint_start = IRQC_IRQ_START + 8,
+ .num_irq = IRQC_IRQ_START + 8 + IRQC_TINT_COUNT,
};
static int rzg2l_irqc_probe(struct platform_device *pdev, struct device_node *parent)
--
2.43.0
Powered by blists - more mailing lists