aboutsummaryrefslogtreecommitdiff
path: root/hw/p8-i2c.c
diff options
context:
space:
mode:
authorGavin Shan <gwshan@linux.vnet.ibm.com>2015-11-12 13:33:09 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-03-08 18:18:51 +1100
commit2c3c14a14b13d9a180cb22896d878ffa96c39f1e (patch)
tree76b002916a9a42efc12375f96ad1a3af5d57d500 /hw/p8-i2c.c
parent5cda6f6de5af22b7602901584b6eeca099e50b20 (diff)
downloadskiboot-2c3c14a14b13d9a180cb22896d878ffa96c39f1e.zip
skiboot-2c3c14a14b13d9a180cb22896d878ffa96c39f1e.tar.gz
skiboot-2c3c14a14b13d9a180cb22896d878ffa96c39f1e.tar.bz2
hw/p8-i2c: Speed up SMBUS_WRITE
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@linux.vnet.ibm.com> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/p8-i2c.c')
-rw-r--r--hw/p8-i2c.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/hw/p8-i2c.c b/hw/p8-i2c.c
index 5dd407d..7ca5f70 100644
--- a/hw/p8-i2c.c
+++ b/hw/p8-i2c.c
@@ -589,10 +589,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) {