From d67b9f39556fd3814527ec322eb374c6f2b569ee Mon Sep 17 00:00:00 2001 From: Todd Broch Date: Wed, 14 May 2014 18:17:04 -0700 Subject: Implicitly decide uart_prefix based on board. Signed-off-by: Todd Broch BRANCH=none BUG=chrome-os-partner:28826 TEST=manual util/flash_ec --board=samus_pd - See uart_prefix is 'usbpd' util/flash_ec --board=rambi - See uart_prefix is 'ec' Change-Id: Iba14fd0635d72413e48d45992c852393301b3f6b Reviewed-on: https://chromium-review.googlesource.com/199939 Reviewed-by: Vincent Palatin Tested-by: Todd Broch Commit-Queue: Todd Broch --- util/flash_ec | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/util/flash_ec b/util/flash_ec index 59a28a6534..7ac60bd5f2 100755 --- a/util/flash_ec +++ b/util/flash_ec @@ -18,7 +18,7 @@ DEFINE_integer port 9999 \ "Port to communicate to servo on." DEFINE_boolean ro "${FLAGS_FALSE}" \ "Write only the read-only partition" -DEFINE_string uart_prefix "ec" \ +DEFINE_string uart_prefix "" \ "Prefix name (ec|usbpd) to prepend to various UART servo controls." DEFINE_boolean unprotect "${FLAGS_FALSE}" \ "Clear the protect flag." @@ -120,10 +120,17 @@ function ec_uart() { } # Servo variables management +if [[ -z $FLAGS_uart_prefix ]] ; then + case "${BOARD}" in + samus_pd ) FLAGS_uart_prefix="usbpd" ;; + *) FLAGS_uart_prefix="ec" ;; + esac +fi -servo_VARS="ec_uart_en ec_uart_parity ec_uart_baudrate \ -jtag_buf_on_flex_en jtag_buf_en spi1_vref" -toad_VARS="ec_uart_parity ec_uart_baudrate boot_mode" +servo_VARS="${FLAGS_uart_prefix}_uart_en ${FLAGS_uart_prefix}_uart_parity \ +${FLAGS_uart_prefix}_uart_baudrate jtag_buf_on_flex_en jtag_buf_en spi1_vref" +toad_VARS="${FLAGS_uart_prefix}_uart_parity \ +${FLAGS_uart_prefix}_uart_baudrate boot_mode" function dut_control() { $DUT_CONTROL_CMD "$1" >/dev/null @@ -232,17 +239,20 @@ function flash_lm4() { die "Failed to program ${IMG}" } +if dut_control boot_mode 2>/dev/null ; then + if [[ "${FLAGS_uart_prefix}" != "ec" ]] ; then + die "Toad cable can't support non-ec UARTs" + fi + SERVO_TYPE=toad + info "Using a dedicated debug cable" +fi + IMG="$(ec_image)" info "Using ${FLAGS_uart_prefix} image : ${IMG}" EC_UART="$(ec_uart)" info "${FLAGS_uart_prefix} UART pty : ${EC_UART}" -if dut_control boot_mode 2>/dev/null ; then - SERVO_TYPE=toad - info "Using a dedicated debug cable" -fi - save="$(servo_save)" case "${BOARD}" in -- cgit v1.2.1