diff options
author | Tony Zou <zoutao@huaqin.corp-partner.google.com> | 2019-03-01 15:49:30 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-03-05 12:58:25 -0800 |
commit | fa5900976db7b738a5bdb9f66fa56ce811b852d9 (patch) | |
tree | 7844d121dd6b09c3f9356ef8bb45afd7ac0ceb45 /common | |
parent | 93d7bcea8121869520b0d02bf94f95eb261bee05 (diff) | |
download | chrome-ec-fa5900976db7b738a5bdb9f66fa56ce811b852d9.tar.gz |
i2c:xfer i2cwrite invalid in ec console
In command
xfer i2cwrite port addr offset value
16bit offset and 8bit offset call the wrong i2c write interfacefix it.
BRANCH=none
BUG=b:126820386
TEST=1:) Build flapjack EC and flash to DUT ,
in ec console can read/write i2c device correctly.
2:) Build kukui EC , build pass.
Change-Id: Ib3aa058ae0917fe62f38bc500a8227d6e36dbab1
Reviewed-on: https://chromium-review.googlesource.com/1496676
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Tony Zou <zoutao@huaqin.corp-partner.google.com>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/i2c_master.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/common/i2c_master.c b/common/i2c_master.c index 5f84cc8e9f..5c9c8437c5 100644 --- a/common/i2c_master.c +++ b/common/i2c_master.c @@ -1034,19 +1034,19 @@ static int command_i2cxfer(int argc, char **argv) if (strcasecmp(argv[1], "r") == 0) { /* 8-bit read */ - if(offset_size == 2) - rv = i2c_read_offset16(port, slave_addr, offset, &v, 1); - else - rv = i2c_read8(port, slave_addr, offset, &v); + if (offset_size == 2) + rv = i2c_read_offset16(port, slave_addr, offset, &v, 1); + else + rv = i2c_read8(port, slave_addr, offset, &v); if (!rv) ccprintf("0x%02x [%d]\n", v, v); } else if (strcasecmp(argv[1], "r16") == 0) { /* 16-bit read */ - if(offset_size == 2) - rv = i2c_read_offset16(port, slave_addr, offset, &v, 2); - else - rv = i2c_read16(port, slave_addr, offset, &v); + if (offset_size == 2) + rv = i2c_read_offset16(port, slave_addr, offset, &v, 2); + else + rv = i2c_read16(port, slave_addr, offset, &v); if (!rv) ccprintf("0x%04x [%d]\n", v, v); @@ -1064,19 +1064,19 @@ static int command_i2cxfer(int argc, char **argv) /* 8-bit write */ if (argc < 6) return EC_ERROR_PARAM5; - if(offset_size == 2) - rv = i2c_write8(port, slave_addr, offset, v); - else - rv = i2c_write_offset16(port, slave_addr, offset, v, 1); + if (offset_size == 2) + rv = i2c_write_offset16(port, slave_addr, offset, v, 1); + else + rv = i2c_write8(port, slave_addr, offset, v); } else if (strcasecmp(argv[1], "w16") == 0) { /* 16-bit write */ if (argc < 6) return EC_ERROR_PARAM5; - if(offset_size == 2) - rv = i2c_write16(port, slave_addr, offset, v); - else - rv = i2c_write_offset16(port, slave_addr, offset, v, 2); + if (offset_size == 2) + rv = i2c_write_offset16(port, slave_addr, offset, v, 2); + else + rv = i2c_write16(port, slave_addr, offset, v); } else { return EC_ERROR_PARAM1; |