From 9dc2c1471c44a314dfe6dcc48e1527c4315ebf09 Mon Sep 17 00:00:00 2001 From: Mulin Chao Date: Mon, 27 Jun 2016 13:24:33 -0700 Subject: npcx: i2c: Don't do i2c_unwedge / reset on repeated start request Checking for bus busy (stop condition sent) should not apply if the caller is requesting a repeated start. BUG=None TEST=Manual on gru. Attach USB PD charger, verify i2c_unwedge is not called. BRANCH=None Change-Id: Idf13bdc530920c8da02c8d0d8064377513a5d144 Signed-off-by: Shawn Nematbakhsh Reviewed-on: https://chromium-review.googlesource.com/356490 Commit-Ready: Shawn N Tested-by: Mulin Chao Reviewed-by: Mulin Chao Reviewed-by: Shawn N --- chip/npcx/i2c.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/chip/npcx/i2c.c b/chip/npcx/i2c.c index 33f906d2e3..2f834adcfa 100644 --- a/chip/npcx/i2c.c +++ b/chip/npcx/i2c.c @@ -635,8 +635,11 @@ int chip_i2c_xfer(int port, int slave_addr, const uint8_t *out, int out_size, p_status->err_code = SMB_OK; /* Make sure we're in a good state to start */ - if ((flags & I2C_XFER_START) && (i2c_bus_busy(ctrl) - || (i2c_get_line_levels(port) != I2C_LINE_IDLE))) { + if ((flags & I2C_XFER_START) && + /* Ignore busy bus for repeated start */ + p_status->oper_state != SMB_WRITE_SUSPEND && + (i2c_bus_busy(ctrl) + || (i2c_get_line_levels(port) != I2C_LINE_IDLE))) { /* Attempt to unwedge the i2c port. */ i2c_unwedge(port); -- cgit v1.2.1