aboutsummaryrefslogtreecommitdiff
path: root/drivers/i2c/rcar_iic.c
diff options
context:
space:
mode:
authorMarek Vasut2019-03-07 03:41:08 +0100
committerHeiko Schocher2019-03-07 06:20:09 +0100
commiteb54682e91a0a3f9ca8629d67c5195ae54cfb1e9 (patch)
tree84c821ee03d91cdc4c685074bc7ce0443dd0d4c8 /drivers/i2c/rcar_iic.c
parentf08023c07d826fbc8e62fdd3367961b2f0b06844 (diff)
i2c: rcar_iic: Read ICSR only once
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 <marek.vasut+renesas@gmail.com> Cc: Heiko Schocher <hs@denx.de> Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> Reviewed-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'drivers/i2c/rcar_iic.c')
-rw-r--r--drivers/i2c/rcar_iic.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/i2c/rcar_iic.c b/drivers/i2c/rcar_iic.c
index e91fc86c1ac..9d45f547d15 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);
}