summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2017-12-27 13:50:16 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-01-04 21:52:01 -0800
commit51b62225209ca041749b3074db4cf4d10bd28b40 (patch)
tree0d50a3051ad88d6552d232e102912da9fd99c9f8
parent6bbb5adab171d473f38f1ad9f8f0a1dafff30146 (diff)
downloadchrome-ec-51b62225209ca041749b3074db4cf4d10bd28b40.tar.gz
npcx/uart: Pull up communication line during transaction
Boards needs to define GPIO_EC_COMM_PU, which needs to be driven high during EC-EC transaction. This makes sure that the line does not go low, even when the base goes away during the transaction. BRANCH=none BUG=b:68954760 TEST=EC-EC communication works with this change. TEST=With signal analyzer, check that UART line is always kept high while transaction is in progress. Change-Id: Iad7b26a9a93b674aa4fff0bc3a72a13e6782515d Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/845544 Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--chip/npcx/uart.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/chip/npcx/uart.c b/chip/npcx/uart.c
index b7df104dbe..066c19b34a 100644
--- a/chip/npcx/uart.c
+++ b/chip/npcx/uart.c
@@ -326,6 +326,13 @@ int uart_alt_pad_write_read(uint8_t *tx, int tx_len, uint8_t *rx, int rx_len,
altpad_tx_pos = 0;
altpad_tx_len = tx_len;
+ /*
+ * Turn on additional pull-up during transaction: that prevents the line
+ * from going low in case the base gets disconnected during the
+ * transaction. See b/68954760.
+ */
+ gpio_set_flags(GPIO_EC_COMM_PU, GPIO_OUTPUT | GPIO_HIGH);
+
uart_set_pad(UART_ALTERNATE_PAD);
gpio_clear_pending_interrupt(GPIO_UART_MAIN_RX);
gpio_enable_interrupt(GPIO_UART_MAIN_RX);
@@ -354,6 +361,8 @@ int uart_alt_pad_write_read(uint8_t *tx, int tx_len, uint8_t *rx, int rx_len,
ret = -EC_ERROR_TIMEOUT;
out:
+ gpio_set_flags(GPIO_EC_COMM_PU, GPIO_INPUT);
+
altpad_rx_len = 0;
altpad_rx_pos = 0;
altpad_rx_buf = NULL;