From ce6f7820f419b8ff70b72558047886afc9f77587 Mon Sep 17 00:00:00 2001 From: Pranava Y N Date: Wed, 23 Apr 2025 11:06:52 +0530 Subject: [PATCH] ec/google/chromeec: Increase EC status timeout to 30 seconds Some ITE ECs take long time (15-20s) to complete flash erase operation during EC software sync. Increasing the timeout value to 30s avoids EC_CMD_FLASH_ERASE command from timing out. As this is just a timeout value, it should not have any effect on the boot time. BUGS=b:386920751, b:412210635 TEST= Verify that the EC_CMD_FLASH_ERASE(0x13) is not timing out while performing EC sync. Below error is avoided, ``` [ERROR] Timeout waiting for EC process command 19! [INFO ] VB2:update_ec() vb2ex_ec_update_image(select) returned 0x10000001 [INFO ] VB2:vb2api_fail() Need recovery, reason: 0x26 / 0x1 [INFO ] VB2:sync_ec() update_ec(ctx, select_rw) returned 0x10000001 [INFO ] VB2:vb2api_fail() Need recovery, reason: 0x26 / 0x1 [INFO ] VB2:vb2api_ec_sync() ec_sync_phase2(ctx) returned 0x10000001 [INFO ] Saving nvdata [ERROR] EC software sync failed (0x10000001), rebooting [INFO ] board_reset() called! [INFO ] full_reset() called! ``` Change-Id: Id7bfa620e8c19d5b162b60e5cc37003ff339b589 Signed-off-by: Pranava Y N Reviewed-on: https://review.coreboot.org/c/coreboot/+/87427 Reviewed-by: Subrata Banik Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel --- src/ec/google/chromeec/ec_lpc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ec/google/chromeec/ec_lpc.c b/src/ec/google/chromeec/ec_lpc.c index b86ba7ba7f..b32d25c6a8 100644 --- a/src/ec/google/chromeec/ec_lpc.c +++ b/src/ec/google/chromeec/ec_lpc.c @@ -103,8 +103,11 @@ static inline u8 write_byte(u8 val, u16 port) static int google_chromeec_status_check(u16 port, u8 mask, u8 cond) { struct stopwatch timeout_sw; - /* One second is more than plenty for any EC operation to complete */ - const uint64_t ec_status_timeout_us = 1 * USECS_PER_SEC; + /* + * Wait up to 30s for EC operation to complete. + * Some ECs take 15-20s to complete Flash Erase operation. + */ + const uint64_t ec_status_timeout_us = 30 * USECS_PER_SEC; /* Wait 1 usec between read attempts */ const uint64_t ec_status_read_period_us = 1;