summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Broch <tbroch@chromium.org>2014-05-14 18:17:04 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-05-19 20:25:43 +0000
commitd67b9f39556fd3814527ec322eb374c6f2b569ee (patch)
tree37eb1ce9990edececd6285b84ddb1168b29566c6
parent1fc8e6368151da0480f587afebdb3cd185c5f099 (diff)
downloadchrome-ec-d67b9f39556fd3814527ec322eb374c6f2b569ee.tar.gz
Implicitly decide uart_prefix based on board.
Signed-off-by: Todd Broch <tbroch@chromium.org> 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 <vpalatin@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org> Commit-Queue: Todd Broch <tbroch@chromium.org>
-rwxr-xr-xutil/flash_ec28
1 files 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