From f534936ca5435e3b31fd2e31acc4ae9d47d57b5d Mon Sep 17 00:00:00 2001 From: Wei-Ning Huang Date: Sat, 24 Jun 2017 15:33:11 +0800 Subject: 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 Reviewed-on: https://chromium-review.googlesource.com/547375 Commit-Ready: Wei-Ning Huang Tested-by: Wei-Ning Huang Reviewed-by: Gwendal Grignou --- common/flash.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 -- cgit v1.2.1