Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 333381
b: refs/heads/master
c: 4151e74
h: refs/heads/master
i:
  333379: 7c21d33
v: v3
  • Loading branch information
Felipe Balbi authored and Wolfram Sang committed Sep 12, 2012
1 parent 98950b2 commit b5a8a10
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6d9939f651419a63e091105663821f9c7d3fec37
refs/heads/master: 4151e74177b68c40079d8fe98f2fda4b9792a998
43 changes: 30 additions & 13 deletions trunk/drivers/i2c/busses/i2c-omap.c
Original file line number Diff line number Diff line change
Expand Up @@ -725,27 +725,30 @@ omap_i2c_omap1_isr(int this_irq, void *dev_id)
* data to DATA_REG. Otherwise some data bytes can be lost while transferring
* them from the memory to the I2C interface.
*/
static int errata_omap3_i462(struct omap_i2c_dev *dev, u16 *stat, int *err)
static int errata_omap3_i462(struct omap_i2c_dev *dev)
{
unsigned long timeout = 10000;
u16 stat;

while (--timeout && !(*stat & OMAP_I2C_STAT_XUDF)) {
if (*stat & (OMAP_I2C_STAT_NACK | OMAP_I2C_STAT_AL)) {
do {
stat = omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG);
if (stat & OMAP_I2C_STAT_XUDF)
break;

if (stat & (OMAP_I2C_STAT_NACK | OMAP_I2C_STAT_AL)) {
omap_i2c_ack_stat(dev, (OMAP_I2C_STAT_XRDY |
OMAP_I2C_STAT_XDR));
return -ETIMEDOUT;
return -EIO;
}

cpu_relax();
*stat = omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG);
}
} while (--timeout);

if (!timeout) {
dev_err(dev->dev, "timeout waiting on XUDF bit\n");
return 0;
}

*err |= OMAP_I2C_STAT_XUDF;
return 0;
}

Expand Down Expand Up @@ -903,9 +906,16 @@ omap_i2c_isr(int this_irq, void *dev_id)
}
}

if ((dev->errata & I2C_OMAP_ERRATA_I462) &&
errata_omap3_i462(dev, &stat, &err))
goto complete;
if (dev->errata & I2C_OMAP_ERRATA_I462) {
int ret;

ret = errata_omap3_i462(dev);
stat = omap_i2c_read_reg(dev,
OMAP_I2C_STAT_REG);

if (ret < 0)
goto complete;
}

omap_i2c_write_reg(dev, OMAP_I2C_DATA_REG, w);
}
Expand Down Expand Up @@ -943,9 +953,16 @@ omap_i2c_isr(int this_irq, void *dev_id)
}
}

if ((dev->errata & I2C_OMAP_ERRATA_I462) &&
errata_omap3_i462(dev, &stat, &err))
goto complete;
if (dev->errata & I2C_OMAP_ERRATA_I462) {
int ret;

ret = errata_omap3_i462(dev);
stat = omap_i2c_read_reg(dev,
OMAP_I2C_STAT_REG);

if (ret < 0)
goto complete;
}

omap_i2c_write_reg(dev, OMAP_I2C_DATA_REG, w);
}
Expand Down

0 comments on commit b5a8a10

Please sign in to comment.