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

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@gmail.com Cc: Nobuhiro Iwamatsu iwamatsu@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);

On 09/19/2018 02:42 PM, Marek Vasut wrote:
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@gmail.com Cc: Nobuhiro Iwamatsu iwamatsu@nigauri.org
This is wrong, ignore.

Hello Marek,
Am 19.09.2018 um 16:31 schrieb Marek Vasut:
On 09/19/2018 02:42 PM, Marek Vasut wrote:
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@gmail.com Cc: Nobuhiro Iwamatsu iwamatsu@nigauri.org
This is wrong, ignore.
What is wrong ? This patch?
May a define for the delay value is better here ...
Hmm, thinking about it .. is this driver really only working with correct delays ?
bye, Heiko

On 09/19/2018 04:52 PM, Heiko Schocher wrote:
Hello Marek,
Am 19.09.2018 um 16:31 schrieb Marek Vasut:
On 09/19/2018 02:42 PM, Marek Vasut wrote:
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@gmail.com Cc: Nobuhiro Iwamatsu iwamatsu@nigauri.org
This is wrong, ignore.
What is wrong ? This patch?
May a define for the delay value is better here ...
Hmm, thinking about it .. is this driver really only working with correct delays ?
The delays are correct and this driver is correct too, the timer was misconfigured, it's fixed by a different patch.
participants (2)
-
Heiko Schocher
-
Marek Vasut