[U-Boot] [PATCH] i2c: fix SDA contention in read_byte()

Thomas Chou thomas at wytron.com.tw
Tue Jul 6 08:14:26 CEST 2010


We should not set SDA after TRISTATE, as it results in contention.

Signed-off-by: Thomas Chou <thomas at wytron.com.tw>
---
 drivers/i2c/soft_i2c.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/soft_i2c.c b/drivers/i2c/soft_i2c.c
index 847db76..344b7f8 100644
--- a/drivers/i2c/soft_i2c.c
+++ b/drivers/i2c/soft_i2c.c
@@ -305,8 +305,8 @@ static uchar read_byte(int ack)
 	/*
 	 * Read 8 bits, MSB first.
 	 */
-	I2C_TRISTATE;
 	I2C_SDA(1);
+	I2C_TRISTATE;
 	data = 0;
 	for(j = 0; j < 8; j++) {
 		I2C_SCL(0);
-- 
1.7.1



More information about the U-Boot mailing list