]> git.sur5r.net Git - u-boot/commitdiff
i2c: rcar_i2c: Fix order of restart and clear status
authorNobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Tue, 4 Nov 2014 04:28:50 +0000 (13:28 +0900)
committerHeiko Schocher <hs@denx.de>
Mon, 10 Nov 2014 05:47:37 +0000 (06:47 +0100)
In case of repeated START condition, the restart has to be kicked
before clear status (MSR register). If it is kicked after clear status,
R-Car I2C may transfer data (TXD register) or receive data (RXD register)
instead of transferring slave address (MAR register).

Signed-off-by: Ryo Kataoka <ryo.kataoka.wt@renesas.com>
Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
drivers/i2c/rcar_i2c.c

index 50cebd622b74702ecd4af14821f302f3d391ef84..90ad116a982e7c10618280b33b47a8057eab9445 100644 (file)
@@ -119,10 +119,10 @@ rcar_i2c_raw_read(struct rcar_i2c *dev, u8 chip, uint addr)
 
        /* set slave address, receive */
        writel((chip << 1) | 1, &dev->icmar);
-       /* clear status */
-       writel(0, &dev->icmsr);
        /* start master receive */
        writel(MCR_MDBS | MCR_MIE | MCR_ESG, &dev->icmcr);
+       /* clear status */
+       writel(0, &dev->icmsr);
 
        while ((readl(&dev->icmsr) & (MSR_MAT | MSR_MDR))
                != (MSR_MAT | MSR_MDR))