qup_i2c: Fix for multiple write transactions
When a transaction consists of multiple write requests, combine them
only when the addresses of the writes are the same.
Change-Id: I35089d7b3936acf2de28f075734da84069b83fb3
Signed-off-by: Harini Jayaraman <harinij@codeaurora.org>
diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c
index 7a3df4d1..3dbbf15 100644
--- a/drivers/i2c/busses/i2c-qup.c
+++ b/drivers/i2c/busses/i2c-qup.c
@@ -477,7 +477,7 @@
addr) << 16),
dev->base + QUP_OUT_FIFO_BASE);
- qup_verify_fifo(dev, *carry_over | QUP_OUT_DATA << 16 |
+ qup_verify_fifo(dev, *carry_over | QUP_OUT_START << 16 |
addr << 16, (uint32_t)dev->base +
QUP_OUT_FIFO_BASE + (*idx) - 2, 0);
} else
@@ -541,14 +541,15 @@
QUP_OUT_FIFO_BASE + (*idx), 0);
*idx += 2;
} else if (next->flags == 0 && dev->pos == msg->len - 1
- && *idx < (dev->wr_sz*2)) {
+ && *idx < (dev->wr_sz*2) &&
+ (next->addr != msg->addr)) {
/* Last byte of an intermittent write */
- writel_relaxed((last_entry |
+ writel_relaxed((QUP_OUT_STOP |
msg->buf[dev->pos]),
dev->base + QUP_OUT_FIFO_BASE);
qup_verify_fifo(dev,
- last_entry | msg->buf[dev->pos],
+ QUP_OUT_STOP | msg->buf[dev->pos],
(uint32_t)dev->base +
QUP_OUT_FIFO_BASE + (*idx), 0);
*idx += 2;
@@ -605,7 +606,7 @@
struct i2c_msg *next = NULL;
if (rem > 1)
next = dev->msg + 1;
- while (rem > 1 && next->flags == 0) {
+ while (rem > 1 && next->flags == 0 && (next->addr == dev->msg->addr)) {
len += next->len + 1;
next = next + 1;
rem--;