summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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