summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2015-06-03 15:57:30 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-06-04 01:15:50 +0000
commit45f7ddadd176f470c6cc8eb02b9dfaa08a573673 (patch)
tree88a007f071013ef8063e8930af422b245307c2f2
parent7b5c67609f69998f7bff163f6cea3931ac31f5ed (diff)
downloadchrome-ec-45f7ddadd176f470c6cc8eb02b9dfaa08a573673.tar.gz
i2c: fix read-only I2C transfers on STM32F0/F3
Ensure that we put a proper start bit if the transfer only contains a read but has the start flag set. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=smaug BUG=chrome-os-partner:40919 TEST=On Smaug (P6), at the Linux prompt, do "cat /sys/class/power_supply/bq27742-0/current_now" and see a proper value rather than an error. Change-Id: I10cc9907476b3cfb006f2c1540688139366c9195 Reviewed-on: https://chromium-review.googlesource.com/275079 Trybot-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Puthikorn Voravootivat <puthik@chromium.org>
-rw-r--r--chip/stm32/i2c-stm32f0.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/chip/stm32/i2c-stm32f0.c b/chip/stm32/i2c-stm32f0.c
index 1dfe7d9b36..dc9d295ae0 100644
--- a/chip/stm32/i2c-stm32f0.c
+++ b/chip/stm32/i2c-stm32f0.c
@@ -421,7 +421,7 @@ int chip_i2c_xfer(int port, int slave_addr, const uint8_t *out, int out_bytes,
| STM32_I2C_CR2_RD_WRN | slave_addr
| (xfer_stop ? STM32_I2C_CR2_AUTOEND : 0)
| (!xfer_stop ? STM32_I2C_CR2_RELOAD : 0)
- | (out_bytes ? STM32_I2C_CR2_START : 0);
+ | (out_bytes || xfer_start ? STM32_I2C_CR2_START : 0);
for (i = 0; i < in_bytes; i++) {
/* Wait for receive buffer not empty */