summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorNamyoon Woo <namyoon@chromium.org>2019-03-15 12:51:23 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-03-26 04:43:43 -0700
commit8d034db01d9ca539240eaa616b983c4df7bb0c26 (patch)
tree041007b12ea31b463dd5bb286915541f9f0c378f /util
parente29edbbf0ec91a2cdd5f36c80fe48181341d6c55 (diff)
downloadchrome-ec-8d034db01d9ca539240eaa616b983c4df7bb0c26.tar.gz
flash_ec: check I2C ccd state before triggering ITE EC DBGR mode
To flash ITE in ccd mode, I2C ccd capability should be set always. This CL makes flash_ec check this condition before it attempts to ask CR50 to send a special waveform which triggers ITE EC DBGR mode. CQ-DEPEND=CL:1524439 BUG=b:123901082 BRANCH=none TEST=manually ran flash_ec on ampton in CCD mode. // Expected to fail , case 1 $ ./util/flash_ec --board=ampton --read /tmp/ec.ampton.read.bin --verbose ... ERROR: CCD I2C capability is not set as 'Always' : IfOpened ... // Expected to fail , case 2 $ ./util/flash_ec --board=ampton --read /tmp/ec.ampton.read.bin --verbose ... ERROR: CCD I2C capability is not set as 'Always' : UnlessLocked ... // Expected to fail , case 3 $ ./util/flash_ec --board=ampton --read /tmp/ec.ampton.read.bin --verbose ... ERROR: CCD I2C capability is not set as 'Always' : Default ... // Expected to success $ ./util/flash_ec --board=ampton --read /tmp/ec.ampton.read.bin --verbose ... 524288 bytes read. INFO: Flashing done. ... Change-Id: I394ea9b6c6e41f0a926f4af5d3767ebba7037f37 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1524669 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Matthew Blecker <matthewb@chromium.org>
Diffstat (limited to 'util')
-rwxr-xr-xutil/flash_ec15
1 files changed, 15 insertions, 0 deletions
diff --git a/util/flash_ec b/util/flash_ec
index 66e4de1a9d..07ee541a96 100755
--- a/util/flash_ec
+++ b/util/flash_ec
@@ -188,6 +188,15 @@ function dut_control_or_die {
dut_control "$@" || die "dut-control $* exited $? (non-zero)"
}
+function dut_control_get() {
+ local DUT_GETVAL=
+ if dut_control "$1" ; then
+ DUT_GETVAL=$(${DUT_CONTROL_CMD} $1)
+ fi
+ # Remove the shortest prefix ending ':'
+ echo "${DUT_GETVAL#*:}"
+ }
+
function get_servo_type() {
if dut_control "servo_type" ; then
$DUT_CONTROL_CMD servo_type | sed -e s/servo_type://
@@ -1121,6 +1130,12 @@ function flash_it83xx() {
"${CHIP}"
dut_control_or_die enable_ite_dfu
elif [[ "${SERVO_TYPE}" =~ "ccd_cr50" ]]; then
+ local CCD_I2C_CAP="$(dut_control_get ccd_i2c_en)"
+ if [[ "${CCD_I2C_CAP,,}" != "always" ]]; then
+ die "CCD I2C capability is not set as 'Always'" \
+ ": ${CCD_I2C_CAP}"
+ fi
+
info "Asking CR50 to send the dbgr special waveform to ${CHIP}"
sleep 2
dut_control_or_die cr50_i2c_ctrl:ite_debugger_mode