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 <pranavayn@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87427
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
This commit is contained in:
Pranava Y N 2025-04-23 11:06:52 +05:30 committed by Matt DeVillier
commit ce6f7820f4

View file

@ -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;