From 9102494be2821ca3bce1662d8595e8c5e0addae5 Mon Sep 17 00:00:00 2001 From: Wai-Hong Tam Date: Tue, 22 May 2018 15:52:10 -0700 Subject: flash_ec: stm32/npcx_uut: Set ec_boot_mode to off on exit The ec_boot_mode is used for flashing EC on STM32 and NPCX chips. The ec_boot_mode pin is an open-drain GPIO. Doing save/restore is destructive. For example, if DUT is unpowered (ec_boot_mode is "on"), doing save/restore will force it outputting to "on". We should not put it to the save/restore list. Instead, set it back to "off" on exit. BRANCH=none BUG=b:80305869 TEST=Ran flash_ec when DUT is unpowered -> failed as expected. Reran again when powered. Checked EC UART showed-up afterward. Change-Id: Iecf4b663fe9ae75a673a29a66505a4121d29888c Signed-off-by: Wai-Hong Tam Reviewed-on: https://chromium-review.googlesource.com/1073646 Reviewed-by: Aseda Aboagye Reviewed-by: Vincent Palatin --- util/flash_ec | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/util/flash_ec b/util/flash_ec index d78dc3f142..c6342a6f64 100755 --- a/util/flash_ec +++ b/util/flash_ec @@ -499,6 +499,9 @@ cleanup() { fi fi + if [ "${CHIP}" == "stm32" -o "${CHIP}" == "npcx_uut" ] ; then + dut_control ${MCU}_boot_mode:off + fi if [[ "${SERVO_TYPE}" =~ "ccd_cr50" ]] ; then dut_control ccd_ec_boot_mode_uut:off dut_control ccd_ec_boot_mode_bitbang:off @@ -596,22 +599,18 @@ servo_v4_with_ccd_cr50_VARS="cold_reset" # Flashing an STM32 over the UART requires modifying the UART properties along # with the boot mode pin. if [ "${CHIP}" = "stm32" ] ; then - common_stm32_VARS=" ${MCU}_boot_mode ${MCU}_uart_parity" + common_stm32_VARS=" ${MCU}_uart_parity" common_stm32_VARS+=" ${MCU}_uart_baudrate" servo_v2_VARS+=$common_stm32_VARS servo_v2_VARS+=" ${MCU}_uart_en" servo_micro_VARS+=$common_stm32_VARS servo_micro_VARS+=" ${MCU}_uart_en" servo_v4_with_ccd_cr50_VARS+=$common_stm32_VARS - servo_v4_with_ccd_cr50_VARS+=" ec_uart_bitbang_en ccd_ec_boot_mode_uut" fi if $(in_array "${BOARDS_STM32_PROG_EN[@]}" "${BOARD}"); then servo_v2_VARS+=" prog_en" fi if [ "${CHIP}" = "npcx_uut" ] ; then - servo_v2_VARS+=" ${MCU}_boot_mode" - servo_micro_VARS+=" ${MCU}_boot_mode" - servo_v4_with_ccd_cr50_VARS+=" ccd_${MCU}_boot_mode_uut" servo_v4_with_ccd_cr50_VARS+=" ccd_keepalive_en" fi toad_VARS="${MCU}_uart_parity ${MCU}_uart_baudrate boot_mode" -- cgit v1.2.1