diff options
author | Vic Yang <victoryang@google.com> | 2015-02-06 15:48:52 -0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-02-09 03:35:57 +0000 |
commit | d73e8cb9c9d1eea0ce0e0336ff13cd9e67584bce (patch) | |
tree | a69d948a30afd4f87a37a39c8a693ec03defa357 /util | |
parent | 0fc37f1291efa2106f7272fee9920bdb6a058202 (diff) | |
download | chrome-ec-d73e8cb9c9d1eea0ce0e0336ff13cd9e67584bce.tar.gz |
Assert warm reset while flashing STM32 parts
The STM32 bootloader reacts to the first command it sees and then sticks
to that interface. On some devices, the AP is connected to I2C or UART
on the EC, and if the AP talks when we are trying to flash the EC, the
EC sticks to that interface and ignores requests from the servo board.
Fix this by holding warm_reset so that the AP is down.
BRANCH=None
BUG=None
TEST=Flash Ryu several times.
TEST=Flash Plankton to make sure it doesn't break devices without
warm_reset.
Change-Id: I860fc65ba7fdaf0cbc9a0be641148b5095de394b
Signed-off-by: Vic Yang <victoryang@google.com>
Reviewed-on: https://chromium-review.googlesource.com/247360
Tested-by: Vic Yang <victoryang@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@google.com>
Commit-Queue: Vic Yang <victoryang@chromium.org>
Diffstat (limited to 'util')
-rwxr-xr-x | util/flash_ec | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/util/flash_ec b/util/flash_ec index 47d6318aff..3ad4bf514d 100755 --- a/util/flash_ec +++ b/util/flash_ec @@ -140,6 +140,10 @@ in_array() { return 1 } +servo_has_warm_reset() { + dut_control warm_reset >/dev/null 2>&1 +} + # reset the EC toad_ec_hard_reset() { if dut_control cold_reset 2>/dev/null ; then @@ -248,6 +252,10 @@ function ec_image() { DUT_CONTROL_CMD="dut-control --port=${FLAGS_port}" +function dut_control() { + $DUT_CONTROL_CMD "$@" >/dev/null +} + # Find the EC UART on the servo v2 function ec_uart() { SERVOD_FAIL="Cannot communicate with servo. is servod running ?" @@ -274,13 +282,12 @@ fi if $(in_array "${BOARDS_PRIVATE_SPI_PP3300[@]}" "${BOARD}"); then servo_VARS+=" spi1_buf_en spi1_buf_on_flex_en spi_hold" fi +if $(servo_has_warm_reset); then + servo_VARS+=" warm_reset" +fi toad_VARS="${MCU}_uart_parity \ ${MCU}_uart_baudrate boot_mode" -function dut_control() { - $DUT_CONTROL_CMD "$@" >/dev/null -} - function servo_save() { SERVO_VARS_NAME=${SERVO_TYPE}_VARS $DUT_CONTROL_CMD ${!SERVO_VARS_NAME} @@ -360,6 +367,9 @@ function flash_stm32() { fi dut_control ${MCU}_uart_parity:even dut_control ${MCU}_uart_baudrate:115200 + if $(servo_has_warm_reset); then + dut_control warm_reset:on + fi # Force the EC to boot in serial monitor mode ec_enable_boot0 # Reset the EC |