[PATCH 1/2] i2c: imx: Don't recover bus when arbitration lost

Frank Li Frank.li at nxp.com
Wed Mar 11 08:43:08 PDT 2026


On Wed, Mar 11, 2026 at 11:47:43AM +0000, Daniel Scally wrote:
> The i2c-imx driver runs i2c_recover_bus() if i2c_imx_start() fails.

> One of the failure modes is an arbitration-lost signal from the
> hardware however, to which bus recovery is not the right response.
>

Supposed

One of the failure modes is an arbitration-lost signal from the second I2C
master or slave devices, which is expected behavor. Specially two masters
try to control the bus simultaneously.

So bus recovery is not the right response for this case. Add check -EAGAIN
of i2c_recover_bus() to avoid wrong action.

Fixed tags here!

Frank

> Do not try to recover the bus if it loses arbitration during start.
>
> Signed-off-by: Daniel Scally <dan.scally at ideasonboard.com>
> ---
>  drivers/i2c/busses/i2c-imx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index 85f554044cf1eec7d28310c3d9e7a7346237afdb..ed2316ab1ba8b6261dabe8af4377136a002e2f0b 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -1539,7 +1539,7 @@ static int i2c_imx_xfer_common(struct i2c_adapter *adapter,
>
>  	/* Start I2C transfer */
>  	result = i2c_imx_start(i2c_imx, atomic);
> -	if (result) {
> +	if (result && result != -EAGAIN) {
>  		/*
>  		 * Bus recovery uses gpiod_get_value_cansleep() which is not
>  		 * allowed within atomic context.
>
> --
> 2.43.0
>



More information about the linux-arm-kernel mailing list