lkml.org 
[lkml]   [2022]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 02/12] i2c: xiic: Enter standard mode only for > 255 byte read transfers
Date
From: Raviteja Narayanam <raviteja.narayanam@xilinx.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@xilinx.com>
Signed-off-by: Manikanta Guntupalli <manikanta.guntupalli@xilinx.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
\
 
 \ /
  Last update: 2022-06-24 14:08    [W:0.103 / U:2.976 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site