summaryrefslogtreecommitdiff
path: root/board/servo_micro/board.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/servo_micro/board.c')
-rw-r--r--board/servo_micro/board.c22
1 files changed, 22 insertions, 0 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);