From 9312676ab37de0be031d79629177c5590e83cc65 Mon Sep 17 00:00:00 2001 From: Shawn Nematbakhsh Date: Fri, 21 Aug 2015 13:09:34 -0700 Subject: i2c: Fix i2c_lock deadlock on sysjump On sysjump we attempt to lock all i2c ports in use, but locking is by-controller. This leads to a deadlock if two ports from the same controller are in use. Fix this by directly locking all controllers present in the system. BUG=chrome-os-partner:44214 TEST=`sysjump rw` and then `sysjump ro` on glados BRANCH=None Change-Id: I21d65cd4455769414216016a5c97ad118a712117 Signed-off-by: Shawn Nematbakhsh Reviewed-on: https://chromium-review.googlesource.com/294959 Reviewed-by: Aaron Durbin --- common/i2c.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/i2c.c b/common/i2c.c index 24f0d95354..a17edc51d4 100644 --- a/common/i2c.c +++ b/common/i2c.c @@ -72,9 +72,9 @@ void i2c_prepare_sysjump(void) { int i; - /* Lock all I2C port to prepare for sysjump */ - for (i = 0; i < i2c_ports_used; i++) - i2c_lock(i2c_ports[i].port, 1); + /* Lock all i2c controllers */ + for (i = 0; i < I2C_CONTROLLER_COUNT; ++i) + mutex_lock(port_mutex + i); } int i2c_read32(int port, int slave_addr, int offset, int *data) -- cgit v1.2.1