Skip to contentSkip to conversation

drivers: i2c: fsi: Add proper abort method

PATCH Superseded Eddie James 2 participants 7 messages Oct 12, 2017 – Oct 20, 2017

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: i2c: fsi: Add proper abort method

From: "Edward A. James" <[email protected]>

Driver wasn't cleaning up on timeout or in an error situation properly. Need to do a full reset if we fail in order to re-stablish a good state of the engine.

---
 drivers/i2c/busses/i2c-fsi.c | 259 +++++++++++++++++++++++++++++++------------
 1 file changed, 191 insertions(+), 68 deletions(-)
drivers/i2c/busses/i2c-fsi.c +191 -68
index 1af9c01..6c582d8 100644
@@ -133,6 +133,11 @@
 #define I2C_ESTAT_SELF_BUSY	0x00000040
 #define I2C_ESTAT_VERSION	0x0000001f
 
+#define I2C_PORT_BUSY_RESET	0x80000000
+
+#define I2C_LOCAL_WAIT_TIMEOUT	2		/* jiffies */
+#define I2C_ABORT_TIMEOUT	msecs_to_jiffies(100)
+
 struct fsi_i2c_master {
 	struct fsi_device	*fsi;
 	u8			fifo_size;
@@ -351,22 +356,185 @@ static int fsi_i2c_read_fifo(struct fsi_i2c_port *port, struct i2c_msg *msg,
 	return rc;
 }
 
+static int fsi_i2c_reset_bus(struct fsi_i2c_master *i2c)
+{
+	int i, rc;
+	u32 mode, dummy = 0;
+
+	rc = fsi_i2c_read_reg(i2c->fsi, I2C_FSI_MODE, &mode);
+	if (rc)
+		return rc;
+
+	mode |= I2C_MODE_DIAG;
+	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_MODE, &mode);
+	if (rc)
+		return rc;
+
+	for (i = 0; i < 9; ++i) {
+		rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_SCL, &dummy);
+		if (rc)
+			return rc;
+
+		rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_SET_SCL, &dummy);
+		if (rc)
+			return rc;
+	}
+
+	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_SCL, &dummy);
+	if (rc)
+		return rc;
+
+	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_SDA, &dummy);
+	if (rc)
+		return rc;
+
+	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_SET_SCL, &dummy);
+	if (rc)
+		return rc;
+
+	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_SET_SDA, &dummy);
+	if (rc)
+		return rc;
+
+	mode &= ~I2C_MODE_DIAG;
+	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_MODE, &mode);
+
+	return rc;
+}
+
+static int fsi_i2c_reset(struct fsi_i2c_master *i2c, u16 port)
+{
+	int rc;
+	u32 mode, stat, dummy = 0;
+
+	/* reset engine */
+	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_I2C, &dummy);
+	if (rc)
+		return rc;
+
+	/* re-init engine */
+	rc = fsi_i2c_dev_init(i2c);
+	if (rc)
+		return rc;
+
+	rc = fsi_i2c_read_reg(i2c->fsi, I2C_FSI_MODE, &mode);
+	if (rc)
+		return rc;
+
+	/* set port; default after reset is 0 */
+	if (port) {
+		mode = SETFIELD(I2C_MODE_PORT, mode, port);
+		rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_MODE, &mode);
+		if (rc)
+			return rc;
+	}
+
+	/* reset busy register; hw workaround */
+	dummy = I2C_PORT_BUSY_RESET;
+	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_PORT_BUSY, &dummy);
+	if (rc)
+		return rc;
+
+	/* force bus reset */
+	rc = fsi_i2c_reset_bus(i2c);
+	if (rc)
+		return rc;
+
+	/* reset errors */
+	dummy = 0;
+	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_ERR, &dummy);
+	if (rc)
+		return rc;
+
+	/* wait for command complete */
+	set_current_state(TASK_INTERRUPTIBLE);
+	schedule_timeout(I2C_LOCAL_WAIT_TIMEOUT);
+
+	rc = fsi_i2c_read_reg(i2c->fsi, I2C_FSI_STAT, &stat);
+	if (rc)
+		return rc;
+
+	if (stat & I2C_STAT_CMD_COMP)
+		return 0;
+
+	/* failed to get command complete; reset engine again */
+	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_I2C, &dummy);
+	if (rc)
+		return rc;
+
+	/* re-init engine again */
+	rc = fsi_i2c_dev_init(i2c);
+	if (rc)
+		return rc;
+
+	return 0;
+}
+
+static int fsi_i2c_abort(struct fsi_i2c_port *port, u32 status)
+{
+	int rc;
+	unsigned long start;
+	u32 cmd = I2C_CMD_WITH_STOP;
+	struct fsi_device *fsi = port->master->fsi;
+
+	rc = fsi_i2c_reset(port->master, port->port);
+	if (rc)
+		return rc;
+
+	/* skip final stop command for these errors */
+	if (status & (I2C_STAT_PARITY | I2C_STAT_LOST_ARB | I2C_STAT_STOP_ERR))
+		return 0;
+
+	rc = fsi_i2c_write_reg(fsi, I2C_FSI_CMD, &cmd);
+	if (rc)
+		return rc;
+
+	start = jiffies;
+
+	do {
+		rc = fsi_i2c_read_reg(fsi, I2C_FSI_STAT, &status);
+		if (rc)
+			return rc;
+
+		if (status & I2C_STAT_CMD_COMP)
+			return 0;
+
+		set_current_state(TASK_INTERRUPTIBLE);
+		if (schedule_timeout(I2C_LOCAL_WAIT_TIMEOUT) > 0)
+			return -EINTR;
+
+	} while (time_after(start + I2C_ABORT_TIMEOUT, jiffies));
+
+	return -ETIME;
+}
+
 static int fsi_i2c_handle_status(struct fsi_i2c_port *port,
 				 struct i2c_msg *msg, u32 status)
 {
 	int rc;
 	u8 fifo_count;
-	struct fsi_i2c_master *i2c = port->master;
-	u32 dummy = 0;
 
 	if (status & I2C_STAT_ERR) {
-		rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_ERR, &dummy);
+		rc = fsi_i2c_abort(port, status);
 		if (rc)
 			return rc;
 
+		if (status & I2C_STAT_INV_CMD)
+			return -EINVAL;
+
+		if (status & (I2C_STAT_PARITY | I2C_STAT_BE_OVERRUN |
+		    I2C_STAT_BE_ACCESS))
+			return -EPROTO;
+
 		if (status & I2C_STAT_NACK)
 			return -EFAULT;
 
+		if (status & I2C_STAT_LOST_ARB)
+			return -ECANCELED;
+
+		if (status & I2C_STAT_STOP_ERR)
+			return -EBADMSG;
+
 		return -EIO;
 	}
 
@@ -396,9 +564,9 @@ static int fsi_i2c_handle_status(struct fsi_i2c_port *port,
 static int fsi_i2c_wait(struct fsi_i2c_port *port, struct i2c_msg *msg,
 			unsigned long timeout)
 {
-	const unsigned long local_timeout = 2; /* jiffies */
 	u32 status = 0;
-	int rc;
+	int rc, rc_abort;
+	unsigned long start = jiffies;
 
 	do {
 		rc = fsi_i2c_read_reg(port->master->fsi, I2C_FSI_STAT,
@@ -419,13 +587,21 @@ static int fsi_i2c_wait(struct fsi_i2c_port *port, struct i2c_msg *msg,
 			continue;
 		}
 
-		set_current_state(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(local_timeout);
-		timeout = (timeout < local_timeout) ? 0 :
-			timeout - local_timeout;
-	} while (timeout);
+		set_current_state(TASK_INTERRUPTIBLE);
+		if (schedule_timeout(I2C_LOCAL_WAIT_TIMEOUT) > 0) {
+			rc = -EINTR;
+			goto abort;
+		}
+	} while (time_after(start + timeout, jiffies));
 
-	return -ETIME;
+	rc = -ETIME;
+
+abort:
+	rc_abort = fsi_i2c_abort(port, status);
+	if (rc_abort)
+		return rc_abort;
+
+	return rc;
 }
 
 static int fsi_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
@@ -469,72 +645,19 @@ static u32 fsi_i2c_functionality(struct i2c_adapter *adap)
 		| I2C_FUNC_SMBUS_EMUL | I2C_FUNC_SMBUS_BLOCK_DATA;
 }
 
-static int fsi_i2c_low_level_recover_bus(struct fsi_i2c_master *i2c)
-{
-	int i, rc;
-	u32 mode, dummy = 0;
-
-	rc = fsi_i2c_read_reg(i2c->fsi, I2C_FSI_MODE, &mode);
-	if (rc)
-		return rc;
-
-	mode |= I2C_MODE_DIAG;
-	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_MODE, &mode);
-	if (rc)
-		return rc;
-
-	for (i = 0; i < 9; ++i) {
-		rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_SCL, &dummy);
-		if (rc)
-			return rc;
-
-		rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_SET_SCL, &dummy);
-		if (rc)
-			return rc;
-	}
-
-	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_SCL, &dummy);
-	if (rc)
-		return rc;
-
-	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_SDA, &dummy);
-	if (rc)
-		return rc;
-
-	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_SET_SCL, &dummy);
-	if (rc)
-		return rc;
-
-	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_SET_SDA, &dummy);
-	if (rc)
-		return rc;
-
-	mode &= ~I2C_MODE_DIAG;
-	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_MODE, &mode);
-
-	return rc;
-}
-
 static int fsi_i2c_recover_bus(struct i2c_adapter *adap)
 {
 	int rc;
-	u32 dummy = 0;
 	struct fsi_i2c_port *port = adap->algo_data;
-	struct fsi_i2c_master *i2c = port->master;
+	struct fsi_i2c_master *master = port->master;
 
-	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_I2C, &dummy);
+	rc = fsi_i2c_lock_master(master, adap->timeout);
 	if (rc)
 		return rc;
 
-	rc = fsi_i2c_dev_init(i2c);
-	if (rc)
-		return rc;
+	rc = fsi_i2c_reset(master, port->port);
 
-	rc = fsi_i2c_low_level_recover_bus(i2c);
-	if (rc)
-		return rc;
-
-	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_ERR, &dummy);
+	fsi_i2c_unlock_master(master);
 
 	return rc;
 }
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 5 lines · Eddie James
Quoted 1 line

From: "Edward A. James" <[email protected]>


Driver wasn't cleaning up on timeout or in an error situation properly. Need to do a full reset if we fail in order to re-stablish a good state of the engine.

Was there a particular use-case that triggered this behaviour or was this just found in general use? I feel a bit more context would be helpful here. It's a fairly sizeable patch and I'm surprised recovery was overlooked initially.

Cheers,

Andrew

#2 lore raw
Quoted 9 lines · Andrew Jeffery
Quoted 5 lines · Eddie James
Quoted 1 line

From: "Edward A. James" <[email protected]>

Driver wasn't cleaning up on timeout or in an error situation properly. Need to do a full reset if we fail in order to re-stablish a good state of the engine.

Was there a particular use-case that triggered this behaviour or was this just found in general use? I feel a bit more context would be helpful here. It's a fairly sizeable patch and I'm surprised recovery was overlooked initially.

You'd have to hit either a timeout or some non-NACK error condition in order to trigger the problem. Somehow NACK doesn't cause the I2C engine to get into a bad state. And timeouts it seems to be somewhat intermittent. Probably depends what state the bus is in when the driver actually bails out.

Thanks,
Eddie

Quoted 4 lines

Cheers,

Andrew

#3 lore raw
Quoted 14 lines · Eddie James
Quoted 11 lines · Andrew Jeffery
Quoted 6 lines · Eddie James
Quoted 1 line

From: "Edward A. James" <[email protected]>


Driver wasn't cleaning up on timeout or in an error situation properly. Need to do a full reset if we fail in order to re-stablish a good state of the engine.

Was there a particular use-case that triggered this behaviour or was this just found in general use? I feel a bit more context would be helpful here. It's a fairly sizeable patch and I'm surprised recovery was overlooked initially.

Quoted 5 lines

You'd have to hit either a timeout or some non-NACK error condition in order to trigger the problem. Somehow NACK doesn't cause the I2C engine to get into a bad state. And timeouts it seems to be somewhat intermittent. Probably depends what state the bus is in when the driver actually bails out.

I asked off-list about finding someone to provide at least a Tested-by (and I'm hoping for a Reviewed-by) tag, did we get anyone?

Cheers,

Andrew

#4 lore raw
Quoted 11 lines · Andrew Jeffery
Quoted 10 lines · Eddie James
Quoted 9 lines · Andrew Jeffery
Quoted 5 lines · Eddie James
Quoted 1 line

From: "Edward A. James" <[email protected]>

Driver wasn't cleaning up on timeout or in an error situation properly. Need to do a full reset if we fail in order to re-stablish a good state of the engine.

Was there a particular use-case that triggered this behaviour or was this just found in general use? I feel a bit more context would be helpful here. It's a fairly sizeable patch and I'm surprised recovery was overlooked initially.

Quoted 7 lines
Quoted 5 lines

You'd have to hit either a timeout or some non-NACK error condition in order to trigger the problem. Somehow NACK doesn't cause the I2C engine to get into a bad state. And timeouts it seems to be somewhat intermittent. Probably depends what state the bus is in when the driver actually bails out.

I asked off-list about finding someone to provide at least a Tested-by (and I'm hoping for a Reviewed-by) tag, did we get anyone?

Sivas ran it through the usual suite of power-on and reboot tests, but I'm not sure how extensively the i2c path is exercised there. I can ask him to add Tested-by when he returns from vacation.

Eddie

Quoted 4 lines

Cheers,

Andrew

#5 lore raw
In reply to Eddie James
Quoted 114 lines · Eddie James

From: "Edward A. James" <[email protected]>

Driver wasn't cleaning up on timeout or in an error situation properly. Need to do a full reset if we fail in order to re-stablish a good state of the engine.

---
 drivers/i2c/busses/i2c-fsi.c | 259 +++++++++++++++++++++++++++++++------------

 1 file changed, 191 insertions(+), 68 deletions(-)

drivers/i2c/busses/i2c-fsi.c +0 -0
index 1af9c01..6c582d8 100644
@@ -133,6 +133,11 @@
  #define I2C_ESTAT_SELF_BUSY	0x00000040
  #define I2C_ESTAT_VERSION	0x0000001f

drivers/i2c/busses/i2c-fsi.c +5 -0
+#define I2C_PORT_BUSY_RESET	0x80000000
+
+#define I2C_LOCAL_WAIT_TIMEOUT	2		/* jiffies */
+#define I2C_ABORT_TIMEOUT	msecs_to_jiffies(100)
+

 struct fsi_i2c_master {
  struct fsi_device *fsi;
  u8 fifo_size;

drivers/i2c/busses/i2c-fsi.c +0 -0
@@ -351,22 +356,185 @@ static int fsi_i2c_read_fifo(struct fsi_i2c_port *port, struct i2c_msg *msg,
  	return rc;
  }

drivers/i2c/busses/i2c-fsi.c +83 -0
+static int fsi_i2c_reset_bus(struct fsi_i2c_master *i2c)
+{
+	int i, rc;
+	u32 mode, dummy = 0;
+
+	rc = fsi_i2c_read_reg(i2c->fsi, I2C_FSI_MODE, &mode);
+	if (rc)
+		return rc;
+
+	mode |= I2C_MODE_DIAG;
+	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_MODE, &mode);
+	if (rc)
+		return rc;
+
+	for (i = 0; i < 9; ++i) {
+		rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_SCL, &dummy);
+		if (rc)
+			return rc;
+
+		rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_SET_SCL, &dummy);
+		if (rc)
+			return rc;
+	}
+
+	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_SCL, &dummy);
+	if (rc)
+		return rc;
+
+	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_SDA, &dummy);
+	if (rc)
+		return rc;
+
+	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_SET_SCL, &dummy);
+	if (rc)
+		return rc;
+
+	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_SET_SDA, &dummy);
+	if (rc)
+		return rc;
+
+	mode &= ~I2C_MODE_DIAG;
+	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_MODE, &mode);
+
+	return rc;
+}
+
+static int fsi_i2c_reset(struct fsi_i2c_master *i2c, u16 port)
+{
+	int rc;
+	u32 mode, stat, dummy = 0;
+
+	/* reset engine */
+	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_I2C, &dummy);
+	if (rc)
+		return rc;
+
+	/* re-init engine */
+	rc = fsi_i2c_dev_init(i2c);
+	if (rc)
+		return rc;
+
+	rc = fsi_i2c_read_reg(i2c->fsi, I2C_FSI_MODE, &mode);
+	if (rc)
+		return rc;
+
+	/* set port; default after reset is 0 */
+	if (port) {
+		mode = SETFIELD(I2C_MODE_PORT, mode, port);
+		rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_MODE, &mode);
+		if (rc)
+			return rc;
+	}
+
+	/* reset busy register; hw workaround */
+	dummy = I2C_PORT_BUSY_RESET;
+	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_PORT_BUSY, &dummy);
+	if (rc)
+		return rc;
+
+	/* force bus reset */
+	rc = fsi_i2c_reset_bus(i2c);
+	if (rc)
+		return rc;

drivers/i2c/busses/i2c-fsi.c static int fsi_i2c_read_fifo(struct fsi_i2c_port *port, struct i2c_msg *msg, · line 451

Quoted 10 lines
drivers/i2c/busses/i2c-fsi.c +10 -0
+
+	/* reset errors */
+	dummy = 0;
+	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_ERR, &dummy);
+	if (rc)
+		return rc;
+
+	/* wait for command complete */
+	set_current_state(TASK_INTERRUPTIBLE);
+	schedule_timeout(I2C_LOCAL_WAIT_TIMEOUT);

Shouldn't we use the uninterruptible state to ensure we get at least I2C_LOCAL_WAIT_TIMEOUT in the face of signals?

Andrew

#6 lore raw
Quoted 119 lines · Andrew Jeffery
Quoted 118 lines · Eddie James

From: "Edward A. James" <[email protected]>

Driver wasn't cleaning up on timeout or in an error situation properly. Need to do a full reset if we fail in order to re-stablish a good state of the engine.

---
  drivers/i2c/busses/i2c-fsi.c | 259 +++++++++++++++++++++++++++++++------------
  1 file changed, 191 insertions(+), 68 deletions(-)
drivers/i2c/busses/i2c-fsi.c +92 -0
index 1af9c01..6c582d8 100644
@@ -133,6 +133,11 @@
  #define I2C_ESTAT_SELF_BUSY	0x00000040
  #define I2C_ESTAT_VERSION	0x0000001f
 
+#define I2C_PORT_BUSY_RESET	0x80000000
+
+#define I2C_LOCAL_WAIT_TIMEOUT	2		/* jiffies */
+#define I2C_ABORT_TIMEOUT	msecs_to_jiffies(100)
+
  struct fsi_i2c_master {
  	struct fsi_device	*fsi;
  	u8			fifo_size;
@@ -351,22 +356,185 @@ static int fsi_i2c_read_fifo(struct fsi_i2c_port *port, struct i2c_msg *msg,
  	return rc;
  }
 
+static int fsi_i2c_reset_bus(struct fsi_i2c_master *i2c)
+{
+	int i, rc;
+	u32 mode, dummy = 0;
+
+	rc = fsi_i2c_read_reg(i2c->fsi, I2C_FSI_MODE, &mode);
+	if (rc)
+		return rc;
+
+	mode |= I2C_MODE_DIAG;
+	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_MODE, &mode);
+	if (rc)
+		return rc;
+
+	for (i = 0; i < 9; ++i) {
+		rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_SCL, &dummy);
+		if (rc)
+			return rc;
+
+		rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_SET_SCL, &dummy);
+		if (rc)
+			return rc;
+	}
+
+	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_SCL, &dummy);
+	if (rc)
+		return rc;
+
+	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_SDA, &dummy);
+	if (rc)
+		return rc;
+
+	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_SET_SCL, &dummy);
+	if (rc)
+		return rc;
+
+	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_SET_SDA, &dummy);
+	if (rc)
+		return rc;
+
+	mode &= ~I2C_MODE_DIAG;
+	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_MODE, &mode);
+
+	return rc;
+}
+
+static int fsi_i2c_reset(struct fsi_i2c_master *i2c, u16 port)
+{
+	int rc;
+	u32 mode, stat, dummy = 0;
+
+	/* reset engine */
+	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_I2C, &dummy);
+	if (rc)
+		return rc;
+
+	/* re-init engine */
+	rc = fsi_i2c_dev_init(i2c);
+	if (rc)
+		return rc;
+
+	rc = fsi_i2c_read_reg(i2c->fsi, I2C_FSI_MODE, &mode);
+	if (rc)
+		return rc;
+
+	/* set port; default after reset is 0 */
+	if (port) {
+		mode = SETFIELD(I2C_MODE_PORT, mode, port);
+		rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_MODE, &mode);
+		if (rc)
+			return rc;
+	}
+
+	/* reset busy register; hw workaround */
+	dummy = I2C_PORT_BUSY_RESET;
+	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_PORT_BUSY, &dummy);
+	if (rc)
+		return rc;
+
+	/* force bus reset */
+	rc = fsi_i2c_reset_bus(i2c);
+	if (rc)
+		return rc;
+
+	/* reset errors */
+	dummy = 0;
+	rc = fsi_i2c_write_reg(i2c->fsi, I2C_FSI_RESET_ERR, &dummy);
Quoted 8 lines

drivers/i2c/busses/i2c-fsi.c static int fsi_i2c_read_fifo(struct fsi_i2c_port *port, struct i2c_msg *msg, · line 451

Quoted 6 lines
drivers/i2c/busses/i2c-fsi.c +6 -0
+	if (rc)
+		return rc;
+
+	/* wait for command complete */
+	set_current_state(TASK_INTERRUPTIBLE);
+	schedule_timeout(I2C_LOCAL_WAIT_TIMEOUT);

Shouldn't we use the uninterruptible state to ensure we get at least I2C_LOCAL_WAIT_TIMEOUT in the face of signals?

Good point, I'll switch that.

Thanks!
Eddie

Quoted 2 lines

Andrew