diff mbox

[U-Boot,12/24] mxc_i2c: change slave addr if conflicts with destination.

Message ID 1340338339-11626-12-git-send-email-troy.kisky@boundarydevices.com
State Accepted
Commit ca741da106de2b3d1432a333b3da0af6849c4e9a
Delegated to: Heiko Schocher
Headers show

Commit Message

Troy Kisky June 22, 2012, 4:12 a.m. UTC
The i2c controller cannot be both master and slave in the
same transaction.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
---
 drivers/i2c/mxc_i2c.c |    2 ++
 1 file changed, 2 insertions(+)
diff mbox

Patch

diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c
index e433312..2bff2b8 100644
--- a/drivers/i2c/mxc_i2c.c
+++ b/drivers/i2c/mxc_i2c.c
@@ -218,6 +218,8 @@  static int i2c_init_transfer(struct mxc_i2c_regs *i2c_regs,
 		/* Wait for controller to be stable */
 		udelay(50);
 	}
+	if (readb(&i2c_regs->iadr) == (chip << 1))
+		writeb((chip << 1) ^ 2, &i2c_regs->iadr);
 	writeb(0, &i2c_regs->i2sr);
 	ret = wait_for_sr_state(i2c_regs, ST_BUS_IDLE);
 	if (ret < 0)