summaryrefslogtreecommitdiff
path: root/board/cr50/ec_comm.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/cr50/ec_comm.c')
-rw-r--r--board/cr50/ec_comm.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/board/cr50/ec_comm.c b/board/cr50/ec_comm.c
index d9b01c92e2..c4a3603c82 100644
--- a/board/cr50/ec_comm.c
+++ b/board/cr50/ec_comm.c
@@ -73,3 +73,26 @@ int ec_comm_is_uart_in_packet_mode(int uart)
{
return uart == ec_comm_ctx.uart;
}
+
+void ec_comm_block(int block)
+{
+ static int is_blocked;
+
+ if (is_blocked == block)
+ return;
+
+ if (block) {
+ gpio_disable_interrupt(GPIO_EC_PACKET_MODE_EN);
+ gpio_disable_interrupt(GPIO_EC_PACKET_MODE_DIS);
+
+ if (ec_comm_is_uart_in_packet_mode(UART_EC))
+ ec_comm_packet_mode_dis(GPIO_EC_PACKET_MODE_DIS);
+ } else {
+ gpio_enable_interrupt(GPIO_EC_PACKET_MODE_EN);
+ gpio_enable_interrupt(GPIO_EC_PACKET_MODE_DIS);
+ }
+
+ is_blocked = block;
+
+ /* Note: ccd_update_state() should be called to change UART status. */
+}