diff options
author | Jett Rink <jettrink@chromium.org> | 2020-02-19 09:48:06 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-02-27 14:35:48 +0000 |
commit | ce143d577fa85acae86ae372a7521d7def6c2391 (patch) | |
tree | 3ac819ce9d1ac47712238d91e77a47446841821b /util/flash_ec | |
parent | 21f8be7099d57efdcdffd244758861a604202ad8 (diff) | |
download | chrome-ec-ce143d577fa85acae86ae372a7521d7def6c2391.tar.gz |
c2d2: add support for I2C-based flashing
Add necessary console command to allow C2D2 to pass through i2c bus for
ec and ap. Also hook into common ite programming mode code.
BRANCH=servo
BUG=b:148610186,b:147381671
TEST=flash ampton with C2D2 adapter
Change-Id: I1d9b20684b45ff0d101b9cfff8b0b0a85e6c0c70
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2064594
Reviewed-by: David Schneider <dnschneid@chromium.org>
Reviewed-by: Matthew Blecker <matthewb@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'util/flash_ec')
-rwxr-xr-x | util/flash_ec | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/util/flash_ec b/util/flash_ec index a6249e0805..172d3c1f8e 100755 --- a/util/flash_ec +++ b/util/flash_ec @@ -394,6 +394,12 @@ toad_ec_hard_reset() { servo_ec_hard_reset_or_die() { dut_control_or_die cold_reset:on dut_control_or_die cold_reset:off + + # Cold reset on C2D2 is H1 reset, which will double reset the EC + # We need to wait a little bit to ensure we catch final EC reset + if [[ "${SERVO_TYPE}" =~ "c2d2" ]]; then + sleep 0.2 + fi } servo_ec_hard_reset() { @@ -404,6 +410,10 @@ servo_ec_hard_reset() { c2d2_ec_hard_reset() { dut_control cold_reset:on dut_control cold_reset:off + + # Cold reset on C2D2 is H1 reset, which will double reset the EC + # We need to wait a little bit to ensure we catch final EC reset + sleep 0.2 } servo_usbpd_hard_reset() { @@ -696,7 +706,7 @@ toad_VARS=( "boot_mode" ) declare -a save ####################################### -# Store DUT control value to restore. +# Store DUT control value to restore in LIFO order. # Arguments: # $1: Control name # $2: (optional) Value to restore for the name at exit. @@ -710,10 +720,10 @@ function servo_save_add() { # Don't save the control with the prefix, because # dut_control will add the prefix again when we restore # the settings. - save+=( "${CTRL_RESULT#$DUT_CTRL_PREFIX}" ) + save=( "${CTRL_RESULT#$DUT_CTRL_PREFIX}" "${save[@]}" ) fi ;; - 2) save+=( "$1:$2" ) + 2) save=( "$1:$2" "${save[@]}" ) ;; *) die "${FUNCNAME[0]} failed: arguments error" ;; @@ -1166,6 +1176,17 @@ function flash_it83xx() { die "no iteflash util found." fi + # We need to ensure that c2d2 and dut-side path are set up for i2c + if [[ "${SERVO_TYPE}" =~ "c2d2" ]]; then + # We need to swing the DUT-side muxes to I2C instead of UART. + # This is done by convention with EC_FLASH_SELECT pin from H1 + servo_save_add "ec_flash_select" + dut_control_or_die ec_flash_select:on + # Enable i2c bus on C2D2 at 1000kbps + servo_save_add "i2c_ec_bus_speed" + dut_control_or_die i2c_ec_bus_speed:1000 + 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) @@ -1189,9 +1210,9 @@ function flash_it83xx() { fi # Send the special waveform to the ITE EC. - if [[ "${SERVO_TYPE}" =~ "servo_micro" ]]; then - info "Asking Servo Micro to send the dbgr special waveform to "\ -"${CHIP}" + if [[ "${SERVO_TYPE}" =~ "servo_micro" || \ + "${SERVO_TYPE}" =~ "c2d2" ]] ; then + info "Asking servo to send the dbgr special waveform to ${CHIP}" dut_control_or_die enable_ite_dfu elif [[ "${SERVO_TYPE}" =~ "ccd_cr50" ]]; then local CCD_I2C_CAP="$(dut_control_get ccd_i2c_en)" @@ -1324,10 +1345,6 @@ function flash_npcx_uut() { ec_enable_boot0 "uut" ec_reset - # Have to wait a bit for EC boot-up (twice in some cases when the cold - # reset is indirect through h1 reset). - sleep 0.2 - # For CCD, disable the trigger pin for normal UART operation ec_disable_boot0 "uut" sleep 0.1 |