Re: [PATCH v2 2/2] i2c: qcom-cci: Retry a timed-out first message after resetting

From: Andi Shyti

Date: Thu Dec 03 2026 - 21:28:46 EST


Hi Birk,

...

> @@ -529,14 +539,14 @@ static int cci_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
> goto err;
>
> for (i = 0; i < num; i++) {
> - if (msgs[i].flags & I2C_M_RD)
> - ret = cci_i2c_read(cci, cci_master->master,
> - msgs[i].addr, msgs[i].buf,
> - msgs[i].len);
> - else
> - ret = cci_i2c_write(cci, cci_master->master,
> - msgs[i].addr, msgs[i].buf,
> - msgs[i].len);
> + ret = cci_xfer_msg(cci, cci_master->master, &msgs[i]);
> + /*
> + * A master can stall on the first transfer after a target was
> + * powered down while CCI stayed clocked. cci_run_queue() has
> + * already reset the controller on -ETIMEDOUT, so retry once.
> + */
> + if (ret == -ETIMEDOUT && i == 0)
> + ret = cci_xfer_msg(cci, cci_master->master, &msgs[i]);

I think this check depends at what point of a write the device
stalls: what if the target has already accepted the write, but
the driver times out waiting for REPORT? Wouldn’t the retry send
the same write twice?

Andi

>
> if (ret < 0)
> break;
>
> --
> 2.56.0
>