[PATCH linux dev-5.3] i2c: fsi: Increase performance

Eddie James eajames at linux.ibm.com
Tue Nov 5 07:12:30 AEDT 2019


Usleep_range is holding back performance too much with the current
polling method, so remove it. In addition, reduce the default clock
divider to 3. And fix a bug where timeouts aren't cleaned up.

Signed-off-by: Eddie James <eajames at linux.ibm.com>
---
 drivers/i2c/busses/i2c-fsi.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c
index da5eb3960def..22b79f995d2b 100644
--- a/drivers/i2c/busses/i2c-fsi.c
+++ b/drivers/i2c/busses/i2c-fsi.c
@@ -27,7 +27,7 @@
 
 #define FSI_ENGID_I2C		0x7
 
-#define I2C_DEFAULT_CLK_DIV	6
+#define I2C_DEFAULT_CLK_DIV	3
 
 /* i2c registers */
 #define I2C_FSI_FIFO		0x00
@@ -592,14 +592,11 @@ static int fsi_i2c_wait(struct fsi_i2c_port *port, struct i2c_msg *msg,
 			/* cmd complete and all data xfrd */
 			if (rc == msg->len)
 				return 0;
-
-			/* need to xfr more data, but maybe don't need wait */
-			continue;
 		}
-
-		usleep_range(I2C_CMD_SLEEP_MIN_US, I2C_CMD_SLEEP_MAX_US);
 	} while (time_after(start + timeout, jiffies));
 
+	fsi_i2c_abort(port, 0);
+
 	return -ETIMEDOUT;
 }
 
-- 
2.23.0



More information about the openbmc mailing list