aboutsummaryrefslogtreecommitdiff
path: root/hw/p8-i2c.c
diff options
context:
space:
mode:
authorFrederic Barrat <fbarrat@linux.ibm.com>2018-06-06 17:37:54 +0200
committerStewart Smith <stewart@linux.ibm.com>2018-06-18 22:13:14 -0500
commitc2ce576152b4d88a7f9cf2cff57e173d1b975592 (patch)
treea6ca58edc42caaf7d1ad6ca7ffb78017cf2b6470 /hw/p8-i2c.c
parent56026a13292453b072ad3cc9adf3dee960077f38 (diff)
downloadskiboot-c2ce576152b4d88a7f9cf2cff57e173d1b975592.zip
skiboot-c2ce576152b4d88a7f9cf2cff57e173d1b975592.tar.gz
skiboot-c2ce576152b4d88a7f9cf2cff57e173d1b975592.tar.bz2
p8-i2c: fix wrong request status when a reset is needed
If the bus is found in error state when starting a new request, the engine is reset and we enter recovery. However, once complete, the reset operation shows a status of complete in the status register. So any badly-timed called to check_status() will think the current top request is complete, even though it hasn't run yet. So don't update any request status while we are in recovery, as nothing useful for the request is supposed to happen in that state. Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'hw/p8-i2c.c')
-rw-r--r--hw/p8-i2c.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/hw/p8-i2c.c b/hw/p8-i2c.c
index 1bcd7cc..23d54a0 100644
--- a/hw/p8-i2c.c
+++ b/hw/p8-i2c.c
@@ -826,10 +826,13 @@ static void p8_i2c_check_status(struct p8_i2c_master *master)
/*
* When idle or waiting for the occ to release the bus there's
- * nothing to check. Error states are handled when starting
- * a new request.
+ * nothing to check. Also ignore recovery state, as the bus
+ * can be reset in that state, and a request can think it's
+ * complete when it just means the reset is complete.
+ * Error states are handled when starting a new request.
*/
- if (master->state == state_idle || master->state == state_occache_dis)
+ if (master->state == state_idle || master->state == state_occache_dis ||
+ master->state == state_recovery)
return;
/* A non-idle master should always have a pending request */