diff mbox series

[06/11] irqchip/renesas-rzv2h: Add max_tssel variable to struct rzv2h_hw_info

Message ID 20250120094715.25802-7-biju.das.jz@bp.renesas.com (mailing list archive)
State Superseded
Delegated to: Geert Uytterhoeven
Headers show
Series Add Support for RZ/G3E ICU | expand

Commit Message

Biju Das Jan. 20, 2025, 9:47 a.m. UTC
The number of GPIO interrupts on RZ/G3E for TINT selection is 141 compared
to 86 on RZ/V2H.

Add max_tssel variable to struct rzv2h_hw_info to handle this difference.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/irqchip/irq-renesas-rzv2h.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Fabrizio Castro Jan. 22, 2025, 10:19 a.m. UTC | #1
Hi Biju,

Thanks for your patch!

> From: Biju Das <biju.das.jz@bp.renesas.com>
> Sent: 20 January 2025 09:47
> Subject: [PATCH 06/11] irqchip/renesas-rzv2h: Add max_tssel variable to struct rzv2h_hw_info
> 
> The number of GPIO interrupts on RZ/G3E for TINT selection is 141 compared
> to 86 on RZ/V2H.
> 
> Add max_tssel variable to struct rzv2h_hw_info to handle this difference.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>

Reviewed-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>

Cheers,
Fab

> ---
>  drivers/irqchip/irq-renesas-rzv2h.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/irqchip/irq-renesas-rzv2h.c b/drivers/irqchip/irq-renesas-rzv2h.c
> index 195ce9c5e5b5..b244cd61cba4 100644
> --- a/drivers/irqchip/irq-renesas-rzv2h.c
> +++ b/drivers/irqchip/irq-renesas-rzv2h.c
> @@ -78,14 +78,15 @@
> 
>  #define ICU_TINT_EXTRACT_HWIRQ(x)		FIELD_GET(GENMASK(15, 0), (x))
>  #define ICU_TINT_EXTRACT_GPIOINT(x)		FIELD_GET(GENMASK(31, 16), (x))
> -#define ICU_PB5_TINT				0x55
> 
>  /**
>   * struct rzv2h_hw_info - Interrupt Control Unit controller hardware info structure.
>   * @t_offs: TINT offset
> + * @max_tssel: TSSEL max value
>   */
>  struct rzv2h_hw_info {
>  	u16 t_offs;
> +	u8 max_tssel;
>  };
> 
>  /**
> @@ -298,13 +299,12 @@ static int rzv2h_tint_set_type(struct irq_data *d, unsigned int type)
>  		return -EINVAL;
>  	}
> 
> +	priv = irq_data_to_priv(d);
>  	tint = (u32)(uintptr_t)irq_data_get_irq_chip_data(d);
> -	if (tint > ICU_PB5_TINT)
> +	if (tint > priv->info->max_tssel)
>  		return -EINVAL;
> 
> -	priv = irq_data_to_priv(d);
>  	hwirq = irqd_to_hwirq(d);
> -
>  	tint_nr = hwirq - ICU_TINT_START;
> 
>  	tssr_k = ICU_TSSR_K(tint_nr);
> @@ -514,6 +514,7 @@ static int rzv2h_icu_init_common(struct device_node *node, struct device_node *p
> 
>  static const struct rzv2h_hw_info rzv2h_hw_params = {
>  	.t_offs = 0,
> +	.max_tssel = 0x55,
>  };
> 
>  static int rzv2h_icu_init(struct device_node *node, struct device_node *parent)
> --
> 2.43.0
>
Thomas Gleixner Jan. 23, 2025, 10:54 a.m. UTC | #2
On Mon, Jan 20 2025 at 09:47, Biju Das wrote:
>  /**
>   * struct rzv2h_hw_info - Interrupt Control Unit controller hardware info structure.
>   * @t_offs: TINT offset
> + * @max_tssel: TSSEL max value
>   */
>  struct rzv2h_hw_info {
>  	u16 t_offs;
> +	u8 max_tssel;

Both the kernel doc and the actual struct members want to be done in
tabular fashion.

https://www.kernel.org/doc/html/latest/process/maintainer-tip.html#struct-declarations-and-initializers

>  };
>  
>  /**
> @@ -298,13 +299,12 @@ static int rzv2h_tint_set_type(struct irq_data *d, unsigned int type)
>  		return -EINVAL;
>  	}
>  
> +	priv = irq_data_to_priv(d);
>  	tint = (u32)(uintptr_t)irq_data_get_irq_chip_data(d);
> -	if (tint > ICU_PB5_TINT)
> +	if (tint > priv->info->max_tssel)
>  		return -EINVAL;
>  
> -	priv = irq_data_to_priv(d);
>  	hwirq = irqd_to_hwirq(d);
> -
>  	tint_nr = hwirq - ICU_TINT_START;
>  
>  	tssr_k = ICU_TSSR_K(tint_nr);
> @@ -514,6 +514,7 @@ static int rzv2h_icu_init_common(struct device_node *node, struct device_node *p
>  
>  static const struct rzv2h_hw_info rzv2h_hw_params = {
>  	.t_offs = 0,
> +	.max_tssel = 0x55,

See documentation.

Thanks,

        tglx
Biju Das Jan. 23, 2025, 11:08 a.m. UTC | #3
Hi Thomas Gleixner,

Thanks for the feedback.

> -----Original Message-----
> From: Thomas Gleixner <tglx@linutronix.de>
> Sent: 23 January 2025 10:54
> Subject: Re: [PATCH 06/11] irqchip/renesas-rzv2h: Add max_tssel variable to struct rzv2h_hw_info
> 
> On Mon, Jan 20 2025 at 09:47, Biju Das wrote:
> >  /**
> >   * struct rzv2h_hw_info - Interrupt Control Unit controller hardware info structure.
> >   * @t_offs: TINT offset
> > + * @max_tssel: TSSEL max value
> >   */
> >  struct rzv2h_hw_info {
> >  	u16 t_offs;
> > +	u8 max_tssel;
> 
> Both the kernel doc and the actual struct members want to be done in tabular fashion.
> 
> https://www.kernel.org/doc/html/latest/process/maintainer-tip.html#struct-declarations-and-
> initializers

Thanks. I will fix it in next version.

> 
> >  };
> >
> >  /**
> > @@ -298,13 +299,12 @@ static int rzv2h_tint_set_type(struct irq_data *d, unsigned int type)
> >  		return -EINVAL;
> >  	}
> >
> > +	priv = irq_data_to_priv(d);
> >  	tint = (u32)(uintptr_t)irq_data_get_irq_chip_data(d);
> > -	if (tint > ICU_PB5_TINT)
> > +	if (tint > priv->info->max_tssel)
> >  		return -EINVAL;
> >
> > -	priv = irq_data_to_priv(d);
> >  	hwirq = irqd_to_hwirq(d);
> > -
> >  	tint_nr = hwirq - ICU_TINT_START;
> >
> >  	tssr_k = ICU_TSSR_K(tint_nr);
> > @@ -514,6 +514,7 @@ static int rzv2h_icu_init_common(struct
> > device_node *node, struct device_node *p
> >
> >  static const struct rzv2h_hw_info rzv2h_hw_params = {
> >  	.t_offs = 0,
> > +	.max_tssel = 0x55,
> 
> See documentation.

OK, Will fix it.

Cheers,
Biju
diff mbox series

Patch

diff --git a/drivers/irqchip/irq-renesas-rzv2h.c b/drivers/irqchip/irq-renesas-rzv2h.c
index 195ce9c5e5b5..b244cd61cba4 100644
--- a/drivers/irqchip/irq-renesas-rzv2h.c
+++ b/drivers/irqchip/irq-renesas-rzv2h.c
@@ -78,14 +78,15 @@ 
 
 #define ICU_TINT_EXTRACT_HWIRQ(x)		FIELD_GET(GENMASK(15, 0), (x))
 #define ICU_TINT_EXTRACT_GPIOINT(x)		FIELD_GET(GENMASK(31, 16), (x))
-#define ICU_PB5_TINT				0x55
 
 /**
  * struct rzv2h_hw_info - Interrupt Control Unit controller hardware info structure.
  * @t_offs: TINT offset
+ * @max_tssel: TSSEL max value
  */
 struct rzv2h_hw_info {
 	u16 t_offs;
+	u8 max_tssel;
 };
 
 /**
@@ -298,13 +299,12 @@  static int rzv2h_tint_set_type(struct irq_data *d, unsigned int type)
 		return -EINVAL;
 	}
 
+	priv = irq_data_to_priv(d);
 	tint = (u32)(uintptr_t)irq_data_get_irq_chip_data(d);
-	if (tint > ICU_PB5_TINT)
+	if (tint > priv->info->max_tssel)
 		return -EINVAL;
 
-	priv = irq_data_to_priv(d);
 	hwirq = irqd_to_hwirq(d);
-
 	tint_nr = hwirq - ICU_TINT_START;
 
 	tssr_k = ICU_TSSR_K(tint_nr);
@@ -514,6 +514,7 @@  static int rzv2h_icu_init_common(struct device_node *node, struct device_node *p
 
 static const struct rzv2h_hw_info rzv2h_hw_params = {
 	.t_offs = 0,
+	.max_tssel = 0x55,
 };
 
 static int rzv2h_icu_init(struct device_node *node, struct device_node *parent)