linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleksij Rempel <o.rempel@pengutronix.de>
To: minyard@acm.org
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>,
	linux-i2c@vger.kernel.org,
	Andrew Manley <andrew.manley@sealingtech.com>,
	linux-kernel@vger.kernel.org, Corey Minyard <cminyard@mvista.com>
Subject: Re: [PATCH 2/3] i2c:imx: Add an extra read at the end of an I2C slave read
Date: Wed, 10 Nov 2021 09:58:57 +0100	[thread overview]
Message-ID: <20211110085856.GD12195@pengutronix.de> (raw)
In-Reply-To: <20211005003216.2670632-3-minyard@acm.org>

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 |

  reply	other threads:[~2021-11-10  8:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-05  0:32 [PATCH 0/3] i2c:imx: Deliver a timely stop on slave side, fix recv minyard
2021-10-05  0:32 ` [PATCH 1/3] i2c:imx: Add timer for handling the stop condition minyard
2021-11-01 17:27   ` Corey Minyard
2021-11-10  8:58   ` Oleksij Rempel
2021-10-05  0:32 ` [PATCH 2/3] i2c:imx: Add an extra read at the end of an I2C slave read minyard
2021-11-10  8:58   ` Oleksij Rempel [this message]
2021-10-05  0:32 ` [PATCH 3/3] i2c:imx: Use an hrtimer, not a timer, for checking for bus idle minyard
2021-11-02  8:58   ` Uwe Kleine-König
2021-11-02 11:50     ` Corey Minyard
2021-11-10  9:03   ` Oleksij Rempel
2021-11-10 14:45     ` Corey Minyard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211110085856.GD12195@pengutronix.de \
    --to=o.rempel@pengutronix.de \
    --cc=andrew.manley@sealingtech.com \
    --cc=cminyard@mvista.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minyard@acm.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).