diff options
author | Jett Rink <jettrink@chromium.org> | 2019-07-23 10:50:13 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-07-25 16:50:42 +0000 |
commit | 286e3b9033c551f5fe24fe8c41de17b35bf27c81 (patch) | |
tree | 3f27651b0f4c440c3715b76aa2535b24089ff6c0 /chip/ish | |
parent | 7e0885d97099d8c3e51913103d442fec6a31fb4c (diff) | |
download | chrome-ec-286e3b9033c551f5fe24fe8c41de17b35bf27c81.tar.gz |
i2c: don't scan i2c addresses less than 0x08
None of the existing i2c addresses in the EC code base are less than 0x08
and those addresses are reserved by the i2c and SMBus specification.
BRANCH=none
BUG=b:138156666
TEST=i2c bus scan with a smart battery doesn't "misbehave" any more and
other devices can be detected properly.
Change-Id: I561b082c4c7e3df7caaa33b6ef6ad467dabbd5a5
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1715326
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'chip/ish')
-rw-r--r-- | chip/ish/i2c.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/chip/ish/i2c.c b/chip/ish/i2c.c index 405e63935e..b4cc32f0ad 100644 --- a/chip/ish/i2c.c +++ b/chip/ish/i2c.c @@ -306,10 +306,9 @@ int chip_i2c_xfer(const int port, const uint16_t slave_addr_flags, return EC_ERROR_INVAL; /* Check for reserved I2C addresses, pg. 74 in DW_apb_i2c.pdf - * Address cannot be any of the reserved address locations: - * 0x00 to 0x07 or 0x78 to 0x7f. + * Address cannot be any of the reserved address locations */ - if (addr <= 0x07 || (addr >= 0x78 && addr <= 0x7F)) + if (addr < I2C_FIRST_VALID_ADDR || addr > I2C_LAST_VALID_ADDR) return EC_ERROR_INVAL; /* assume that if both out_size and in_size are not zero, |