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>
This commit is contained in:
Todd Broch
2014-05-14 14:08:11 -07:00
committed by chrome-internal-fetch
parent 4cb6971daf
commit 1fc8e63681

View File

@@ -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