aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaxman Dewangan <ldewangan@nvidia.com>2012-04-24 03:19:35 -0400
committerWolfram Sang <w.sang@pengutronix.de>2012-05-12 08:28:18 -0400
commit353f56b5f3093b6d75e81f523a8b10748a40f278 (patch)
tree1121a1e25e2c9c4b8ddb77d3b8b55b02b306152e
parentb4f0b74ea37789eeeabe57b7ccd5808df076c081 (diff)
i2c: tegra: fix 10bit address configuration
The slave address of device to be configured in packet header as follows: 7 bit address: PacketHeader3[7:1] 10 bit address: PacketHeader3[9:0] Fixing the code to make packet header3 properly. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
-rw-r--r--drivers/i2c/busses/i2c-tegra.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 55e5ea62ccee..18067b3ee8c9 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -476,12 +476,15 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
476 packet_header = msg->len - 1; 476 packet_header = msg->len - 1;
477 i2c_writel(i2c_dev, packet_header, I2C_TX_FIFO); 477 i2c_writel(i2c_dev, packet_header, I2C_TX_FIFO);
478 478
479 packet_header = msg->addr << I2C_HEADER_SLAVE_ADDR_SHIFT; 479 packet_header = I2C_HEADER_IE_ENABLE;
480 packet_header |= I2C_HEADER_IE_ENABLE;
481 if (!stop) 480 if (!stop)
482 packet_header |= I2C_HEADER_REPEAT_START; 481 packet_header |= I2C_HEADER_REPEAT_START;
483 if (msg->flags & I2C_M_TEN) 482 if (msg->flags & I2C_M_TEN) {
483 packet_header |= msg->addr;
484 packet_header |= I2C_HEADER_10BIT_ADDR; 484 packet_header |= I2C_HEADER_10BIT_ADDR;
485 } else {
486 packet_header |= msg->addr << I2C_HEADER_SLAVE_ADDR_SHIFT;
487 }
485 if (msg->flags & I2C_M_IGNORE_NAK) 488 if (msg->flags & I2C_M_IGNORE_NAK)
486 packet_header |= I2C_HEADER_CONT_ON_NAK; 489 packet_header |= I2C_HEADER_CONT_ON_NAK;
487 if (msg->flags & I2C_M_RD) 490 if (msg->flags & I2C_M_RD)
@@ -557,7 +560,7 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
557 560
558static u32 tegra_i2c_func(struct i2c_adapter *adap) 561static u32 tegra_i2c_func(struct i2c_adapter *adap)
559{ 562{
560 return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; 563 return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_10BIT_ADDR;
561} 564}
562 565
563static const struct i2c_algorithm tegra_i2c_algo = { 566static const struct i2c_algorithm tegra_i2c_algo = {