summaryrefslogtreecommitdiff
path: root/util/ectool.c
diff options
context:
space:
mode:
authorTodd Broch <tbroch@chromium.org>2015-01-07 14:29:55 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-01-08 21:03:38 +0000
commita5a2b263f8330f3c5bc535a2f6388b612cb9b4eb (patch)
tree222db65fe7ee2b566e8e5aa9719c69086ddd95f6 /util/ectool.c
parentd63c3b4f92a578212977bfe537f9d15f6f84be72 (diff)
downloadchrome-ec-a5a2b263f8330f3c5bc535a2f6388b612cb9b4eb.tar.gz
pd: Return immediately to host from erase RW.
With CL: 5ef45ad pd: Add timeout for HC flash commands. I thought I'd licked the timeout related issues with flashing dingdong & hoho. With further testing however I found I was occassionally hitting the failure where I couldn't return from 'flash erase' on PD peripheral prior to the 1 second limit for host command timeout. That could be remedied by retrying the erase on the host side which then succeeds quickly. That solution seems non-optimal however. Additionally, even when erase does succeed in <1sec we have the shared i2c bus pending. That too is non-optimal. For those reasons I've decide to return immediately from flash erase command and instead put the burden of waiting the necessary time on the host which at least does have some wider perspective on what the system is attached to and doing. CL also adds following related changes: 1. corresponding ectool edit to delay 3sec after RW erase. 2. fixup to error returns from hc_remote_flash for timeouts. Signed-off-by: Todd Broch <tbroch@chromium.org> BRANCH=samus BUG=chrome-os-partner:33947 TEST=flashing dingdong/hoho via ectool works reliably. Change-Id: I8fbfb592f760273b26bcb16b67210d569454eee2 Reviewed-on: https://chromium-review.googlesource.com/239253 Trybot-Ready: Todd Broch <tbroch@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Todd Broch <tbroch@chromium.org>
Diffstat (limited to 'util/ectool.c')
-rw-r--r--util/ectool.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/util/ectool.c b/util/ectool.c
index 8a5e63a9f4..4509951dbd 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -949,6 +949,9 @@ int cmd_flash_pd(int argc, char *argv[])
rv = ec_command(EC_CMD_USB_PD_FW_UPDATE, 0,
p, p->size + sizeof(*p), NULL, 0);
+ /* 3 secs should allow ample time for 2KB page erases at 40ms */
+ usleep(3000000);
+
if (rv < 0)
goto pd_flash_error;