[Skiboot] [PATCH v9 02/22] hw/p8-i2c: Speed up SMBUS_WRITE
Gavin Shan
gwshan at linux.vnet.ibm.com
Thu Nov 12 13:33:09 AEDT 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 helps to gain a bit more performance obviously.
Signed-off-by: Gavin Shan <gwshan at linux.vnet.ibm.com>
Acked-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
---
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 66510f1..34da85f 100644
--- a/hw/p8-i2c.c
+++ b/hw/p8-i2c.c
@@ -582,10 +582,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