Skip to content

Commit

Permalink
Merge branch 'for-linus/i2c' of git://git.fluff.org/bjdooks/linux
Browse files Browse the repository at this point in the history
* 'for-linus/i2c' of git://git.fluff.org/bjdooks/linux:
  i2c-stu300: off by one issue
  i2c-pnx: Add stop conditions for end of transfer
  i2c-pnx: Limit maximum divider to 1023
  i2c-omap: fix OOPS in omap_i2c_unidle() during probe
  i2c-imx: fix error handling
  • Loading branch information
Linus Torvalds committed Apr 22, 2010
2 parents 74a9201 + 42df64b commit b7b6cf0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
6 changes: 4 additions & 2 deletions drivers/i2c/busses/i2c-imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ static int i2c_imx_bus_busy(struct imx_i2c_struct *i2c_imx, int for_busy)
"<%s> I2C Interrupted\n", __func__);
return -EINTR;
}
if (time_after(jiffies, orig_jiffies + HZ / 1000)) {
if (time_after(jiffies, orig_jiffies + msecs_to_jiffies(500))) {
dev_dbg(&i2c_imx->adapter.dev,
"<%s> I2C bus is busy\n", __func__);
return -EIO;
return -ETIMEDOUT;
}
schedule();
}
Expand Down Expand Up @@ -444,6 +444,8 @@ static int i2c_imx_xfer(struct i2c_adapter *adapter,
result = i2c_imx_read(i2c_imx, &msgs[i]);
else
result = i2c_imx_write(i2c_imx, &msgs[i]);
if (result)
goto fail0;
}

fail0:
Expand Down
10 changes: 5 additions & 5 deletions drivers/i2c/busses/i2c-omap.c
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,11 @@ omap_i2c_probe(struct platform_device *pdev)

platform_set_drvdata(pdev, dev);

if (cpu_is_omap7xx())
dev->reg_shift = 1;
else
dev->reg_shift = 2;

if ((r = omap_i2c_get_clocks(dev)) != 0)
goto err_iounmap;

Expand All @@ -926,11 +931,6 @@ omap_i2c_probe(struct platform_device *pdev)
dev->b_hw = 1; /* Enable hardware fixes */
}

if (cpu_is_omap7xx())
dev->reg_shift = 1;
else
dev->reg_shift = 2;

/* reset ASAP, clearing any IRQs */
omap_i2c_init(dev);

Expand Down
8 changes: 8 additions & 0 deletions drivers/i2c/busses/i2c-pnx.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ static int i2c_pnx_master_xmit(struct i2c_pnx_algo_data *alg_data)
/* We still have something to talk about... */
val = *alg_data->mif.buf++;

if (alg_data->mif.len == 1)
val |= stop_bit;

alg_data->mif.len--;
iowrite32(val, I2C_REG_TX(alg_data));

Expand Down Expand Up @@ -246,6 +249,9 @@ static int i2c_pnx_master_rcv(struct i2c_pnx_algo_data *alg_data)
__func__);

if (alg_data->mif.len == 1) {
/* Last byte, do not acknowledge next rcv. */
val |= stop_bit;

/*
* Enable interrupt RFDAIE (data in Rx fifo),
* and disable DRMIE (need data for Tx)
Expand Down Expand Up @@ -633,6 +639,8 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
*/

tmp = ((freq / 1000) / I2C_PNX_SPEED_KHZ) / 2 - 2;
if (tmp > 0x3FF)
tmp = 0x3FF;
iowrite32(tmp, I2C_REG_CKH(alg_data));
iowrite32(tmp, I2C_REG_CKL(alg_data));

Expand Down
2 changes: 1 addition & 1 deletion drivers/i2c/busses/i2c-stu300.c
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ static int stu300_set_clk(struct stu300_dev *dev, unsigned long clkrate)
int i = 0;

/* Locate the apropriate clock setting */
while (i < ARRAY_SIZE(stu300_clktable) &&
while (i < ARRAY_SIZE(stu300_clktable) - 1 &&
stu300_clktable[i].rate < clkrate)
i++;

Expand Down

0 comments on commit b7b6cf0

Please sign in to comment.