summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWei-Ning Huang <wnhuang@google.com>2017-06-24 15:33:11 +0800
committerchrome-bot <chrome-bot@chromium.org>2017-06-27 17:56:12 -0700
commitf534936ca5435e3b31fd2e31acc4ae9d47d57b5d (patch)
tree6dac28aa3325ee4c2172d72d97fc1307c233f037
parenta66de3e95631ba30212481185e23d2c48ddf4665 (diff)
downloadchrome-ec-f534936ca5435e3b31fd2e31acc4ae9d47d57b5d.tar.gz
common: delay flash_erase deferred task so EC_CMD_FLASH_ERASE can complete
Add a delay before flash_erase deferred started so the task does not halt CPU, and cause the response of EC_CMD_FLASH_ERASE to not be delivered. When the above situation happens the host I2C controller will timeout. A 100ms delay should be long enough on any board to allow the response to be sent. BRANCH=none BUG=b:38018926 TEST=on eve units where flashrom always fail: `flashrom -p ec:type=tp -w ec.bin` succeeds. Change-Id: I399a60064392da41a3e27f8630175ab427047ab7 Signed-off-by: Wei-Ning Huang <wnhuang@google.com> Reviewed-on: https://chromium-review.googlesource.com/547375 Commit-Ready: Wei-Ning Huang <wnhuang@chromium.org> Tested-by: Wei-Ning Huang <wnhuang@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@google.com>
-rw-r--r--common/flash.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/common/flash.c b/common/flash.c
index 8a87cce9f3..46319a9508 100644
--- a/common/flash.c
+++ b/common/flash.c
@@ -1220,7 +1220,8 @@ static int flash_command_erase(struct host_cmd_handler_args *args)
rc = erase_rc;
if (rc == EC_RES_SUCCESS) {
memcpy(&erase_info, p_1, sizeof(*p_1));
- hook_call_deferred(&flash_erase_deferred_data, 0);
+ hook_call_deferred(&flash_erase_deferred_data,
+ 100 * MSEC);
} else {
/*
* Not our job to return the result of