Skip to content

Commit c926c87

Browse files
aspeedtechWolfram Sang
authored and
Wolfram Sang
committed
i2c: aspeed: Avoid i2c interrupt status clear race condition.
In AST2600 there have a slow peripheral bus between CPU and i2c controller. Therefore GIC i2c interrupt status clear have delay timing, when CPU issue write clear i2c controller interrupt status. To avoid this issue, the driver need have read after write clear at i2c ISR. Fixes: f327c68 ("i2c: aspeed: added driver for Aspeed I2C") Signed-off-by: ryan_chen <[email protected]> Acked-by: Benjamin Herrenschmidt <[email protected]> [wsa: added Fixes tag] Signed-off-by: Wolfram Sang <[email protected]>
1 parent ac2b081 commit c926c87

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/i2c/busses/i2c-aspeed.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,7 @@ static irqreturn_t aspeed_i2c_bus_irq(int irq, void *dev_id)
603603
/* Ack all interrupts except for Rx done */
604604
writel(irq_received & ~ASPEED_I2CD_INTR_RX_DONE,
605605
bus->base + ASPEED_I2C_INTR_STS_REG);
606+
readl(bus->base + ASPEED_I2C_INTR_STS_REG);
606607
irq_remaining = irq_received;
607608

608609
#if IS_ENABLED(CONFIG_I2C_SLAVE)
@@ -645,9 +646,11 @@ static irqreturn_t aspeed_i2c_bus_irq(int irq, void *dev_id)
645646
irq_received, irq_handled);
646647

647648
/* Ack Rx done */
648-
if (irq_received & ASPEED_I2CD_INTR_RX_DONE)
649+
if (irq_received & ASPEED_I2CD_INTR_RX_DONE) {
649650
writel(ASPEED_I2CD_INTR_RX_DONE,
650651
bus->base + ASPEED_I2C_INTR_STS_REG);
652+
readl(bus->base + ASPEED_I2C_INTR_STS_REG);
653+
}
651654
spin_unlock(&bus->lock);
652655
return irq_remaining ? IRQ_NONE : IRQ_HANDLED;
653656
}

0 commit comments

Comments
 (0)