Skip to content

Commit 95a5785

Browse files
cminyardroxanan1996
authored andcommitted
i2c: imx: when being a target, mark the last read as processed
BugLink: https://bugs.launchpad.net/bugs/2060142 [ Upstream commit 87aec49 ] 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: f7414cd ("i2c: imx: support slave mode for imx I2C driver") Signed-off-by: Corey Minyard <minyard@acm.org> Tested-by: Andrew Manley <andrew.manley@sealingtech.com> Reviewed-by: Andrew Manley <andrew.manley@sealingtech.com> Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de> [wsa: fixed comment and commit message to properly describe the case] Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Manuel Diewald <manuel.diewald@canonical.com> Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
1 parent 64d6914 commit 95a5785

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/i2c/busses/i2c-imx.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,11 @@ static irqreturn_t i2c_imx_slave_handle(struct imx_i2c_struct *i2c_imx,
771771
ctl &= ~I2CR_MTX;
772772
imx_i2c_write_reg(ctl, i2c_imx, IMX_I2C_I2CR);
773773
imx_i2c_read_reg(i2c_imx, IMX_I2C_I2DR);
774+
775+
/* flag the last byte as processed */
776+
i2c_imx_slave_event(i2c_imx,
777+
I2C_SLAVE_READ_PROCESSED, &value);
778+
774779
i2c_imx_slave_finish_op(i2c_imx);
775780
return IRQ_HANDLED;
776781
}

0 commit comments

Comments
 (0)