i2c: aspeed: Prevent state corruption for IRQ with no status
PATCH 1/1 i2c: aspeed: Prevent state corruption for IRQ with no status
On the AST2600, interrupts have been observed with no interrupt status bits set. This can break the driver state machine, so these interrupts should be detected and the handler should return IRQ_NONE.
Signed-off-by Eddie James <[email protected]>
--- drivers/i2c/busses/i2c-aspeed.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/i2c/busses/i2c-aspeed.c +11 -0
@@ -603,6 +603,17 @@ static irqreturn_t aspeed_i2c_bus_irq(int irq, void *dev_id)spin_lock (&bus->lock); irq_received =readl (bus->base +ASPEED_I2C_INTR_STS_REG ); + +/* +* On the AST2600, interrupts have been observed with no interrupt +* status bits set. In this case, the handler should return IRQ_NONE +* immediately to prevent driver state machine corruption. +*/ +if (!irq_received) { +spin_unlock (&bus->lock); +return IRQ_NONE ; + } +/* Ack all interrupts except for Rx done */ writel (irq_received & ~ASPEED_I2CD_INTR_RX_DONE , bus->base +ASPEED_I2C_INTR_STS_REG );
Signature · 1 line
2.23.0
Quoted 5 lines · Eddie James
On the AST2600, interrupts have been observed with no interrupt status bits set. This can break the driver state machine, so these interrupts should be detected and the handler should return
IRQ_NONE.Signed-off-by Eddie James <[email protected]>
Reviewed-by Jae Hyun Yoo <[email protected]>
Thanks Eddie!
Quoted 27 lines
--- drivers/i2c/busses/i2c-aspeed.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/i2c/busses/i2c-aspeed.c +11
-0@@ -603,6 +603,17 @@ static irqreturn_t aspeed_i2c_bus_irq(int irq, void *dev_id)spin_lock (&bus->lock); irq_received =readl (bus->base +ASPEED_I2C_INTR_STS_REG ); + +/* +* On the AST2600, interrupts have been observed with no interrupt +* status bits set. In this case, the handler should return IRQ_NONE +* immediately to prevent driver state machine corruption. +*/ +if (!irq_received) { +spin_unlock (&bus->lock); +return IRQ_NONE ; + } +/* Ack all interrupts except for Rx done */ writel (irq_received & ~ASPEED_I2CD_INTR_RX_DONE , bus->base +ASPEED_I2C_INTR_STS_REG );