summaryrefslogtreecommitdiff
path: root/drivers/i2c/busses/i2c-pnx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c/busses/i2c-pnx.c')
-rw-r--r--drivers/i2c/busses/i2c-pnx.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
index 2b0bd0b042d6..a97e3fec8148 100644
--- a/drivers/i2c/busses/i2c-pnx.c
+++ b/drivers/i2c/busses/i2c-pnx.c
@@ -22,6 +22,7 @@
#include <linux/io.h>
#include <linux/err.h>
#include <linux/clk.h>
+#include <linux/slab.h>
#include <mach/hardware.h>
#include <mach/i2c.h>
@@ -172,11 +173,8 @@ 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) {
+ if (alg_data->mif.len == 1)
val |= stop_bit;
- if (!alg_data->last)
- val |= start_bit;
- }
alg_data->mif.len--;
iowrite32(val, I2C_REG_TX(alg_data));
@@ -253,8 +251,6 @@ static int i2c_pnx_master_rcv(struct i2c_pnx_algo_data *alg_data)
if (alg_data->mif.len == 1) {
/* Last byte, do not acknowledge next rcv. */
val |= stop_bit;
- if (!alg_data->last)
- val |= start_bit;
/*
* Enable interrupt RFDAIE (data in Rx fifo),
@@ -643,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));