Re: [U-Boot] [PATCH] i2c: rcar_iic: Read ICSR only once

2019-03-06 Thread Heiko Schocher

Hello Marek,

Am 07.03.2019 um 03:41 schrieb Marek Vasut:

Read ICSR only once to avoid missing interrupts. This happens on R8A7791
Porter during reset, when reading the PMIC register 0x13, which may fail
sometimes because of the missed DTE interrupt.

Signed-off-by: Marek Vasut 
Cc: Heiko Schocher 
Cc: Nobuhiro Iwamatsu 
---
  drivers/i2c/rcar_iic.c | 6 --
  1 file changed, 4 insertions(+), 2 deletions(-)


Reviewed-by: Heiko Schocher 

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: h...@denx.de
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] i2c: rcar_iic: Read ICSR only once

2019-03-06 Thread Marek Vasut
Read ICSR only once to avoid missing interrupts. This happens on R8A7791
Porter during reset, when reading the PMIC register 0x13, which may fail
sometimes because of the missed DTE interrupt.

Signed-off-by: Marek Vasut 
Cc: Heiko Schocher 
Cc: Nobuhiro Iwamatsu 
---
 drivers/i2c/rcar_iic.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/rcar_iic.c b/drivers/i2c/rcar_iic.c
index e91fc86c1a..9d45f547d1 100644
--- a/drivers/i2c/rcar_iic.c
+++ b/drivers/i2c/rcar_iic.c
@@ -58,12 +58,14 @@ static void sh_irq_dte(struct udevice *dev)
 static int sh_irq_dte_with_tack(struct udevice *dev)
 {
struct rcar_iic_priv *priv = dev_get_priv(dev);
+   u8 icsr;
int i;
 
for (i = 0; i < IRQ_WAIT; i++) {
-   if (RCAR_IC_DTE & readb(priv->base + RCAR_IIC_ICSR))
+   icsr = readb(priv->base + RCAR_IIC_ICSR);
+   if (RCAR_IC_DTE & icsr)
break;
-   if (RCAR_IC_TACK & readb(priv->base + RCAR_IIC_ICSR))
+   if (RCAR_IC_TACK & icsr)
return -ETIMEDOUT;
udelay(10);
}
-- 
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot