aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorey Minyard <[email protected]>2024-02-21 20:27:13 +0100
committerWolfram Sang <[email protected]>2024-02-23 23:39:35 +0100
commit87aec499368d488c20292952d6d4be7cb9e49c5e (patch)
tree3dc77dcf288cf045c40d6ade6b8116223b409541
parentb401b621758e46812da61fa58a67c3fd8d91de0d (diff)
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: f7414cd6923f ("i2c: imx: support slave mode for imx I2C driver") Signed-off-by: Corey Minyard <[email protected]> Tested-by: Andrew Manley <[email protected]> Reviewed-by: Andrew Manley <[email protected]> Reviewed-by: Oleksij Rempel <[email protected]> [wsa: fixed comment and commit message to properly describe the case] Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Andi Shyti <[email protected]>
-rw-r--r--drivers/i2c/busses/i2c-imx.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index 88a053987403..60e813137f84 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -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;
}