summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTroy Kisky <troy.kisky@boundarydevices.com>2012-07-19 08:18:14 +0000
committerHeiko Schocher <hs@denx.de>2012-07-31 07:52:53 +0200
commitca741da106de2b3d1432a333b3da0af6849c4e9a (patch)
tree66bc9df033b1a6b11a6000743db82991d3e91e01
parent90a5b70f5914a3ac79cac3dd386cc98ce42bfd8e (diff)
downloadu-boot-imx-ca741da106de2b3d1432a333b3da0af6849c4e9a.zip
u-boot-imx-ca741da106de2b3d1432a333b3da0af6849c4e9a.tar.gz
u-boot-imx-ca741da106de2b3d1432a333b3da0af6849c4e9a.tar.bz2
mxc_i2c: change slave addr if conflicts with destination.
The i2c controller cannot be both master and slave in the same transaction. Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
-rw-r--r--drivers/i2c/mxc_i2c.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c
index 1a5e379..ba2aad3 100644
--- a/drivers/i2c/mxc_i2c.c
+++ b/drivers/i2c/mxc_i2c.c
@@ -223,6 +223,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)