summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEddie James <eajames@linux.ibm.com>2019-10-18 18:46:02 +0300
committerJoel Stanley <joel@jms.id.au>2019-12-12 01:29:58 +0300
commit20572eecd7248b66d855a8e4812debd9f828ccba (patch)
treea16f755623b3fec1527a562937f133b92058bc7c
parentc6846ad0e52a2d6d1e8a135d8e090860b9b40d38 (diff)
downloadlinux-20572eecd7248b66d855a8e4812debd9f828ccba.tar.xz
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. This is a workaround and should not be merged upstream. OpenBMC-Staging-Count: 1 Signed-off-by: Eddie James <eajames@linux.ibm.com> Reviewed-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com>
-rw-r--r--drivers/i2c/busses/i2c-aspeed.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c
index a7be6f24450b..b63ecc20777e 100644
--- a/drivers/i2c/busses/i2c-aspeed.c
+++ b/drivers/i2c/busses/i2c-aspeed.c
@@ -600,6 +600,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);