diff options
author | Sylvain Lemieux <slemieux@tycoint.com> | 2015-07-27 13:37:38 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2015-08-17 08:11:49 -0400 |
commit | 3d2b6a2e5f57f752c2541116beb89bf6db41a841 (patch) | |
tree | 16d586d424889d4f8375c407203c65ac7e0218cf | |
parent | b395a996a65572a5e64d648ac4dc4d43a53ea38b (diff) | |
download | u-boot-imx-3d2b6a2e5f57f752c2541116beb89bf6db41a841.zip u-boot-imx-3d2b6a2e5f57f752c2541116beb89bf6db41a841.tar.gz u-boot-imx-3d2b6a2e5f57f752c2541116beb89bf6db41a841.tar.bz2 |
i2c: lpc32xx: fix read timeout
Fix a condition that generate watchdog timeout inside "lpc32xx_i2c_read" when parameters alen != 0 and len = 0.
Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
-rw-r--r-- | drivers/i2c/lpc32xx_i2c.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/i2c/lpc32xx_i2c.c b/drivers/i2c/lpc32xx_i2c.c index 98106fa..4c66769 100644 --- a/drivers/i2c/lpc32xx_i2c.c +++ b/drivers/i2c/lpc32xx_i2c.c @@ -172,12 +172,12 @@ static int lpc32xx_i2c_read(struct i2c_adapter *adap, u8 dev, uint addr, *(data++) = readl(&i2c->rx); } } + /* wait for end of transation */ + while (!((stat = readl(&i2c->stat)) & LPC32XX_I2C_STAT_TDI)) + ; + /* clear end-of-transaction flag */ + writel(1, &i2c->stat); } - /* wait for end of transation */ - while (!((stat = readl(&i2c->stat)) & LPC32XX_I2C_STAT_TDI)) - ; - /* clear end-of-transaction flag */ - writel(1, &i2c->stat); /* success */ return 0; } |