[U-Boot] [PATCH] i2c: rcar_iic: Scale delays

Marek Vasut marek.vasut at gmail.com
Wed Sep 19 12:42:48 UTC 2018


The delays in this driver used to depend on an incorrect timer frequency.
This was corrected in 7984ac8d1635, which caused this driver to function
incorrectly. Scale the delays accordingly to repair the malfunction.

Signed-off-by: Marek Vasut <marek.vasut+renesas at gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu at nigauri.org>
---
 drivers/i2c/rcar_iic.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/rcar_iic.c b/drivers/i2c/rcar_iic.c
index e91fc86c1a..86a74430ec 100644
--- a/drivers/i2c/rcar_iic.c
+++ b/drivers/i2c/rcar_iic.c
@@ -51,7 +51,7 @@ static void sh_irq_dte(struct udevice *dev)
 	for (i = 0; i < IRQ_WAIT; i++) {
 		if (RCAR_IC_DTE & readb(priv->base + RCAR_IIC_ICSR))
 			break;
-		udelay(10);
+		udelay(3);
 	}
 }
 
@@ -65,7 +65,7 @@ static int sh_irq_dte_with_tack(struct udevice *dev)
 			break;
 		if (RCAR_IC_TACK & readb(priv->base + RCAR_IIC_ICSR))
 			return -ETIMEDOUT;
-		udelay(10);
+		udelay(3);
 	}
 	return 0;
 }
@@ -78,7 +78,7 @@ static void sh_irq_busy(struct udevice *dev)
 	for (i = 0; i < IRQ_WAIT; i++) {
 		if (!(RCAR_IC_BUSY & readb(priv->base + RCAR_IIC_ICSR)))
 			break;
-		udelay(10);
+		udelay(3);
 	}
 }
 
@@ -118,7 +118,7 @@ static int rcar_iic_read_common(struct udevice *dev, struct i2c_msg *msg)
 	if (rcar_iic_set_addr(dev, msg->addr, 1) != 0)
 		goto err;
 
-	udelay(10);
+	udelay(3);
 
 	writeb(RCAR_IIC_ICCR_ICE | RCAR_IIC_ICCR_SCP,
 	       priv->base + RCAR_IIC_ICCR);
@@ -151,7 +151,7 @@ static int rcar_iic_write_common(struct udevice *dev, struct i2c_msg *msg)
 	if (rcar_iic_set_addr(dev, msg->addr, 0) != 0)
 		goto err;
 
-	udelay(10);
+	udelay(3);
 
 	for (i = 0; i < msg->len; i++) {
 		writeb(msg->buf[i], priv->base + RCAR_IIC_ICDR);
-- 
2.18.0



More information about the U-Boot mailing list