summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAisheng.Dong <b29396@freescale.com>2010-11-04 15:34:29 +0800
committerScott Sweeny <scott.sweeny@timesys.com>2011-01-19 11:50:17 -0500
commit54ce7e087d92a2ab38d3cea65d53de0d5827134b (patch)
treebe24bf7c14d5643e4b7e5e83c740540b5d288e5c
parentaa56fba1e3fcfc698f3972d48e6baf1b78775a22 (diff)
ENGR00127010-1 mxs i2c: make i2c addr handling be compatible with i2c framework
The Linux I2C framework expects the slave address as the 7LSB bits, therefore the address must be shifted 1 to left to become the real byte sending on the I2C bus. Signed-off-by: Aisheng.Dong <b29396@freescale.com>
-rw-r--r--drivers/i2c/busses/i2c-mxs.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index 5af354c9939e..852b2eda5dc4 100644
--- a/drivers/i2c/busses/i2c-mxs.c
+++ b/drivers/i2c/busses/i2c-mxs.c
@@ -147,7 +147,7 @@ static void hw_i2c_pioq_setup_read(struct mxs_i2c_dev *dev,
__raw_writel(queuecmd, dev->regbase + HW_I2C_QUEUECMD);
/* fill data (slave addr) */
- queuedata = addr | I2C_READ;
+ queuedata = (addr << 1) | I2C_READ;
__raw_writel(queuedata, dev->regbase + HW_I2C_DATA);
/* fill queue cmd */
@@ -174,7 +174,7 @@ static void hw_i2c_dma_setup_read(u8 addr, void *buff, int len, int flags)
desc[0]->cmd.cmd.bits.command = DMA_READ;
desc[0]->cmd.address = i2c_buf_phys;
desc[0]->cmd.pio_words[0] = CMD_I2C_SELECT;
- i2c_buf_virt[0] = addr | I2C_READ;
+ i2c_buf_virt[0] = (addr << 1) | I2C_READ;
desc[1]->cmd.cmd.bits.bytes = len;
desc[1]->cmd.cmd.bits.pio_words = 1;
@@ -209,7 +209,7 @@ static void hw_i2c_pioq_setup_write(struct mxs_i2c_dev *dev,
__raw_writel(queuecmd, dev->regbase + HW_I2C_QUEUECMD);
/* fill data (slave addr) */
- slaveaddr = addr | I2C_WRITE;
+ slaveaddr = (addr << 1) | I2C_WRITE;
memcpy(buf1, &slaveaddr, 1);
memcpy(&buf1[1], buff, len);
@@ -234,7 +234,7 @@ static void hw_i2c_dma_setup_write(u8 addr, void *buff, int len, int flags)
desc[2]->cmd.pio_words[0] |= BM_I2C_CTRL0_POST_SEND_STOP;
desc[2]->cmd.pio_words[0] |= BF_I2C_CTRL0_XFER_COUNT(len + 1) | flags;
- i2c_buf_virt[0] = addr | I2C_WRITE;
+ i2c_buf_virt[0] = (addr << 1) | I2C_WRITE;
memcpy(&i2c_buf_virt[1], buff, len);
}