During i2c probe, repeated accesses to non-existent slave addresses generate consecutive NACK responses. On GENI I2C controllers, these back-to-back error conditions leaves the controller in an invalid or busy state, especially at lower bus frequencies (100 kHz and 400 kHz). As a result, subsequent transfers fails and valid slave addresses are not detected.
Currently, controller recovery is triggered only on timeout errors. However, NACK conditions (-EREMOTEIO) can lead to the same stale bus state. Handle -EREMOTEIO similar to -ETIMEDOUT by issuing a command abort before starting the next transfer. This ensures the controller state machine is reset and the bus is returned to a known good state. This improves reliability of i2c probe and allows correct detection of slave devices under repeated probing conditions. Signed-off-by: Aswin Murugan <[email protected]> --- drivers/i2c/geni_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/geni_i2c.c b/drivers/i2c/geni_i2c.c index fbe5ab0ad0c..7498cbcb41a 100644 --- a/drivers/i2c/geni_i2c.c +++ b/drivers/i2c/geni_i2c.c @@ -285,7 +285,7 @@ static int geni_i2c_xfer(struct udevice *bus, struct i2c_msg msgs[], int num) } if (ret) { - if (ret == -ETIMEDOUT) { + if (ret == -ETIMEDOUT || ret == -EREMOTEIO) { u32 status; writel(M_GENI_CMD_ABORT, geni->base + SE_GENI_M_CMD_CTRL_REG); -- 2.34.1

