Commit 87aec499 authored by Corey Minyard's avatar Corey Minyard Committed by Wolfram Sang
Browse files

i2c: imx: when being a target, mark the last read as processed



When being a target, NAK from the controller means that all bytes have
been transferred. So, the last byte needs also to be marked as
'processed'. Otherwise index registers of backends may not increase.

Fixes: f7414cd6 ("i2c: imx: support slave mode for imx I2C driver")
Signed-off-by: default avatarCorey Minyard <minyard@acm.org>
Tested-by: default avatarAndrew Manley <andrew.manley@sealingtech.com>
Reviewed-by: default avatarAndrew Manley <andrew.manley@sealingtech.com>
Reviewed-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
[wsa: fixed comment and commit message to properly describe the case]
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: default avatarAndi Shyti <andi.shyti@kernel.org>
parent b401b621
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -803,6 +803,11 @@ 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);

		/* flag the last byte as processed */
		i2c_imx_slave_event(i2c_imx,
				    I2C_SLAVE_READ_PROCESSED, &value);

		i2c_imx_slave_finish_op(i2c_imx);
		return IRQ_HANDLED;
	}