Skip to content

Commit 01c7c38

Browse files
TommyHuang0527gregkh
authored andcommitted
i2c: aspeed: Reset the i2c controller when timeout occurs
commit fee4651 upstream. Reset the i2c controller when an i2c transfer timeout occurs. The remaining interrupts and device should be reset to avoid unpredictable controller behavior. Fixes: 2e57b7c ("i2c: aspeed: Add multi-master use case support") Cc: <[email protected]> # v5.1+ Signed-off-by: Tommy Huang <[email protected]> Reviewed-by: Andi Shyti <[email protected]> Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 763d39f commit 01c7c38

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/i2c/busses/i2c-aspeed.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,13 +693,16 @@ static int aspeed_i2c_master_xfer(struct i2c_adapter *adap,
693693

694694
if (time_left == 0) {
695695
/*
696-
* If timed out and bus is still busy in a multi master
697-
* environment, attempt recovery at here.
696+
* In a multi-master setup, if a timeout occurs, attempt
697+
* recovery. But if the bus is idle, we still need to reset the
698+
* i2c controller to clear the remaining interrupts.
698699
*/
699700
if (bus->multi_master &&
700701
(readl(bus->base + ASPEED_I2C_CMD_REG) &
701702
ASPEED_I2CD_BUS_BUSY_STS))
702703
aspeed_i2c_recover_bus(bus);
704+
else
705+
aspeed_i2c_reset(bus);
703706

704707
/*
705708
* If timed out and the state is still pending, drop the pending

0 commit comments

Comments
 (0)