summaryrefslogtreecommitdiff
path: root/chip
diff options
context:
space:
mode:
authorNamyoon Woo <namyoon@chromium.org>2019-12-27 10:32:23 -0800
committerCommit Bot <commit-bot@chromium.org>2020-02-08 04:08:18 +0000
commit1411a256089ad45a99a2e327972bc6f732f5a6e9 (patch)
tree4049582527aade9d95ac4012b2d06a6a5d5f2f7f /chip
parent341cc2da402e23dc9ff09072058f79d5ec0c40c6 (diff)
downloadchrome-ec-1411a256089ad45a99a2e327972bc6f732f5a6e9.tar.gz
make DIOB3 interruptible and wakable for EC-EFS2
If the board supports EC-CR50 communication, Cr50 enables both rising/falling-edge triggered interrupt on DIOB3 pin and makes it wakable as well.Cr50 connects GPIO_AP_FLASH_SELECT to DIOB4. If the board does not support EC-CR50 communication, Cr50 connects GPIO_AP_FLASH_SELECT to DIOB3. If EC puts high on DIOB3 to activate EC-CR50 communication, CR50 enables UART_EC RX and TX. BUG=chromium:1035706 BRANCH=cr50 TEST=none Change-Id: I1221a1a19219274622ab710568ce7c66ab2f1da7 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1989581 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r--chip/g/usart.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/chip/g/usart.c b/chip/g/usart.c
index 0a08d261b8..d7ca39ea14 100644
--- a/chip/g/usart.c
+++ b/chip/g/usart.c
@@ -134,6 +134,15 @@ void get_data_from_usb(struct usart_config const *config)
struct queue const *uart_out = config->consumer.queue;
int c;
+#ifdef BOARD_CR50
+ /*
+ * If EC-CR50 communication is on-going, then let's not forward
+ * console input to EC for now.
+ */
+ if (ec_comm_is_uart_in_packet_mode(config->uart))
+ return;
+#endif
+
/* Copy output from buffer until TX fifo full or output buffer empty */
while (queue_count(uart_out) && QUEUE_REMOVE_UNITS(uart_out, &c, 1))
uartn_write_char(config->uart, c);
@@ -161,6 +170,13 @@ void send_data_to_usb(struct usart_config const *config)
tail = uart_in->state->tail & mask;
count = 0;
+ /*
+ * TODO(b/119329144): Process packet data separately,
+ * and filter console data based on ccd capability.
+ * if (ec_comm_is_uart_in_packet_mode(uart))
+ * ...
+ */
+
while ((count != q_room) && uartn_rx_available(uart)) {
uart_in->buffer[tail] = uartn_read_char(uart);
tail = (tail + 1) & mask;