diff options
author | Ting Shen <phoenixshen@google.com> | 2019-10-03 15:12:53 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-10-28 04:23:54 +0000 |
commit | daccb3adea9394116d7ab2c807e4a360cb5a93a1 (patch) | |
tree | 1ab613b22a459607ce71546827a8a4c4ffa7a4ae /include/config.h | |
parent | 6841c7835416d03aefb939ff94b3e9221e81c355 (diff) | |
download | chrome-ec-daccb3adea9394116d7ab2c807e4a360cb5a93a1.tar.gz |
smart_battery: add smbus error checking support
Jacuzzi/Kodama has a unstable software controlled i2c bus, its data
transmission may be interrupted by other higher priority tasks and
causes device timeout.
If timeout happens when ec is reading data, it has no knowledge about
what's happening on slave, and keep receiving bad data (0xFF's) until
end. The standard i2c/smbus error handling mechanism can not handle this
case, so we need the error checking feature from smbus 1.1 to ensure our
received data is correct.
This CL adds the error checking (PEC) functions to i2c and smart battery
module.
BUG=b:138415463
TEST=On kodama, enable CONFIG_CMD_I2C_STRESS_TEST,
no failure after 100k read/writes.
test code at CL:1865054
BRANCH=master
Change-Id: Ibb9ad3aa03d7690a08f59c617c2cd9c1b9cb0ff3
Signed-off-by: Ting Shen <phoenixshen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1827138
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Tested-by: Ting Shen <phoenixshen@chromium.org>
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'include/config.h')
-rw-r--r-- | include/config.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/config.h b/include/config.h index 21e1aa1ad5..741c618316 100644 --- a/include/config.h +++ b/include/config.h @@ -2278,6 +2278,20 @@ */ #undef CONFIG_I2C_MULTI_PORT_CONTROLLER +/* + * Packet error checking support for SMBus. + * + * If defined, adds error checking support for i2c_readN, i2c_writeN, + * i2c_read_string and i2c_write_block. Where + * - write operation appends an error checking byte at end of transfer, and + * - read operatoin verifies the correctness of error checking byte from the + * slave. + * Set I2C_FLAG on addr_flags parameter to use this feature. + * + * This option also enables error checking function on smart batteries. + */ +#undef CONFIG_SMBUS_PEC + /*****************************************************************************/ /* IPI configuration. Support mt_scp only for now. */ @@ -4977,4 +4991,8 @@ #define CONFIG_SHA256 #endif +#ifdef CONFIG_SMBUS_PEC +#define CONFIG_CRC8 +#endif + #endif /* __CROS_EC_CONFIG_H */ |