diff options
author | Doug Anderson <dianders@chromium.org> | 2013-05-02 18:24:21 -0700 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-05-08 15:39:38 -0700 |
commit | b38a0988d7138f32e3e22f85faf80b80da5e7332 (patch) | |
tree | ba63fcb6e517ff1257e971d1b33ac259b908024c | |
parent | 07d772db29c88711428b8adb00d042c35a367a03 (diff) | |
download | chrome-ec-b38a0988d7138f32e3e22f85faf80b80da5e7332.tar.gz |
i2c: Allow for i2c "ping" that's a write of 0 bytes
The i2cdetect command on Linux likes to probe by doing a write of 0
bytes. Rather than always returning success because there was nothing
to write, let's actually implement this command.
At the moment we only implement for the stm32l. We also don't try to
implement the "read of 0" bytes since I don't think anyone uses that.
BUG=chrome-os-partner:18778
BRANCH=none
TEST=i2cdetect -y -a 20 now detects the right devices
Change-Id: Ia159ce9b8c957d5cd11f187f1a179ca5967bf96f
Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50009
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | chip/stm32/i2c-stm32l15x.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/chip/stm32/i2c-stm32l15x.c b/chip/stm32/i2c-stm32l15x.c index dc138ba107..8434db02f2 100644 --- a/chip/stm32/i2c-stm32l15x.c +++ b/chip/stm32/i2c-stm32l15x.c @@ -153,7 +153,9 @@ int i2c_xfer(int port, int slave_addr, const uint8_t *out, int out_bytes, STM32_I2C_CR1_STOP | STM32_I2C_CR1_POS | STM32_I2C_CR1_ACK); - if (out_bytes) { + + /* No out bytes and no in bytes means just check for active */ + if (out_bytes || !in_bytes) { if (!started) { rv = send_start(port, slave_addr); if (rv) |