]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
soft_i2c: Pull SDA high before reading
authorHaavard Skinnemoen <haavard.skinnemoen@atmel.com>
Fri, 16 May 2008 09:08:11 +0000 (11:08 +0200)
committerWolfgang Denk <wd@denx.de>
Tue, 3 Jun 2008 18:25:56 +0000 (20:25 +0200)
Spotted by Dean Capindale.

Systems that support open-drain GPIO properly are allowed provide an
empty I2C_TRISTATE define. However, this means that we need to be
careful not to drive SDA low when the slave is expected to respond.

This patch adds a missing I2C_SDA(1) to read_byte() required to
tristate the SDA line on systems that support open-drain GPIO.

Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
common/soft_i2c.c

index c5d7e205e5442d87cec9530b212bf873e7fc9bf3..5ef7f303b8435d52a5ccb8151d316b8e79141ada 100644 (file)
@@ -252,6 +252,7 @@ static uchar read_byte(int ack)
         * Read 8 bits, MSB first.
         */
        I2C_TRISTATE;
+       I2C_SDA(1);
        data = 0;
        for(j = 0; j < 8; j++) {
                I2C_SCL(0);