summaryrefslogtreecommitdiff
path: root/drivers/i2c
diff options
context:
space:
mode:
authorChaitanya Bandi <bandik@nvidia.com>2011-10-13 19:11:19 +0530
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:49:22 -0800
commitbb210ce4aeb7ba7455f03938c6d4c87f9f1e2cad (patch)
tree4869ef7a3e9b0ab1839de2f3ed2b663fcc5ea340 /drivers/i2c
parentae7d60a22ff3c51eef72a25716a7b76012ad887e (diff)
i2c: tegra: slave: Fix i2c transmit/receive issues
Fixed the following issues in i2c slave driver: 1) Driver was failing to receive large data 2) Driver was receiving only eight bytes in a loop 3) Incorrect arguments while calling readl Change-Id: I5ffe76b800a24270845aced0df30a69d9625f557 Reviewed-on: http://git-master/r/57218 Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-by: Bandi Krishna Chaitanya <bandik@nvidia.com> Tested-by: Bandi Krishna Chaitanya <bandik@nvidia.com> Rebase-Id: Rc262503e24baad814f7175c88f9fa8a6671c34b9
Diffstat (limited to 'drivers/i2c')
-rw-r--r--[-rwxr-xr-x]drivers/i2c/busses/i2c-slave-tegra.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/i2c/busses/i2c-slave-tegra.c b/drivers/i2c/busses/i2c-slave-tegra.c
index c621f4e5cf34..03d782fac910 100755..100644
--- a/drivers/i2c/busses/i2c-slave-tegra.c
+++ b/drivers/i2c/busses/i2c-slave-tegra.c
@@ -413,7 +413,6 @@ static void handle_packet_byte_read(struct tegra_i2c_slave_dev *i2c_dev)
curr_xfer_size = BYTES_PER_FIFO_WORD * filled_slots;
if (i2c_dev->cont_status & I2C_SLV_TRANS_PREMATURE_END) {
- i2c_dev->curr_packet_bytes_read = 0;
curr_xfer_size = readl(i2c_dev->base + I2C_SLV_PACKET_STATUS);
curr_xfer_size =
(curr_xfer_size & I2C_SLV_PACKET_STATUS_BYTENUM_MASK) >>
@@ -421,6 +420,7 @@ static void handle_packet_byte_read(struct tegra_i2c_slave_dev *i2c_dev)
BUG_ON(filled_slots != ((curr_xfer_size -
i2c_dev->curr_packet_bytes_read + 3) >> 2));
+ curr_xfer_size -= i2c_dev->curr_packet_bytes_read;
}
i2c_dev->curr_packet_bytes_read += curr_xfer_size;
@@ -465,7 +465,7 @@ static void handle_tx_transaction_end(struct tegra_i2c_slave_dev *i2c_dev)
unsigned long curr_packet_size;
i2c_dev->curr_transfer = TRANSFER_STATE_NONE;
- curr_packet_size = readl(i2c_dev + I2C_SLV_PACKET_STATUS);
+ curr_packet_size = readl(i2c_dev->base + I2C_SLV_PACKET_STATUS);
curr_packet_size =
(curr_packet_size & I2C_SLV_PACKET_STATUS_BYTENUM_MASK) >>
I2C_SLV_PACKET_STATUS_BYTENUM_SHIFT;
@@ -511,7 +511,7 @@ static void handle_tx_trigger_int(struct tegra_i2c_slave_dev *i2c_dev)
int tx_tail;
int packet_len;
- fifo_status = readl(i2c_dev + I2C_FIFO_STATUS);
+ fifo_status = readl(i2c_dev->base + I2C_FIFO_STATUS);
empty_slots = (fifo_status & I2C_FIFO_STATUS_SLV_TX_MASK) >>
I2C_FIFO_STATUS_SLV_TX_SHIFT;
BUG_ON(empty_slots <= 3);
@@ -550,10 +550,9 @@ static void handle_tx_trigger_int(struct tegra_i2c_slave_dev *i2c_dev)
tx_data = 0;
for (j = 0; j < bytes_in_curr_word; ++j) {
tx_data |= (i2c_dev->tx_msg_buff[
- i2c_dev->tx_msg_tail++]<<(j*8));
- if (i2c_dev->tx_msg_tail >=
- i2c_dev->tx_msg_buf_size)
- i2c_dev->tx_msg_tail = 0;
+ tx_tail++]<<(j*8));
+ if (tx_tail >= i2c_dev->tx_msg_buf_size)
+ tx_tail = 0;
}
writel(tx_data, i2c_dev->base +
I2C_SLV_TX_FIFO);