diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2021-01-05 12:17:20 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-01-07 18:05:35 +0000 |
commit | 6603d0f730ee3b0c9ed80e9cc43b89b20dab91ef (patch) | |
tree | 24e820f42432b9efc5083a8638d022937c8f9876 /driver/nfc | |
parent | 4c26c0ac77495e559db3fb667f7019b87c7c48b1 (diff) | |
download | chrome-ec-6603d0f730ee3b0c9ed80e9cc43b89b20dab91ef.tar.gz |
ctn730: Resend i2c on any error
Currently, ctn730 driver resends i2c frame only if EC_ERROR_BUSY is
returned. The i2c error in this case varies chip to chip. NPCX i2c
returns EC_ERROR_UNKNOWN, for example.
Instead of expecting a specific error, this patch makes CTN730 driver
resend I2C on any error.
BUG=b:176725734
BRANCH=None
TEST=On CoachZ. Verified 'Failed to read/write' disappeared.
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Change-Id: I0b461935810aa253c8399cc2a6f9573a4aab123d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2611915
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'driver/nfc')
-rw-r--r-- | driver/nfc/ctn730.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/driver/nfc/ctn730.c b/driver/nfc/ctn730.c index f1a3bf977e..1d60fb3f2e 100644 --- a/driver/nfc/ctn730.c +++ b/driver/nfc/ctn730.c @@ -208,7 +208,7 @@ static int _i2c_read(int i2c_port, uint8_t *in, int in_len) memset(in, 0, in_len); rv = i2c_xfer(i2c_port, CTN730_I2C_ADDR, NULL, 0, in, in_len); - if (rv == EC_ERROR_BUSY) { + if (rv) { msleep(_wake_up_delay_ms); rv = i2c_xfer(i2c_port, CTN730_I2C_ADDR, NULL, 0, in, in_len); } @@ -236,7 +236,7 @@ static int _send_command(struct pchg *ctx, const struct ctn730_msg *cmd) rv = i2c_xfer(i2c_port, CTN730_I2C_ADDR, (void *)cmd, sizeof(*cmd) + cmd->length, NULL, 0); - if (rv == EC_ERROR_BUSY) { + if (rv) { msleep(_wake_up_delay_ms); rv = i2c_xfer(i2c_port, CTN730_I2C_ADDR, (void *)cmd, sizeof(*cmd) + cmd->length, NULL, 0); |