summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2014-08-12 22:52:00 -0500
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-08-14 20:28:48 +0000
commit776658d8a23911d3123742008fd4ba1e9b33665e (patch)
tree2aaf7b81c07b033202fd3c0d498f6b6983f5e368
parent80f5d9e10a04f3fc4234fce304ba742aee16c1f9 (diff)
downloadchrome-ec-776658d8a23911d3123742008fd4ba1e9b33665e.tar.gz
stfm32f0: always send bytes over i2c for EC command responses
Certain i2c host drivers don't allow one to snoop the byte stream to abort a transaction. Allow those devices to make forward progress by sending out the '0xec' byte for any requests coming through after an EC host command error. BUG=chrome-os-partner:30784 BRANCH=None TEST=Ran on ryu. Allowed passthru probing which normally hung the system because of there not being a passthrue device on ryu -- error returned. Instead the command returns successfully by returning 0xec for the unfilled bytes. Change-Id: Ibcab5ade1f727f3852995437105eb9fa693caadf Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/212165 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--chip/stm32/i2c-stm32f0.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/chip/stm32/i2c-stm32f0.c b/chip/stm32/i2c-stm32f0.c
index 1a289393d4..11dd4c7ba4 100644
--- a/chip/stm32/i2c-stm32f0.c
+++ b/chip/stm32/i2c-stm32f0.c
@@ -153,6 +153,14 @@ static void i2c_send_response_packet(struct host_packet *pkt)
/* I2C is slow, so let other things run while we wait */
usleep(50);
}
+
+ /*
+ * If an error occurred. Set the transmitter not full so as to keep
+ * sending '0xec' in the event loop. That way the master doesn't have
+ * to snoop the response stream.
+ */
+ if (pkt->driver_result != EC_RES_SUCCESS)
+ STM32_I2C_CR1(host_i2c_resp_port) |= STM32_I2C_CR1_TXIE;
}
/* Process the command in the i2c host buffer */