diff options
author | Jett Rink <jettrink@chromium.org> | 2019-11-12 11:18:48 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-11-19 16:38:29 +0000 |
commit | 9a2ff7e3094f10e4376a0306073dadfc7511ace8 (patch) | |
tree | d0531a5dc2b523006931258672343115f3fe2c15 /board | |
parent | 941fb7e8e73ff1cb4e6ed170bee8e755a5416a50 (diff) | |
download | chrome-ec-9a2ff7e3094f10e4376a0306073dadfc7511ace8.tar.gz |
servo_micro: shutdown HW module at sysjump
Some servo micros will fail to jump to RW if we leave the USART hardware
modules active during the RW jump and the RW jump tries to change the
gpio flags to anything other than alternate in gpio.inc.
We would like the state transition from RO to RW to be as clean as
possible, so shutdown the hardware modules that RW will reinitialize in
board_init right after the jump
BRANCH=servo
BUG=b:144356961
TEST=flash this image on a bad servo micro, the remove then change
GPIO_ALTERNATE to GPIO_INPUT and reflash and see that it sauce's fully
flashes from then on
Change-Id: I81fcbbcda9f63761a719f6e0cb6bb4cf6962f18f
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1922240
Tested-by: Brian Nemec <bnemec@chromium.org>
Reviewed-by: Brian Nemec <bnemec@chromium.org>
Reviewed-by: Raul E Rangel <rrangel@chromium.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/servo_micro/board.c | 22 | ||||
-rw-r--r-- | board/servo_micro/gpio.inc | 8 |
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) |