summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNamyoon Woo <namyoon@chromium.org>2019-03-06 16:20:12 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-03-07 20:22:17 -0800
commit19ffcaeb4176e26acf1a1c3f471ca3da9343a1ac (patch)
tree44918873c172183fd13bc82248faea4bcf609ce0
parent2b2238cee00c252b4e6334d908ba76d73d605739 (diff)
downloadchrome-ec-19ffcaeb4176e26acf1a1c3f471ca3da9343a1ac.tar.gz
flash_ec: enable i2c_mux before it uses I2C interface
This is for it83xx EC. i2c_mux should be enabled before it does dut-control jtag_buf_on_flex_en , which uses i2c interface. Also during cleanup, servo setting should be restored after ftdii2c initialization and i2c_mux enabling. BUG=b:127696997 BRANCH=none TEST=ran flash_ec on Ampel with servo_v2 or Suzy-Q - servo_v2: http://gpaste/4877399499997184 - Suzy-Q: http://gpaste/5150426007601152 Tested with a fake board name for servod, and flash_ec without --board and --chip. $ ./util/flash_ec --image /tmp/a --verbose ERROR: Please check that servod is running or \ manually specify either --board or --chip. Tested without launching servod: ./util/flash_ec --board=coral --image /tmp/a --verbose Connection refused dut-control --port=9999 servo_type Connection refused ERROR: board 'coral' not supported. Please check \ that servod is running, or manually specify --chip. Change-Id: I8106c2f08fd74c8d86c985562cd4e1771df65287 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1506446 Reviewed-by: Matthew Blecker <matthewb@chromium.org>
-rwxr-xr-xutil/flash_ec29
1 files changed, 17 insertions, 12 deletions
diff --git a/util/flash_ec b/util/flash_ec
index 9fba33d245..81bbf79602 100755
--- a/util/flash_ec
+++ b/util/flash_ec
@@ -202,7 +202,8 @@ fi
if [[ -z "${FLAGS_board}" && -z "${FLAGS_chip}" && \
-z "${SERVO_EC_CHIP}" ]]; then
- die "should specify a board or a chip."
+ die "Please check that servod is running or," \
+ "manually specify either --board or --chip."
fi
BOARD=${FLAGS_board}
@@ -271,7 +272,8 @@ if [[ ${#SUPPORTED_CHIPS[@]} -eq 0 ]]; then
# This happens if ${FLAGS_board} is not known in this flash_ec yet,
# ${FLAGS_chip} is not given, and servod doesn't know ec_chip.
# In this case, '--chip' should be specified in the command line.
- die "board '${BOARD}' not supported. Please manually specify --chip="
+ die "board '${BOARD}' not supported." \
+ "Please check that servod is running, or manually specify --chip."
elif [[ ${#SUPPORTED_CHIPS[@]} -eq 1 ]]; then
CHIP="${SUPPORTED_CHIPS[0]}"
elif [ -n "${FLAGS_chip}" ]; then
@@ -448,11 +450,6 @@ on_raiden() {
# Put back the servo and the system in a clean state at exit
FROZEN_PIDS=""
cleanup() {
- if [ -n "${save}" ]; then
- info "Restoring servo settings..."
- servo_restore "$save"
- fi
-
for pid in ${FROZEN_PIDS}; do
info "Sending SIGCONT to process ${pid}!"
kill -CONT ${pid}
@@ -472,7 +469,14 @@ cleanup() {
dut_control i2c_mux_en:on
dut_control i2c_mux:remote_adc
fi
+ fi
+
+ if [ -n "${save}" ]; then
+ info "Restoring servo settings..."
+ servo_restore "$save"
+ fi
+ if [[ "${CHIP}" == "it83xx" ]]; then
# Reset the dut mux if it exists
servo_has_dut_i2c_mux && dut_control dut_i2c_mux:none
@@ -481,6 +485,7 @@ cleanup() {
dut_control i2c_mux_en:off
fi
fi
+
if [ "${CHIP}" == "stm32" -o "${CHIP}" == "npcx_uut" ] ; then
# Reconnect the EC-3PO interpreter to the UART.
dut_control ${MCU}_ec3po_interp_connect:on || \
@@ -620,6 +625,11 @@ servo_v3_VARS="${servo_v2_VARS}"
servo_v4_with_servo_micro_VARS="${servo_micro_VARS}"
function servo_save() {
+ if [[ "${CHIP}" == "it83xx" && "${SERVO_TYPE}" =~ "servo_v2" ]]; then
+ dut_control i2c_mux_en:on
+ dut_control i2c_mux:remote_adc
+ fi
+
SERVO_VARS_NAME=${SERVO_TYPE}_VARS
if [[ -n "${!SERVO_VARS_NAME}" ]]; then
$DUT_CONTROL_CMD ${!SERVO_VARS_NAME}
@@ -1016,11 +1026,6 @@ function flash_it83xx() {
die "no iteflash util found."
fi
- if [[ "${SERVO_TYPE}" =~ "servo_v2" ]]; then
- dut_control i2c_mux_en:on
- dut_control i2c_mux:remote_adc
- fi
-
# Now the we have enabled the I2C mux on the servo to talk to the dut,
# we need to switch the I2C mux on the dut to allow ec programing (if
# there is a mux on the dut)