Subject: Re: I2C transactions & STOP condition
To: Nicolas Joly <njoly@pasteur.fr>
From: Tobias Nygren <tnn@NetBSD.org>
List: tech-kern
Date: 07/22/2007 23:57:04
On Sun, 22 Jul 2007 23:31:39 +0200
Nicolas Joly <njoly@pasteur.fr> wrote:

>
> Hi,
>
> I recently had a look on i2c devices code, and notices that some devices
transactions does not ends with a STOP conditions.
>
> By example, the adt7463 code should use I2C_OP_{READ,WRITE}_WITH_STOP
instead of I2C_OP_{READ,WRITE} for adt7463c_receive_1(),
> adt7463c_send_1() and adt7463c_write_1() functions.
> If i understand the i2c specifications correctly, all transferts begin
with a START condition, and terminates with a STOP condition; in
between, the i2c bus remains busy.

It is technically allowed to perform multiple consecutive transfers
without sending a STOP condition, using a technique called "repeated
start". This works fine as long as there is only one bus master present.

>
> Do the attached patch looks correct ?

IMO, yes. The code calls iic_release_bus(), and before this the stop
condition needs to be sent. (b/c none of our i2c controller drivers seem
to automatically send a stop on release.)

Kind regards,
-Tobias