[PATCH v1] i2c: geni: reset controller on NACK to recover from invalid bus state
neil.armstrong at linaro.org
neil.armstrong at linaro.org
Tue Jun 2 10:58:08 CEST 2026
On 6/2/26 08:43, Aswin Murugan wrote:
> 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 <aswin.murugan at oss.qualcomm.com>
> ---
> 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);
Reviewed-by: Neil Armstrong <neil.armstrong at linaro.org>
Thanks,
Neil
More information about the U-Boot
mailing list