diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2015-08-24 16:39:56 -0700 |
---|---|---|
committer | ChromeOS bot <3su6n15k.default@developer.gserviceaccount.com> | 2015-10-27 17:36:41 +0000 |
commit | 09b4e22fdaf329c7bb86c7e75bf5f44291f914c2 (patch) | |
tree | aa4fd476322b894d8d6c520b7c0ed1b204fc08d0 | |
parent | c7399ac341c3dc91d4f42f896f408eb1aeea1b3d (diff) | |
download | chrome-ec-09b4e22fdaf329c7bb86c7e75bf5f44291f914c2.tar.gz |
mec1322: i2c: Unwedge controller on transaction timeout
If clk or dat aren't pulled up for an extended period, the i2c
controller may get into a wedged state that requires a controller reset
to recover from. There are no outward signs of the controller being in
such a state, other than transaction timeouts. Therefore, on a
transaction timeout, reset the controller.
BUG=chrome-os-partner:43270
TEST=Manual on glados:
- Run `gpioset PP3300_USB_PD_EN 0` on PD console and wait several seconds
- Run `gpioset PP3300_USB_PD_EN 1` on PD console
- Run `i2cscan` and verify all ports / devices ack
- Repeat above several times
BRANCH=None
Change-Id: I2ae42762ee6c961224ff50309a448475b67854b5
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/295404
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
(cherry picked from commit d43ced8c8de8eecc4850b6c346b43774ff3e3ba9)
BUG=chrome-os-partner:
TEST=Manual on celes:46863
- Ground I2C0_0_DAT line manually
- After release this line, see i2C line is working again.
- Run `i2cscan` and verify all ports / devices ack
Change-Id: Ie9a860728e8f91a949ca61be4fe5294277b1d3f4
Reviewed-on: https://chromium-review.googlesource.com/308967
Reviewed-by: Shawn N <shawnn@chromium.org>
Commit-Queue: Wonjoon Lee <woojoo.lee@samsung.com>
Tested-by: Wonjoon Lee <woojoo.lee@samsung.com>
-rw-r--r-- | chip/mec1322/i2c.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/chip/mec1322/i2c.c b/chip/mec1322/i2c.c index 36ecabdbc4..4ef54a2dd4 100644 --- a/chip/mec1322/i2c.c +++ b/chip/mec1322/i2c.c @@ -369,8 +369,16 @@ err_chip_i2c_xfer: CTRL_STO | CTRL_ACK; if (ret_done == STS_LRB) return EC_ERROR_BUSY; - else if (ret_done == EC_ERROR_TIMEOUT) + else if (ret_done == EC_ERROR_TIMEOUT) { + /* + * If our transaction timed out then our i2c controller + * may be wedged without showing any other outward signs + * of failure. Reset the controller so that future + * transactions have a chance of success. + */ + reset_controller(controller); return EC_ERROR_TIMEOUT; + } else return EC_ERROR_UNKNOWN; } |