提交 b7b6cf00 编写于 作者: L Linus Torvalds

Merge branch 'for-linus/i2c' of git://git.fluff.org/bjdooks/linux

* '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
......@@ -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();
}
......@@ -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:
......
......@@ -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;
......@@ -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);
......
......@@ -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));
......@@ -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)
......@@ -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));
......
......@@ -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++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册