| Message ID | 20260218150940.131354-2-eichest@gmail.com |
|---|---|
| State | Accepted |
| Delegated to: | Andi Shyti |
| Headers | show |
| Series | i2c: imx: fix i2c issues when reading messages | expand |
On Wed, Feb 18, 2026 at 04:08:49PM +0100, Stefan Eichenberger wrote: > From: Stefan Eichenberger <stefan.eichenberger@toradex.com> > > When reading multiple messages, meaning a repeated start is required, > polling the bus busy bit must be avoided. This must only be done for > the last message. Otherwise, the driver will timeout. > > Here an example of such a sequence that fails with an error: > i2ctransfer -y -a 0 w1@0x00 0x02 r1 w1@0x00 0x02 r1 > Error: Sending messages failed: Connection timed out > > Fixes: 5f5c2d4579ca ("i2c: imx: prevent rescheduling in non dma mode") > Cc: <stable@vger.kernel.org> # v6.13+ > Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com> > --- Reviewed-by: Frank Li <Frank.Li@nxp.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 85f554044cf1e..56e2a14495a9a 100644 > --- a/drivers/i2c/busses/i2c-imx.c > +++ b/drivers/i2c/busses/i2c-imx.c > @@ -1522,7 +1522,7 @@ static int i2c_imx_read(struct imx_i2c_struct *i2c_imx, struct i2c_msg *msgs, > dev_err(&i2c_imx->adapter.dev, "<%s> read timedout\n", __func__); > return -ETIMEDOUT; > } > - if (!i2c_imx->stopped) > + if (i2c_imx->is_lastmsg && !i2c_imx->stopped) > return i2c_imx_bus_busy(i2c_imx, 0, false); > > return 0; > -- > 2.51.0 >
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index 85f554044cf1e..56e2a14495a9a 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c @@ -1522,7 +1522,7 @@ static int i2c_imx_read(struct imx_i2c_struct *i2c_imx, struct i2c_msg *msgs, dev_err(&i2c_imx->adapter.dev, "<%s> read timedout\n", __func__); return -ETIMEDOUT; } - if (!i2c_imx->stopped) + if (i2c_imx->is_lastmsg && !i2c_imx->stopped) return i2c_imx_bus_busy(i2c_imx, 0, false); return 0;