All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] i2c: rcar_iic: Scale delays
@ 2018-09-19 12:42 Marek Vasut
  2018-09-19 14:31 ` Marek Vasut
  0 siblings, 1 reply; 4+ messages in thread
From: Marek Vasut @ 2018-09-19 12:42 UTC (permalink / raw)
  To: u-boot

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);
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] i2c: rcar_iic: Scale delays
  2018-09-19 12:42 [U-Boot] [PATCH] i2c: rcar_iic: Scale delays Marek Vasut
@ 2018-09-19 14:31 ` Marek Vasut
  2018-09-19 14:52   ` Heiko Schocher
  0 siblings, 1 reply; 4+ messages in thread
From: Marek Vasut @ 2018-09-19 14:31 UTC (permalink / raw)
  To: u-boot

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.

-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] i2c: rcar_iic: Scale delays
  2018-09-19 14:31 ` Marek Vasut
@ 2018-09-19 14:52   ` Heiko Schocher
  2018-09-19 15:46     ` Marek Vasut
  0 siblings, 1 reply; 4+ messages in thread
From: Heiko Schocher @ 2018-09-19 14:52 UTC (permalink / raw)
  To: u-boot

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
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] i2c: rcar_iic: Scale delays
  2018-09-19 14:52   ` Heiko Schocher
@ 2018-09-19 15:46     ` Marek Vasut
  0 siblings, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2018-09-19 15:46 UTC (permalink / raw)
  To: u-boot

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.

-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-09-19 15:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-19 12:42 [U-Boot] [PATCH] i2c: rcar_iic: Scale delays Marek Vasut
2018-09-19 14:31 ` Marek Vasut
2018-09-19 14:52   ` Heiko Schocher
2018-09-19 15:46     ` Marek Vasut

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.