[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20211123124413.GS15676@minyard.net>
Date: Tue, 23 Nov 2021 06:44:13 -0600
From: Corey Minyard <minyard@....org>
To: Wolfram Sang <wsa@...nel.org>,
Oleksij Rempel <o.rempel@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org,
Andrew Manley <andrew.manley@...lingtech.com>
Subject: Re: [PATCH v2 2/2] i2c:imx: Add an extra read at the end of an I2C
slave read
On Tue, Nov 23, 2021 at 11:28:41AM +0100, Wolfram Sang wrote:
> On Fri, Nov 12, 2021 at 07:39:56AM -0600, minyard@....org wrote:
> > From: Corey Minyard <minyard@....org>
> >
> > 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.
>
> From what I understand, the patch is correct but the description may be
> wrong?
>
> AFAIU the patch adds the slave event I2C_SLAVE_READ_PROCESSED to the
> case when the last byte was transferred. We as the client got a NAK from
> the controller. However, the byte WAS processed, so the event is ok and
> not a dummy?
>
I think the description is correct. Devices that are read from (which
is just eeprom at the moment) expect that there is a dummy read at the
end of a read transaction. Apparently this is what at least some slave
hardware does. The I2C device being read doesn't know when the master
device will finish the operation. So to be ready for the next read it
always reads ahead one. When the read is terminated by the master,
there is an extra byte left lying around that is discarded.
The IMX driver doesn't work this way. So when I was testing, I noticed
that if I did two reads in a row it was one byte off on the second read.
-corey
Powered by blists - more mailing lists