lkml.org 
[lkml]   [2021]   [Nov]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/3] i2c:imx: Add an extra read at the end of an I2C slave read
On Mon, Oct 04, 2021 at 07:32:15PM -0500, minyard@acm.org wrote:
> From: Corey Minyard <cminyard@mvista.com>
>
> 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@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>

> ---
> 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 97369fe48b30..26a04dc0590b 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -769,6 +769,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
>
>

--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |

\
 
 \ /
  Last update: 2021-11-10 09:59    [W:0.067 / U:1.516 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site