summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorNamyoon Woo <namyoon@chromium.org>2019-05-06 18:13:40 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-05-08 19:35:14 -0700
commitd73bd949c0ff86a1881c5ac1ee07a45d9c311bbc (patch)
tree05709dfd7445baf15576e1c0ab8eb60806b90846 /util
parent608e6a4ca4a8cb46004db986f8b71c81b99b7786 (diff)
downloadchrome-ec-d73bd949c0ff86a1881c5ac1ee07a45d9c311bbc.tar.gz
flash_ec: fix in restoring "fw_up" control
crrev.com/c/1593817 falsely restored "fw_up" at exit. It was supposed to restore "fw_up" as "off" unconditionally , but it restored with the initial value at the beginning of flash_ec. Fixed it by specifying the recovery value in the function servo_save_add(). BUG=b:132097230 BRANCH=None TEST=manually ran flash_ec on atlas via servo_v2. ./util/flash_ec --board atlas --image /Downloads/atlas/ec.bin --verbose INFO: Using servo_v2. INFO: Using ec image : /Downloads/atlas/ec.bin dut-control --port=9999 i2c_mux_en:on dut-control --port=9999 i2c_mux:remote_adc INFO: Flashing chip npcx_int_spi. dut-control --port=9999 cold_reset:on dut-control --port=9999 fw_up:on dut-control --port=9999 cold_reset:off dut-control --port=9999 spi1_vref:pp3300 spi1_buf_en:on dut-control --port=9999 spi1_buf_on_flex_en:on ... Erasing and writing flash chip... Verifying flash... VERIFIED. SUCCESS INFO: Restoring servo settings... dut-control --port=9999 cold_reset:off dut-control --port=9999 i2c_mux_en:on dut-control --port=9999 i2c_mux:remote_adc dut-control --port=9999 fw_up:off <--- It is recovered as 'off'. dut-control --port=9999 spi1_vref:off dut-control --port=9999 spi1_buf_en:off dut-control --port=9999 spi1_buf_on_flex_en:off dut-control --port=9999 cold_reset:on dut-control --port=9999 cold_reset:off Change-Id: I423b921fd54f59a5e3538d1fbdd0fb6b09632625 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1597798 Reviewed-by: Matthew Blecker <matthewb@chromium.org>
Diffstat (limited to 'util')
-rwxr-xr-xutil/flash_ec26
1 files changed, 20 insertions, 6 deletions
diff --git a/util/flash_ec b/util/flash_ec
index f90df069bf..a1bcc2cbef 100755
--- a/util/flash_ec
+++ b/util/flash_ec
@@ -614,8 +614,22 @@ servo_v4_with_servo_micro_VARS=( "${servo_micro_VARS[@]}" )
toad_VARS=( "boot_mode" )
declare -a save
+
+#######################################
+# Store DUT control value to restore.
+# Arguments:
+# $1: Control name
+# $2: (optional) Value to restore for the name at exit.
+#######################################
function servo_save_add() {
- save+=( "$( "${DUT_CONTROL_CMD[@]}" "$@" )" )
+ case $# in
+ 1) save+=( "$( "${DUT_CONTROL_CMD[@]}" "$@" )" )
+ ;;
+ 2) save+=( "$1:$2" )
+ ;;
+ *) die "${FUNCNAME[0]} failed: arguments error"
+ ;;
+ esac
}
function servo_save() {
@@ -760,7 +774,7 @@ function flash_flashrom() {
# If spi flash is in npcx's ec, enable gang programer mode
if [[ "${CHIP}" == "npcx_int_spi" ]]; then
- servo_save_add "fw_up"
+ servo_save_add "fw_up" "off"
# Set GP_SEL# as low then start ec
dut_control fw_up:on
@@ -768,19 +782,19 @@ function flash_flashrom() {
dut_control cold_reset:off
fi
- servo_save_add "spi1_vref"
- servo_save_add "spi1_buf_en"
+ servo_save_add "spi1_vref" "off"
+ servo_save_add "spi1_buf_en" "off"
# Turn on SPI1 interface on servo for SPI Flash Chip
dut_control spi1_vref:${SPI_VOLTAGE} spi1_buf_en:on
if [[ ! "${SERVO_TYPE}" =~ "servo_micro" ]]; then
# Servo micro doesn't support this control.
- servo_save_add "spi1_buf_on_flex_en"
+ servo_save_add "spi1_buf_on_flex_en" "off"
dut_control spi1_buf_on_flex_en:on
fi
else
if [[ "${CHIP}" == "npcx_int_spi" ]]; then
- servo_save_add "fw_up"
+ servo_save_add "fw_up" "off"
# Set GP_SEL# as low then start ec
dut_control cold_reset:on