Skip to content

Commit e3a16c3

Browse files
bijudasKAGA-KOKO
authored andcommitted
irqchip/renesas-rzv2h: Update macros ICU_TSSR_TSSEL_{MASK,PREP}
On RZ/G3E, TSSEL register field is 8 bits wide compared to 7 on RZ/V2H. Also bits 8..14 is reserved on RZ/G3E and any writes on these reserved bits is ignored. Use bitmask GENMASK(field_width - 2, 0) on both SoCs for extracting TSSEL and then update the macros ICU_TSSR_TSSEL_PREP and ICU_TSSR_TSSEL_MASK for supporting both SoCs. Signed-off-by: Biju Das <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent 76c3b77 commit e3a16c3

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

drivers/irqchip/irq-renesas-rzv2h.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,13 @@
6464
#define ICU_TINT_LEVEL_HIGH 2
6565
#define ICU_TINT_LEVEL_LOW 3
6666

67-
#define ICU_TSSR_TSSEL_PREP(tssel, n) ((tssel) << ((n) * 8))
68-
#define ICU_TSSR_TSSEL_MASK(n) ICU_TSSR_TSSEL_PREP(0x7F, n)
67+
#define ICU_TSSR_TSSEL_PREP(tssel, n, field_width) ((tssel) << ((n) * (field_width)))
68+
#define ICU_TSSR_TSSEL_MASK(n, field_width) \
69+
({\
70+
typeof(field_width) (_field_width) = (field_width); \
71+
ICU_TSSR_TSSEL_PREP((GENMASK(((_field_width) - 2), 0)), (n), _field_width); \
72+
})
73+
6974
#define ICU_TSSR_TIEN(n, field_width) \
7075
({\
7176
typeof(field_width) (_field_width) = (field_width); \
@@ -326,8 +331,8 @@ static int rzv2h_tint_set_type(struct irq_data *d, unsigned int type)
326331
guard(raw_spinlock)(&priv->lock);
327332

328333
tssr = readl_relaxed(priv->base + priv->info->t_offs + ICU_TSSR(tssr_k));
329-
tssr &= ~(ICU_TSSR_TSSEL_MASK(tssel_n) | tien);
330-
tssr |= ICU_TSSR_TSSEL_PREP(tint, tssel_n);
334+
tssr &= ~(ICU_TSSR_TSSEL_MASK(tssel_n, priv->info->field_width) | tien);
335+
tssr |= ICU_TSSR_TSSEL_PREP(tint, tssel_n, priv->info->field_width);
331336

332337
writel_relaxed(tssr, priv->base + priv->info->t_offs + ICU_TSSR(tssr_k));
333338

0 commit comments

Comments
 (0)