flash_ec: Set NEED_SERVO according to chip name instead of board name

One can pass either a board name (e.g. hammer) or a chip name (stm32)
to the flash_ec command. If given a board name, will map to a proper
chip name and then call its chip-flashing method.

The NEED_SERVO variable ("no" if servo not needed) was set according
to the board name. It was broken if only given a chip name. It should
be set according to the chip name.

BUG=b:68943874
BRANCH=None
TEST=Flashed the Staff firmware
SERVO $ dut-control ec_boot_mode:on
DUT   $ ectool gpioset PP3300_DX_BASE 0
DUT   $ ectool gpioset PP3300_DX_BASE 1
DUT   $ flash_ec --chip stm32_dfu --image staff_ec.bin
SERVO $ dut-control ec_boot_mode:off
DUT   $ ectool gpioset PP3300_DX_BASE 0
DUT   $ ectool gpioset PP3300_DX_BASE 1

Change-Id: I1799f083115bfdf203a405733c5baefadbe3fe3e
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/755614
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
This commit is contained in:
Wai-Hong Tam
2017-11-06 11:26:25 -08:00
committed by chrome-bot
parent f48cf0e8b2
commit fca1b7b710

View File

@@ -224,7 +224,6 @@ elif $(in_array "${BOARDS_STM32[@]}" "${BOARD}"); then
CHIP="stm32"
elif $(in_array "${BOARDS_STM32_DFU[@]}" "${BOARD}"); then
CHIP="stm32_dfu"
NEED_SERVO="no"
elif $(in_array "${BOARDS_NPCX_5M5G_JTAG[@]}" "${BOARD}"); then
CHIP="npcx_5m5g_jtag"
elif $(in_array "${BOARDS_NPCX_5M6G_JTAG[@]}" "${BOARD}"); then
@@ -241,7 +240,6 @@ elif $(in_array "${BOARDS_MEC1322[@]}" "${BOARD}"); then
CHIP="mec1322"
elif $(in_array "${BOARDS_IT83XX[@]}" "${BOARD}"); then
CHIP="it83xx"
NEED_SERVO="no"
elif [ -n "${FLAGS_chip}" ]; then
CHIP="${FLAGS_chip}"
else
@@ -252,6 +250,10 @@ if [ -n "${FLAGS_chip}" -a "${CHIP}" != "${FLAGS_chip}" ]; then
die "board ${BOARD} doesn't use chip ${FLAGS_chip}"
fi
if [ "${CHIP}" = "stm32_dfu" -o "${CHIP}" = "it83xx" ]; then
NEED_SERVO="no"
fi
servo_has_warm_reset() {
dut_control warm_reset >/dev/null 2>&1
}