From: Corey Minyard <minyard@xxxxxxx> The I2C slave interface expects that the driver will read ahead one byte. The IMX driver/device doesn't do this, but simulate it so that read operations get their index set correctly. Signed-off-by: Corey Minyard <minyard@xxxxxxx> Tested-by: Andrew Manley <andrew.manley@xxxxxxxxxxxxxxx> Reviewed-by: Andrew Manley <andrew.manley@xxxxxxxxxxxxxxx> Reviewed-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx> --- drivers/i2c/busses/i2c-imx.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index 27f969b3dc07..41355fc8bff4 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c @@ -771,6 +771,15 @@ static irqreturn_t i2c_imx_slave_handle(struct imx_i2c_struct *i2c_imx, ctl &= ~I2CR_MTX; imx_i2c_write_reg(ctl, i2c_imx, IMX_I2C_I2CR); imx_i2c_read_reg(i2c_imx, IMX_I2C_I2DR); + + /* + * The i2c slave interface requires one extra dummy + * read at the end to keep things in line. See the + * I2C slave docs for details. + */ + i2c_imx_slave_event(i2c_imx, + I2C_SLAVE_READ_PROCESSED, &value); + i2c_imx_slave_finish_op(i2c_imx); return IRQ_HANDLED; } -- 2.25.1