aboutsummaryrefslogtreecommitdiff
path: root/hw/p8-i2c.c
diff options
context:
space:
mode:
authorOliver O'Halloran <oohall@gmail.com>2017-11-17 17:04:11 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-11-20 20:35:24 -0600
commitc2e404aedd52da91fdf605e24b9d1ae7894974c5 (patch)
tree5245c107365536846da4d8aa4dea6b6db4255324 /hw/p8-i2c.c
parente947593a38a15d4e80a108ae90a8fa9066d20837 (diff)
downloadskiboot-c2e404aedd52da91fdf605e24b9d1ae7894974c5.zip
skiboot-c2e404aedd52da91fdf605e24b9d1ae7894974c5.tar.gz
skiboot-c2e404aedd52da91fdf605e24b9d1ae7894974c5.tar.bz2
p8-i2c: Limit number of retry attempts
Current we will attempt to start an I2C transaction until it succeeds. In the event that the OCC does not release the lock on an I2C bus this results in an async token being held forever and the kernel thread that started the transaction will block forever while waiting for an async completion message. Fix this by limiting the number of attempts to start the transaction. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/p8-i2c.c')
-rw-r--r--hw/p8-i2c.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/hw/p8-i2c.c b/hw/p8-i2c.c
index ec2f7fc..d029854 100644
--- a/hw/p8-i2c.c
+++ b/hw/p8-i2c.c
@@ -1303,8 +1303,16 @@ static void p8_i2c_check_work(struct p8_i2c_master *master)
while (master->state == state_idle && !list_empty(&master->req_list)) {
req = list_top(&master->req_list, struct i2c_request, link);
rc = p8_i2c_start_request(master, req);
- if (rc && rc != OPAL_BUSY)
- p8_i2c_complete_request(master, req, rc);
+ if (rc) {
+ /*
+ * If it didn't work the first three times then
+ * odds are it's not going to work on the 4th.
+ */
+ if (rc && req->retries > 3)
+ p8_i2c_complete_request(master, req, rc);
+ else
+ req->retries++;
+ }
}
}