Skip to content

Commit ef88eef

Browse files
claudiubezneaKAGA-KOKO
authored andcommitted
irqchip/renesas-rzg2l: Implement restriction when writing ISCR register
The RZ/G2L manual (chapter "IRQ Status Control Register (ISCR)") describes the operation to clear interrupts through the ISCR register as follows: [Write operation] When "Falling-edge detection", "Rising-edge detection" or "Falling/Rising-edge detection" is set in IITSR: - In case ISTAT is 1 0: IRQn interrupt detection status is cleared. 1: Invalid to write. - In case ISTAT is 0 Invalid to write. When "Low-level detection" is set in IITSR.: Invalid to write. Take the interrupt type into account when clearing interrupts through the ISCR register to avoid writing the ISCR when the interrupt type is level. Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/20231120111820.87398-6-claudiu.beznea.uj@bp.renesas.com
1 parent b94f455 commit ef88eef

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

drivers/irqchip/irq-renesas-rzg2l.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,17 @@ static void rzg2l_irq_eoi(struct irq_data *d)
7878
unsigned int hw_irq = irqd_to_hwirq(d) - IRQC_IRQ_START;
7979
struct rzg2l_irqc_priv *priv = irq_data_to_priv(d);
8080
u32 bit = BIT(hw_irq);
81-
u32 reg;
81+
u32 iitsr, iscr;
8282

83-
reg = readl_relaxed(priv->base + ISCR);
84-
if (reg & bit)
85-
writel_relaxed(reg & ~bit, priv->base + ISCR);
83+
iscr = readl_relaxed(priv->base + ISCR);
84+
iitsr = readl_relaxed(priv->base + IITSR);
85+
86+
/*
87+
* ISCR can only be cleared if the type is falling-edge, rising-edge or
88+
* falling/rising-edge.
89+
*/
90+
if ((iscr & bit) && (iitsr & IITSR_IITSEL_MASK(hw_irq)))
91+
writel_relaxed(iscr & ~bit, priv->base + ISCR);
8692
}
8793

8894
static void rzg2l_tint_eoi(struct irq_data *d)

0 commit comments

Comments
 (0)