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 <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/356490
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
Mulin Chao
2016-06-27 13:24:33 -07:00
committed by chrome-bot
parent dcac93af41
commit 9dc2c1471c

View File

@@ -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);