aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c/busses')
-rw-r--r--drivers/i2c/busses/i2c-imx.c6
-rw-r--r--drivers/i2c/busses/i2c-octeon.c4
-rw-r--r--drivers/i2c/busses/i2c-omap.c10
-rw-r--r--drivers/i2c/busses/i2c-pnx.c8
-rw-r--r--drivers/i2c/busses/i2c-stu300.c2
5 files changed, 20 insertions, 10 deletions
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index f7e27b702375..d1ff9408dc1f 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -146,10 +146,10 @@ static int i2c_imx_bus_busy(struct imx_i2c_struct *i2c_imx, int for_busy)
146 "<%s> I2C Interrupted\n", __func__); 146 "<%s> I2C Interrupted\n", __func__);
147 return -EINTR; 147 return -EINTR;
148 } 148 }
149 if (time_after(jiffies, orig_jiffies + HZ / 1000)) { 149 if (time_after(jiffies, orig_jiffies + msecs_to_jiffies(500))) {
150 dev_dbg(&i2c_imx->adapter.dev, 150 dev_dbg(&i2c_imx->adapter.dev,
151 "<%s> I2C bus is busy\n", __func__); 151 "<%s> I2C bus is busy\n", __func__);
152 return -EIO; 152 return -ETIMEDOUT;
153 } 153 }
154 schedule(); 154 schedule();
155 } 155 }
@@ -444,6 +444,8 @@ static int i2c_imx_xfer(struct i2c_adapter *adapter,
444 result = i2c_imx_read(i2c_imx, &msgs[i]); 444 result = i2c_imx_read(i2c_imx, &msgs[i]);
445 else 445 else
446 result = i2c_imx_write(i2c_imx, &msgs[i]); 446 result = i2c_imx_write(i2c_imx, &msgs[i]);
447 if (result)
448 goto fail0;
447 } 449 }
448 450
449fail0: 451fail0:
diff --git a/drivers/i2c/busses/i2c-octeon.c b/drivers/i2c/busses/i2c-octeon.c
index a2481f40ea1c..0e9f85d0a835 100644
--- a/drivers/i2c/busses/i2c-octeon.c
+++ b/drivers/i2c/busses/i2c-octeon.c
@@ -447,7 +447,7 @@ static struct i2c_adapter octeon_i2c_ops = {
447/** 447/**
448 * octeon_i2c_setclock - Calculate and set clock divisors. 448 * octeon_i2c_setclock - Calculate and set clock divisors.
449 */ 449 */
450static int __init octeon_i2c_setclock(struct octeon_i2c *i2c) 450static int __devinit octeon_i2c_setclock(struct octeon_i2c *i2c)
451{ 451{
452 int tclk, thp_base, inc, thp_idx, mdiv_idx, ndiv_idx, foscl, diff; 452 int tclk, thp_base, inc, thp_idx, mdiv_idx, ndiv_idx, foscl, diff;
453 int thp = 0x18, mdiv = 2, ndiv = 0, delta_hz = 1000000; 453 int thp = 0x18, mdiv = 2, ndiv = 0, delta_hz = 1000000;
@@ -490,7 +490,7 @@ static int __init octeon_i2c_setclock(struct octeon_i2c *i2c)
490 return 0; 490 return 0;
491} 491}
492 492
493static int __init octeon_i2c_initlowlevel(struct octeon_i2c *i2c) 493static int __devinit octeon_i2c_initlowlevel(struct octeon_i2c *i2c)
494{ 494{
495 u8 status; 495 u8 status;
496 int tries; 496 int tries;
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 6bd0f19cd451..389ac6032a7b 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -903,6 +903,11 @@ omap_i2c_probe(struct platform_device *pdev)
903 903
904 platform_set_drvdata(pdev, dev); 904 platform_set_drvdata(pdev, dev);
905 905
906 if (cpu_is_omap7xx())
907 dev->reg_shift = 1;
908 else
909 dev->reg_shift = 2;
910
906 if ((r = omap_i2c_get_clocks(dev)) != 0) 911 if ((r = omap_i2c_get_clocks(dev)) != 0)
907 goto err_iounmap; 912 goto err_iounmap;
908 913
@@ -926,11 +931,6 @@ omap_i2c_probe(struct platform_device *pdev)
926 dev->b_hw = 1; /* Enable hardware fixes */ 931 dev->b_hw = 1; /* Enable hardware fixes */
927 } 932 }
928 933
929 if (cpu_is_omap7xx())
930 dev->reg_shift = 1;
931 else
932 dev->reg_shift = 2;
933
934 /* reset ASAP, clearing any IRQs */ 934 /* reset ASAP, clearing any IRQs */
935 omap_i2c_init(dev); 935 omap_i2c_init(dev);
936 936
diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
index 247103372a06..a97e3fec8148 100644
--- a/drivers/i2c/busses/i2c-pnx.c
+++ b/drivers/i2c/busses/i2c-pnx.c
@@ -173,6 +173,9 @@ static int i2c_pnx_master_xmit(struct i2c_pnx_algo_data *alg_data)
173 /* We still have something to talk about... */ 173 /* We still have something to talk about... */
174 val = *alg_data->mif.buf++; 174 val = *alg_data->mif.buf++;
175 175
176 if (alg_data->mif.len == 1)
177 val |= stop_bit;
178
176 alg_data->mif.len--; 179 alg_data->mif.len--;
177 iowrite32(val, I2C_REG_TX(alg_data)); 180 iowrite32(val, I2C_REG_TX(alg_data));
178 181
@@ -246,6 +249,9 @@ static int i2c_pnx_master_rcv(struct i2c_pnx_algo_data *alg_data)
246 __func__); 249 __func__);
247 250
248 if (alg_data->mif.len == 1) { 251 if (alg_data->mif.len == 1) {
252 /* Last byte, do not acknowledge next rcv. */
253 val |= stop_bit;
254
249 /* 255 /*
250 * Enable interrupt RFDAIE (data in Rx fifo), 256 * Enable interrupt RFDAIE (data in Rx fifo),
251 * and disable DRMIE (need data for Tx) 257 * and disable DRMIE (need data for Tx)
@@ -633,6 +639,8 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
633 */ 639 */
634 640
635 tmp = ((freq / 1000) / I2C_PNX_SPEED_KHZ) / 2 - 2; 641 tmp = ((freq / 1000) / I2C_PNX_SPEED_KHZ) / 2 - 2;
642 if (tmp > 0x3FF)
643 tmp = 0x3FF;
636 iowrite32(tmp, I2C_REG_CKH(alg_data)); 644 iowrite32(tmp, I2C_REG_CKH(alg_data));
637 iowrite32(tmp, I2C_REG_CKL(alg_data)); 645 iowrite32(tmp, I2C_REG_CKL(alg_data));
638 646
diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c
index 1f5b38be73bc..495be451d326 100644
--- a/drivers/i2c/busses/i2c-stu300.c
+++ b/drivers/i2c/busses/i2c-stu300.c
@@ -498,7 +498,7 @@ static int stu300_set_clk(struct stu300_dev *dev, unsigned long clkrate)
498 int i = 0; 498 int i = 0;
499 499
500 /* Locate the apropriate clock setting */ 500 /* Locate the apropriate clock setting */
501 while (i < ARRAY_SIZE(stu300_clktable) && 501 while (i < ARRAY_SIZE(stu300_clktable) - 1 &&
502 stu300_clktable[i].rate < clkrate) 502 stu300_clktable[i].rate < clkrate)
503 i++; 503 i++;
504 504