]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
i2c: rcar_i2c: Fix sending of slave addresses
authorIsmael Luceno Cortes <ismael.luceno@silicon-gears.com>
Thu, 7 Mar 2019 18:00:52 +0000 (18:00 +0000)
committerHeiko Schocher <hs@denx.de>
Fri, 8 Mar 2019 04:53:17 +0000 (05:53 +0100)
Do the reset before clearing the MSR, otherwise it may result in a read
or write operation instead if the start condition is repeated.

Signed-off-by: Ismael Luceno <ismael.luceno@silicon-gears.com>
Reviewed-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
drivers/i2c/rcar_i2c.c

index d7b27204cb2d9e03bd32811d3c472fc635e6f3d7..a88fbcf34f394508345e0c69d9931131acffd829 100644 (file)
@@ -134,9 +134,11 @@ static int rcar_i2c_set_addr(struct udevice *dev, u8 chip, u8 read)
        }
 
        writel((chip << 1) | read, priv->base + RCAR_I2C_ICMAR);
-       writel(0, priv->base + RCAR_I2C_ICMSR);
+       /* Reset */
        writel(RCAR_I2C_ICMCR_MDBS | RCAR_I2C_ICMCR_MIE | RCAR_I2C_ICMCR_ESG,
               priv->base + RCAR_I2C_ICMCR);
+       /* Clear Status */
+       writel(0, priv->base + RCAR_I2C_ICMSR);
 
        ret = wait_for_bit_le32(priv->base + RCAR_I2C_ICMSR, mask,
                                true, 100, true);