summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Broch <tbroch@chromium.org>2014-05-14 14:08:11 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-05-19 20:25:40 +0000
commit1fc8e6368151da0480f587afebdb3cd185c5f099 (patch)
tree22d7c2c9d700c65783ae0456bbfbc8154a15840d
parent4cb6971dafd7efb3476dfc45aad60c321b99cd84 (diff)
downloadchrome-ec-1fc8e6368151da0480f587afebdb3cd185c5f099.tar.gz
Add uart_prefix flag to control which uart is used to flash.
There are CrOS devices that have multiple embedded controllers and therefore multiple uarts that can be used for programming. This CL allows user to set the uart_prefix to access the alternate uarts via the --uart_prefix argument. Default is still 'ec'. Signed-off-by: Todd Broch <tbroch@chromium.org> BRANCH=none BUG=chrome-os-partner:28826 TEST=util/flash_ec --board=samus_pd --uart_prefix=usbpd Change-Id: I9fbe8d13067b7f514447645b2587dda706445661 Reviewed-on: https://chromium-review.googlesource.com/199900 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_ec14
1 files changed, 8 insertions, 6 deletions
diff --git a/util/flash_ec b/util/flash_ec
index 1a64ab409e..59a28a6534 100755
--- a/util/flash_ec
+++ b/util/flash_ec
@@ -18,6 +18,8 @@ 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" \
+ "Prefix name (ec|usbpd) to prepend to various UART servo controls."
DEFINE_boolean unprotect "${FLAGS_FALSE}" \
"Clear the protect flag."
@@ -113,7 +115,7 @@ DUT_CONTROL_CMD="dut-control --port=${FLAGS_port}"
# Find the EC UART on the servo v2
function ec_uart() {
SERVOD_FAIL="Cannot communicate with servo. is servod running ?"
- ($DUT_CONTROL_CMD ec_uart_pty || \
+ ($DUT_CONTROL_CMD ${FLAGS_uart_prefix}_uart_pty || \
die "${SERVOD_FAIL}") | cut -d: -f2
}
@@ -183,10 +185,10 @@ function flash_stm32() {
free_pty ${EC_UART}
if [ "${SERVO_TYPE}" = "servo" ] ; then
- dut_control ec_uart_en:on
+ dut_control ${FLAGS_uart_prefix}_uart_en:on
fi
- dut_control ec_uart_parity:even
- dut_control ec_uart_baudrate:115200
+ dut_control ${FLAGS_uart_prefix}_uart_parity:even
+ dut_control ${FLAGS_uart_prefix}_uart_baudrate:115200
# Force the EC to boot in serial monitor mode
ec_enable_boot0
# Reset the EC
@@ -231,10 +233,10 @@ function flash_lm4() {
}
IMG="$(ec_image)"
-info "Using EC image : ${IMG}"
+info "Using ${FLAGS_uart_prefix} image : ${IMG}"
EC_UART="$(ec_uart)"
-info "EC UART pty : ${EC_UART}"
+info "${FLAGS_uart_prefix} UART pty : ${EC_UART}"
if dut_control boot_mode 2>/dev/null ; then
SERVO_TYPE=toad