Skip to content

Commit 9966c8c

Browse files
bijudasgregkh
authored andcommitted
irqchip/renesas-rzv2h: Prevent TINT spurious interrupt during resume
[ Upstream commit cd4a3ce ] A glitch in the edge detection circuit can cause a spurious interrupt. The hardware manual recommends clearing the status flag after setting the ICU_TSSRk register as a countermeasure. Currently, a spurious interrupt is generated on the resume path of s2idle for the PMIC RTC TINT interrupt due to a glitch related to unnecessary enabling/disabling of the TINT enable bit. Fix this issue by not setting TSSR(TINT Source) and TITSR(TINT Detection Method Selection) registers if the values are the same as those set in these registers. Fixes: 0d7605e ("irqchip: Add RZ/V2H(P) Interrupt Control Unit (ICU) driver") Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260113125315.359967-2-biju.das.jz@bp.renesas.com [tm: Added field_get() to avoid build error] Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 79966ba commit 9966c8c

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

drivers/irqchip/irq-renesas-rzv2h.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@
8989
#define ICU_RZG3E_TSSEL_MAX_VAL 0x8c
9090
#define ICU_RZV2H_TSSEL_MAX_VAL 0x55
9191

92+
#define field_get(_mask, _reg) (((_reg) & (_mask)) >> (ffs(_mask) - 1))
93+
9294
/**
9395
* struct rzv2h_hw_info - Interrupt Control Unit controller hardware info structure.
9496
* @tssel_lut: TINT lookup table
@@ -328,6 +330,7 @@ static int rzv2h_tint_set_type(struct irq_data *d, unsigned int type)
328330
u32 titsr, titsr_k, titsel_n, tien;
329331
struct rzv2h_icu_priv *priv;
330332
u32 tssr, tssr_k, tssel_n;
333+
u32 titsr_cur, tssr_cur;
331334
unsigned int hwirq;
332335
u32 tint, sense;
333336
int tint_nr;
@@ -376,12 +379,18 @@ static int rzv2h_tint_set_type(struct irq_data *d, unsigned int type)
376379
guard(raw_spinlock)(&priv->lock);
377380

378381
tssr = readl_relaxed(priv->base + priv->info->t_offs + ICU_TSSR(tssr_k));
382+
titsr = readl_relaxed(priv->base + priv->info->t_offs + ICU_TITSR(titsr_k));
383+
384+
tssr_cur = field_get(ICU_TSSR_TSSEL_MASK(tssel_n, priv->info->field_width), tssr);
385+
titsr_cur = field_get(ICU_TITSR_TITSEL_MASK(titsel_n), titsr);
386+
if (tssr_cur == tint && titsr_cur == sense)
387+
return 0;
388+
379389
tssr &= ~(ICU_TSSR_TSSEL_MASK(tssel_n, priv->info->field_width) | tien);
380390
tssr |= ICU_TSSR_TSSEL_PREP(tint, tssel_n, priv->info->field_width);
381391

382392
writel_relaxed(tssr, priv->base + priv->info->t_offs + ICU_TSSR(tssr_k));
383393

384-
titsr = readl_relaxed(priv->base + priv->info->t_offs + ICU_TITSR(titsr_k));
385394
titsr &= ~ICU_TITSR_TITSEL_MASK(titsel_n);
386395
titsr |= ICU_TITSR_TITSEL_PREP(sense, titsel_n);
387396

0 commit comments

Comments
 (0)