From 8ee45dc055b809ba27c279c37a5df389f772de9b Mon Sep 17 00:00:00 2001 From: Dino Li Date: Thu, 29 Jul 2021 10:27:56 +0800 Subject: it83xx: i2c: don't check bus busy if transaction is ongoing. This CL fixes that i2c driver will prompt "I2C chx reset cause 1" issue when one i2c transaction is separated into at least three i2c_xfer and I2C_XFER_START flag is set at least two times. eg. - i2c_xfer with I2C_XFER_START flag - i2c_xfer with I2C_XFER_START flag <= this will cause reset - xxx - i2c_xfer with I2C_XFER_STOP flag BRANCH=none BUG=none TEST=no i2c reset on Asurada, Drawcia, and ADL-RVP. Signed-off-by: Dino Li Change-Id: I97161db0bb0c54de3ad55d82512a6a188036270f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3058724 Tested-by: Vijay Hiremath Reviewed-by: Eric Yilun Lin --- chip/it83xx/i2c.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'chip') diff --git a/chip/it83xx/i2c.c b/chip/it83xx/i2c.c index d6dc366f56..5aa8f8a460 100644 --- a/chip/it83xx/i2c.c +++ b/chip/it83xx/i2c.c @@ -651,10 +651,15 @@ int chip_i2c_xfer(int port, uint16_t addr_flags, if (out_size == 0 && in_size == 0) return EC_SUCCESS; - if (pd->i2ccs) { - if ((flags & I2C_XFER_SINGLE) == I2C_XFER_SINGLE) - flags &= ~I2C_XFER_START; - } + /* + * Make the below i2c transaction work: + * - i2c_xfer with I2C_XFER_START flag + * - i2c_xfer with I2C_XFER_START flag + * - xxx + * - i2c_xfer with I2C_XFER_STOP flag + */ + if (pd->i2ccs) + flags &= ~I2C_XFER_START; /* Copy data to port struct */ pd->out = out; -- cgit v1.2.1