From 4a142700fec80489e3aa38b64d0b519d3968b0d9 Mon Sep 17 00:00:00 2001 From: Luotao Fu Date: Mon, 1 Mar 2010 13:00:20 +0100 Subject: [PATCH] i2c-pnx: fix setting start condition The start condtions is set in different places repeatedly in the i2c-pnx driver. Beside in i2c_pnx_start the start bit is also set during the transfer of a i2c message in the master_xmit/rcv calls. This is wrong since we can't set the start condition during the transaction of a single message any way. As a matter of fact, the driver will sometimes set both the start and the stop bits at one time. This can be easily reproduced by sending a simple read request like e.g struct i2c_msg msgs[] = { { addr, 0, 1, buf }, { addr, I2C_M_RD, offset, buf } }; While processing the first message the i2c_pnx_master_xmit will set both the start_bit and the stop_bit, which will eventually confuse the slave. Fixed by remove setting start condition from the transmit routines. Signed-off-by: Luotao Fu Acked-by: Vitaly Wool --- drivers/i2c/busses/i2c-pnx.c | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c index 5d1c260..9edbe98 100644 --- a/drivers/i2c/busses/i2c-pnx.c +++ b/drivers/i2c/busses/i2c-pnx.c @@ -175,11 +175,9 @@ static int i2c_pnx_master_xmit(struct i2c_adapter *adap) /* We still have something to talk about... */ val = *alg_data->mif.buf++; - if (alg_data->mif.len == 1) { + /* last byte of a message */ + 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)); @@ -254,9 +252,6 @@ static int i2c_pnx_master_rcv(struct i2c_adapter *adap) 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), * and disable DRMIE (need data for Tx) -- 1.7.0