diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2015-12-04 17:11:51 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2015-12-07 13:49:31 -0800 |
commit | 3b40955f37a73141312e75fd2d9bc0126ae9278f (patch) | |
tree | 80bf281f9d96f4b5ffd1d154b1e79ef60e941624 /chip/mec1322/i2c.c | |
parent | 51daa37c5ae6ce3fd6938aca92aede98c03062e9 (diff) | |
download | chrome-ec-3b40955f37a73141312e75fd2d9bc0126ae9278f.tar.gz |
Revert "mec1322: i2c: Assume read-no-write transactions are repeated start"
This reverts commit 4421d75c24738a524ed840935d4495cf1a75a3c3, which was
breaking the 'i2cscan' console command.
BUG=chromium:561143
TEST=None
BRANCH=None
Change-Id: If266b73c1009e131ec9c01dcd5d3b923bd981da5
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/316021
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'chip/mec1322/i2c.c')
-rw-r--r-- | chip/mec1322/i2c.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/chip/mec1322/i2c.c b/chip/mec1322/i2c.c index 5a0cc850cb..c1aa75efc8 100644 --- a/chip/mec1322/i2c.c +++ b/chip/mec1322/i2c.c @@ -234,11 +234,11 @@ int chip_i2c_xfer(int port, int slave_addr, const uint8_t *out, int out_size, select_port(port); controller = i2c_port_to_controller(port); - if (send_start && out_size) + if (send_start) wait_idle(controller); reg = MEC1322_I2C_STATUS(controller); - if (send_start && out_size && + if (send_start && (((reg & (STS_BER | STS_LAB)) || !(reg & STS_NBB)) || (get_line_level(controller) != I2C_LINE_IDLE))) { @@ -293,15 +293,24 @@ int chip_i2c_xfer(int port, int slave_addr, const uint8_t *out, int out_size, if (in_size) { /* Resend start bit when changing direction */ if (out_size || send_start) { - /* Repeated start */ - MEC1322_I2C_CTRL(controller) = CTRL_ESO | - CTRL_STA | - CTRL_ACK | - CTRL_ENI; + /* Repeated start case */ + if (out_size) + MEC1322_I2C_CTRL(controller) = CTRL_ESO | + CTRL_STA | + CTRL_ACK | + CTRL_ENI; MEC1322_I2C_DATA(controller) = (uint8_t)slave_addr | 0x01; + /* New transaction case, clock out slave address. */ + if (!out_size) + MEC1322_I2C_CTRL(controller) = CTRL_ESO | + CTRL_STA | + CTRL_ACK | + CTRL_ENI | + CTRL_PIN; + /* Skip over the dummy byte */ skip = 1; in_size++; |