diff options
author | Namyoon Woo <namyoon@chromium.org> | 2019-02-20 15:35:13 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-03-01 19:50:17 -0800 |
commit | 68c9b61f711b4d4139fc186651e7d59006de720a (patch) | |
tree | 7b735e5247ac972ea9cdacd39c8e9c4d9ed000d3 | |
parent | ecde7fe66ceb8f5547b14a8d10ce7f5bf6446b84 (diff) | |
download | chrome-ec-68c9b61f711b4d4139fc186651e7d59006de720a.tar.gz |
iteflash: relocate "disable watchdog"
Watchdog should be disabled no matter iteflash sent the special
waveform or not.
BUG=b:124976364
BRANCH=none
TEST=manually ran iteflash or flash_ec on duts with ITE EC.
[Bip with Servo V2]
$ ./util/flash_ec --board=bip --image ${IMG}
[Bip with CCD without ServoD]
<send 0x00 at 0xF0 address to trigger special waveform>
$ ./build/bip/util/iteflash -W 0 -c ccd -e -w ${IMG} -m
[Bip with CCD without ServoD]
$ ./build/bip/util/iteflash -W 1 -c ccd -e -w ${IMG} -m
[DragonEgg with Servo V2]
$ ./util/flash_ec --board=dragonegg --image ${IMG}
[DragonEgg with CCD without ServoD]
<send 0x00 at 0xF0 address to trigger special waveform>
$ ./build/dragonegg/util/iteflash -W 0 -c ccd -e -w ${IMG}
[DragonEgg with CCD without ServoD]
$ ./build/dragonegg/util/iteflash -W 1 -c ccd -e -w ${IMG}
Change-Id: I29ab2a4073e21c6d5c16c8dc8166b81c9630a404
Signed-off-by: Namyoon Woo <namyoon@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1479874
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Matthew Blecker <matthewb@chromium.org>
-rw-r--r-- | util/iteflash.c | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/util/iteflash.c b/util/iteflash.c index 42de8e982c..5993af67e0 100644 --- a/util/iteflash.c +++ b/util/iteflash.c @@ -533,9 +533,9 @@ static int dbgr_disable_watchdog(struct common_hnd *chnd) ret |= i2c_write_byte(chnd, 0x30, 0x30); if (ret < 0) - printf("DBGR DISABLE WATCHDOG FAILED!\n"); + fprintf(stderr, "DBGR DISABLE WATCHDOG FAILED!\n"); - return 0; + return ret; } /* disable protect path from DBGR */ @@ -550,9 +550,9 @@ static int dbgr_disable_protect_path(struct common_hnd *chnd) } if (ret < 0) - printf("DISABLE PROTECT PATH FROM DBGR FAILED!\n"); + fprintf(stderr, "DISABLE PROTECT PATH FROM DBGR FAILED!\n"); - return 0; + return ret; } /* Enter follow mode and FSCE# high level */ @@ -883,12 +883,6 @@ static int send_special_waveform(struct common_hnd *chnd) * loop. */ ret = check_chipid(chnd); - - /* disable watchdog before programming sequence */ - if (!ret) { - dbgr_disable_watchdog(chnd); - dbgr_disable_protect_path(chnd); - } } else { ret = -1; if (!(iterations % max_iterations)) @@ -1584,6 +1578,26 @@ static int ftdi_i2c_interface_post_waveform(struct common_hnd *chnd) return 0; } +static int interface_post_waveform(struct common_hnd *chnd) +{ + int ret; + + printf("Performing post special waveform work...\n"); + + if (chnd->conf.i2c_if->interface_post_waveform) + ret = chnd->conf.i2c_if->interface_post_waveform(chnd); + + /* disable watchdog before programming sequence */ + ret = dbgr_disable_watchdog(chnd); + if (ret < 0) + return ret; + + ret = dbgr_disable_protect_path(chnd); + if (ret < 0) + return ret; + return ret; +} + /* Close the FTDI USB handle */ static int ftdi_i2c_interface_shutdown(struct common_hnd *chnd) { @@ -1837,8 +1851,7 @@ int main(int argc, char **argv) } } - if (chnd.conf.i2c_if->interface_post_waveform && - chnd.conf.i2c_if->interface_post_waveform(&chnd)) + if (interface_post_waveform(&chnd)) goto terminate; if (chnd.conf.input_filename) { |