summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/servo_micro/board.c22
-rw-r--r--board/servo_micro/gpio.inc8
2 files changed, 28 insertions, 2 deletions
diff --git a/board/servo_micro/board.c b/board/servo_micro/board.c
index ebea396a4d..70fdb7f55e 100644
--- a/board/servo_micro/board.c
+++ b/board/servo_micro/board.c
@@ -734,3 +734,25 @@ static void board_init(void)
gpio_set_level(GPIO_SERVO_JTAG_TDO_SEL, 1);
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
+
+/******************************************************************************
+ * Turn down USART before jumping to RW.
+ */
+static void board_jump(void)
+{
+ /*
+ * If we don't shutdown the USARTs before jumping to RW, then when early
+ * RW tries to set the GPIOs to input (or anything other than alternate)
+ * the jump fail on some servo micros.
+ *
+ * It also make sense to shut them down since RW will reinitialize them
+ * in board_init above.
+ */
+ usart_shutdown(&usart2);
+ usart_shutdown(&usart3);
+ usart_shutdown(&usart4);
+
+ /* Shutdown other hardware modules and let RW reinitialize them */
+ usb_spi_enable(&usb_spi, 0);
+}
+DECLARE_HOOK(HOOK_SYSJUMP, board_jump, HOOK_PRIO_DEFAULT);
diff --git a/board/servo_micro/gpio.inc b/board/servo_micro/gpio.inc
index 5780d30f0a..10e411c5f2 100644
--- a/board/servo_micro/gpio.inc
+++ b/board/servo_micro/gpio.inc
@@ -52,9 +52,13 @@ GPIO(USART3_SERVO_RX_DUT_TX, PIN(B, 11), GPIO_INPUT)
/*
* The USART4 (UART3) names are already in use by dut-controls, so they can't
* be easily updated. They are aliased in board.h though.
+ *
+ * Also, these need to be GPIO_ALTERNATE until all servo micro RO images have
+ * the board_jump USART shutdown. After ~2020/06/01 they can move to GPIO_INPUT.
+ * See b/144356961 for more background.
*/
-GPIO(UART3_TX_SERVO_JTAG_TCK, PIN(A, 0), GPIO_INPUT)
-GPIO(UART3_RX_JTAG_BUFFER_TO_SERVO_TDO, PIN(A, 1), GPIO_INPUT)
+GPIO(UART3_TX_SERVO_JTAG_TCK, PIN(A, 0), GPIO_ALTERNATE)
+GPIO(UART3_RX_JTAG_BUFFER_TO_SERVO_TDO, PIN(A, 1), GPIO_ALTERNATE)
/* Unimplemented signals since we are not an EC */
UNIMPLEMENTED(ENTERING_RW)