Commit 2ac6985a authored by Andrew Dyer's avatar Andrew Dyer Committed by Wolfgang Denk
Browse files

soft_i2c.c add option for repeated start in i2c_read()

This patch adds a #define to optionally change the behaviour of
i2c_read() in soft_i2c.c to send an I2C repeated start instead of a
stop-start between sending the device address pointer write and
reading back the data.  The current behaviour is retained as the

While most devices will work either way, I have a smart battery(*)
that requires repeated start, and someone at some point found a
device that required a stop-start.


Signed-off-by: default avatarAndrew Dyer <>
parent 34290717
......@@ -1509,6 +1509,15 @@ The following options need to be configured:
Bus on the MPC8260. But it should be not so difficult
to add this option to other architectures.
defining this will force the i2c_read() function in
the soft_i2c driver to perform an I2C repeated start
between writing the address pointer and reading the
data. If this define is omitted the default behaviour
of doing a stop-start sequence will be used. Most I2C
devices can use either method, but some require one or
the other.
......@@ -385,8 +385,18 @@ int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len)
shift -= 8;
send_stop(); /* reportedly some chips need a full stop */
/* Some I2C chips need a stop/start sequence here,
* other chips don't work with a full stop and need
* only a start. Default behaviour is to send the
* stop/start sequence.
* Send the chip address again, this time for a read cycle.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment