ec/google/chromeec: Check AP reset cause for watchdog reset

Different from mt8183, mt8192 doesn't need to trigger EC reboot on HW
initiated watchdog reset. Therefore, ec_reset_flags cannot be used to
determine AP watchdog reset. Instead we check the cause of the last AP
reset.

BUG=b:174443398
TEST=emerge-asurada coreboot
TEST=crash.WatchdogCrash passed on asurada
BRANCH=none

Cq-Depend: chromium:2607150
Change-Id: I761ecdd8811e5612b39e96c73442cc796361d0f0
Signed-off-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/49113
Reviewed-by: Nicolas Boichat <drinkcat@google.com>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Yu-Ping Wu 2021-01-05 17:05:40 +08:00 committed by Patrick Georgi
parent 9ff7823fe1
commit 8a82ea9faa
1 changed files with 17 additions and 2 deletions

View File

@ -993,9 +993,24 @@ static uint16_t google_chromeec_get_uptime_info(
bool google_chromeec_get_ap_watchdog_flag(void)
{
int i;
struct ec_response_uptime_info resp;
return (!google_chromeec_get_uptime_info(&resp) &&
(resp.ec_reset_flags & EC_RESET_FLAG_AP_WATCHDOG));
if (google_chromeec_get_uptime_info(&resp))
return false;
if (resp.ec_reset_flags & EC_RESET_FLAG_AP_WATCHDOG)
return true;
/* Find the last valid entry */
for (i = ARRAY_SIZE(resp.recent_ap_reset) - 1; i >= 0; i--) {
if (resp.recent_ap_reset[i].reset_time_ms == 0)
continue;
return (resp.recent_ap_reset[i].reset_cause ==
CHIPSET_RESET_AP_WATCHDOG);
}
return false;
}
int google_chromeec_i2c_xfer(uint8_t chip, uint8_t addr, int alen,