]> git.sur5r.net Git - u-boot/commitdiff
mxc_i2c: change slave addr if conflicts with destination.
authorTroy Kisky <troy.kisky@boundarydevices.com>
Thu, 19 Jul 2012 08:18:14 +0000 (08:18 +0000)
committerHeiko Schocher <hs@denx.de>
Tue, 31 Jul 2012 05:52:53 +0000 (07:52 +0200)
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

index 1a5e379c2f14313a554cc5e06b4f97f042b2950c..ba2aad3d0dc52f0250ae01cdc8ebeeaf82b16e58 100644 (file)
@@ -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)