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
This commit is contained in:
@@ -146,10 +146,10 @@ static int i2c_imx_bus_busy(struct imx_i2c_struct *i2c_imx, int for_busy)
|
|||||||
"<%s> I2C Interrupted\n", __func__);
|
"<%s> I2C Interrupted\n", __func__);
|
||||||
return -EINTR;
|
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,
|
dev_dbg(&i2c_imx->adapter.dev,
|
||||||
"<%s> I2C bus is busy\n", __func__);
|
"<%s> I2C bus is busy\n", __func__);
|
||||||
return -EIO;
|
return -ETIMEDOUT;
|
||||||
}
|
}
|
||||||
schedule();
|
schedule();
|
||||||
}
|
}
|
||||||
@@ -444,6 +444,8 @@ static int i2c_imx_xfer(struct i2c_adapter *adapter,
|
|||||||
result = i2c_imx_read(i2c_imx, &msgs[i]);
|
result = i2c_imx_read(i2c_imx, &msgs[i]);
|
||||||
else
|
else
|
||||||
result = i2c_imx_write(i2c_imx, &msgs[i]);
|
result = i2c_imx_write(i2c_imx, &msgs[i]);
|
||||||
|
if (result)
|
||||||
|
goto fail0;
|
||||||
}
|
}
|
||||||
|
|
||||||
fail0:
|
fail0:
|
||||||
|
@@ -903,6 +903,11 @@ omap_i2c_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
platform_set_drvdata(pdev, dev);
|
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)
|
if ((r = omap_i2c_get_clocks(dev)) != 0)
|
||||||
goto err_iounmap;
|
goto err_iounmap;
|
||||||
|
|
||||||
@@ -926,11 +931,6 @@ omap_i2c_probe(struct platform_device *pdev)
|
|||||||
dev->b_hw = 1; /* Enable hardware fixes */
|
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 */
|
/* reset ASAP, clearing any IRQs */
|
||||||
omap_i2c_init(dev);
|
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... */
|
/* We still have something to talk about... */
|
||||||
val = *alg_data->mif.buf++;
|
val = *alg_data->mif.buf++;
|
||||||
|
|
||||||
|
if (alg_data->mif.len == 1)
|
||||||
|
val |= stop_bit;
|
||||||
|
|
||||||
alg_data->mif.len--;
|
alg_data->mif.len--;
|
||||||
iowrite32(val, I2C_REG_TX(alg_data));
|
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__);
|
__func__);
|
||||||
|
|
||||||
if (alg_data->mif.len == 1) {
|
if (alg_data->mif.len == 1) {
|
||||||
|
/* Last byte, do not acknowledge next rcv. */
|
||||||
|
val |= stop_bit;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enable interrupt RFDAIE (data in Rx fifo),
|
* Enable interrupt RFDAIE (data in Rx fifo),
|
||||||
* and disable DRMIE (need data for Tx)
|
* 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;
|
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_CKH(alg_data));
|
||||||
iowrite32(tmp, I2C_REG_CKL(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;
|
int i = 0;
|
||||||
|
|
||||||
/* Locate the apropriate clock setting */
|
/* Locate the apropriate clock setting */
|
||||||
while (i < ARRAY_SIZE(stu300_clktable) &&
|
while (i < ARRAY_SIZE(stu300_clktable) - 1 &&
|
||||||
stu300_clktable[i].rate < clkrate)
|
stu300_clktable[i].rate < clkrate)
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user