[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1656072327-13628-3-git-send-email-manikanta.guntupalli@xilinx.com>
Date: Fri, 24 Jun 2022 17:35:17 +0530
From: Manikanta Guntupalli <manikanta.guntupalli@...inx.com>
To: <michal.simek@...inx.com>, <michal.simek@....com>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-i2c@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<git@....com>
CC: Raviteja Narayanam <raviteja.narayanam@...inx.com>,
Manikanta Guntupalli <manikanta.guntupalli@...inx.com>
Subject: [PATCH 02/12] i2c: xiic: Enter standard mode only for > 255 byte read transfers
From: Raviteja Narayanam <raviteja.narayanam@...inx.com>
To maintain backward compatibility the default transfer mode is dynamic
mode. Enter standard mode only when the size of read transfer is > 255
bytes.
Signed-off-by: Raviteja Narayanam <raviteja.narayanam@...inx.com>
Signed-off-by: Manikanta Guntupalli <manikanta.guntupalli@...inx.com>
---
drivers/i2c/busses/i2c-xiic.c | 29 +++++++----------------------
1 file changed, 7 insertions(+), 22 deletions(-)
diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index fb2443623844..c8b68176427c 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -904,7 +904,7 @@ static int xiic_start_xfer(struct xiic_i2c *i2c, struct i2c_msg *msgs, int num)
static int xiic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
{
struct xiic_i2c *i2c = i2c_get_adapdata(adap);
- int err;
+ int err, count;
dev_dbg(adap->dev.parent, "%s entry SR: 0x%x\n", __func__,
xiic_getreg8(i2c, XIIC_SR_REG_OFFSET));
@@ -916,27 +916,12 @@ static int xiic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
/* Decide standard mode or Dynamic mode */
i2c->dynamic = true;
- /*
- * If number of messages is 1 and read length is > 255 bytes,
- * enter standard mode
- */
-
- if (i2c->nmsgs == 1 && (i2c->tx_msg->flags & I2C_M_RD) &&
- i2c->tx_msg->len > MAX_READ_LENGTH_DYNAMIC) {
- i2c->dynamic = false;
- } else if (i2c->nmsgs > 1) {
- int count;
-
- /*
- * If number of messages is more than 1 and one of them is
- * a read message, enter standard mode. Since repeated start
- * operation in dynamic mode read is not happenning
- */
- for (count = 0; count < i2c->nmsgs; count++) {
- if (i2c->tx_msg[count].flags & I2C_M_RD) {
- i2c->dynamic = false;
- break;
- }
+ /* Enter standard mode only when read length is > 255 bytes */
+ for (count = 0; count < i2c->nmsgs; count++) {
+ if ((i2c->tx_msg[count].flags & I2C_M_RD) &&
+ i2c->tx_msg[count].len > MAX_READ_LENGTH_DYNAMIC) {
+ i2c->dynamic = false;
+ break;
}
}
--
2.25.1
Powered by blists - more mailing lists