This is a note to let you know that I've just added the patch titled i2c: aspeed: Reset the i2c controller when timeout occurs to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: i2c-aspeed-reset-the-i2c-controller-when-timeout-occurs.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From fee465150b458351b6d9b9f66084f3cc3022b88b Mon Sep 17 00:00:00 2001 From: Tommy Huang <tommy_huang@xxxxxxxxxxxxxx> Date: Wed, 6 Sep 2023 08:49:10 +0800 Subject: i2c: aspeed: Reset the i2c controller when timeout occurs From: Tommy Huang <tommy_huang@xxxxxxxxxxxxxx> commit fee465150b458351b6d9b9f66084f3cc3022b88b 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: 2e57b7cebb98 ("i2c: aspeed: Add multi-master use case support") Cc: <stable@xxxxxxxxxxxxxxx> # v5.1+ Signed-off-by: Tommy Huang <tommy_huang@xxxxxxxxxxxxxx> Reviewed-by: Andi Shyti <andi.shyti@xxxxxxxxxx> Signed-off-by: Wolfram Sang <wsa@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/i2c/busses/i2c-aspeed.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/drivers/i2c/busses/i2c-aspeed.c +++ b/drivers/i2c/busses/i2c-aspeed.c @@ -698,13 +698,16 @@ static int aspeed_i2c_master_xfer(struct if (time_left == 0) { /* - * If timed out and bus is still busy in a multi master - * environment, attempt recovery at here. + * In a multi-master setup, if a timeout occurs, attempt + * recovery. But if the bus is idle, we still need to reset the + * i2c controller to clear the remaining interrupts. */ if (bus->multi_master && (readl(bus->base + ASPEED_I2C_CMD_REG) & ASPEED_I2CD_BUS_BUSY_STS)) aspeed_i2c_recover_bus(bus); + else + aspeed_i2c_reset(bus); /* * If timed out and the state is still pending, drop the pending Patches currently in stable-queue which might be from tommy_huang@xxxxxxxxxxxxxx are queue-6.1/i2c-aspeed-reset-the-i2c-controller-when-timeout-occurs.patch