[Skiboot] [PATCH v7 02/17] hw/p8-i2c: Speed up SMBUS_WRITE

Gavin Shan gwshan at linux.vnet.ibm.com
Thu Jun 4 16:18:54 AEST 2015


For SMBUS_WRITE, the register offset and the following data can be
sent to I2C bus in one shoot if the FIFO has enough spare space.
It will help to gain a bit more performance obviously.

Signed-off-by: Gavin Shan <gwshan at linux.vnet.ibm.com>
---
 hw/p8-i2c.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/hw/p8-i2c.c b/hw/p8-i2c.c
index f1bddc7..7b6e87c 100644
--- a/hw/p8-i2c.c
+++ b/hw/p8-i2c.c
@@ -560,10 +560,15 @@ static void p8_i2c_status_data_request(struct p8_i2c_master *master,
 			rc = p8_i2c_fifo_write(master, master->obuf,
 					       req->offset_bytes);
 		}
+
+		/* For read, wait address phase to complete */
+		if (rc || req->op != SMBUS_WRITE)
+			break;
+
 		/* For writes, transition to data phase now */
-		if (rc == 0 && req->op == SMBUS_WRITE)
-			master->state = state_data;
-		break;
+		master->state = state_data;
+		fifo_free -= req->offset_bytes;
+		/* Fall through */
 	case state_data:
 		/* Sanity check */
 		if (master->bytes_sent >= req->rw_len) {
-- 
2.1.0



More information about the Skiboot mailing list