]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
i2c: rcar_i2c: Setup SCL/SDA delay at rcar_i2c_set_speed
authorIsmael Luceno Cortes <ismael.luceno@silicon-gears.com>
Thu, 7 Mar 2019 18:00:49 +0000 (18:00 +0000)
committerHeiko Schocher <hs@denx.de>
Fri, 8 Mar 2019 04:53:03 +0000 (05:53 +0100)
Setting up the delay only needs to be done once; move it to
rcar_i2c_set_speed so it's done at initialization time.

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 10b0f8bad470eaa9d79779387fe00d7e04f1ca54..a57f72a228f1b77d600d71aeb55d2a27ad2b3986 100644 (file)
@@ -116,9 +116,7 @@ static int rcar_i2c_set_addr(struct udevice *dev, u8 chip, u8 read)
        writel(0, priv->base + RCAR_I2C_ICMSR);
        writel(priv->icccr, priv->base + RCAR_I2C_ICCCR);
 
-       if (priv->type == RCAR_I2C_TYPE_GEN3)
-               writel(RCAR_I2C_ICFBSCR_TCYC17, priv->base + RCAR_I2C_ICFBSCR);
-
+       /* Wait for the bus */
        ret = wait_for_bit_le32(priv->base + RCAR_I2C_ICMCR,
                                RCAR_I2C_ICMCR_FSDA, false, 2, true);
        if (ret) {
@@ -304,6 +302,11 @@ scgd_find:
        priv->icccr = (scgd << RCAR_I2C_ICCCR_SCGD_OFF) | cdf;
        writel(priv->icccr, priv->base + RCAR_I2C_ICCCR);
 
+       if (priv->type == RCAR_I2C_TYPE_GEN3) {
+               /* Set SCL/SDA delay */
+               writel(RCAR_I2C_ICFBSCR_TCYC17, priv->base + RCAR_I2C_ICFBSCR);
+       }
+
        return 0;
 }