You-Cheng Syu has uploaded this change for review.

View Change

mediatek: Read AP watchdog flag from Chrome EC if needed

On some boards (e.g., Kukui), AP doesn't remember if the last AP reset
was due to AP watchdog. In this case, we should query the reset reason
from EC.

BUG=b:109900671,b:118654976
BRANCH=none
TEST=none

Change-Id: I08af1fea38e4e49b0f14cb25551512244ef0690a
Signed-off-by: You-Cheng Syu <youcheng@google.com>
---
M src/soc/mediatek/common/wdt.c
1 file changed, 5 insertions(+), 1 deletion(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/43/31843/1
diff --git a/src/soc/mediatek/common/wdt.c b/src/soc/mediatek/common/wdt.c
index 54ce8c0..e21fab0 100644
--- a/src/soc/mediatek/common/wdt.c
+++ b/src/soc/mediatek/common/wdt.c
@@ -15,6 +15,7 @@

#include <device/mmio.h>
#include <console/console.h>
+#include <ec/google/chromeec/ec.h>
#include <soc/wdt.h>
#include <vendorcode/google/chromeos/chromeos.h>

@@ -25,8 +26,11 @@
/* Write Mode register will clear status register */
wdt_sta = read32(&mtk_wdt->wdt_status);

+ bool hw_rst = (CONFIG(EC_GOOGLE_CHROMEEC_AP_WATCHDOG_FLAG) ?
+ google_chromeec_get_ap_watchdog_flag() :
+ (wdt_sta & MTK_WDT_STA_HW_RST));
printk(BIOS_INFO, "WDT: Last reset was ");
- if (wdt_sta & MTK_WDT_STA_HW_RST) {
+ if (hw_rst) {
printk(BIOS_INFO, "hardware watchdog\n");
mark_watchdog_tombstone();
} else if (wdt_sta & MTK_WDT_STA_SW_RST)

To view, visit change 31843. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I08af1fea38e4e49b0f14cb25551512244ef0690a
Gerrit-Change-Number: 31843
Gerrit-PatchSet: 1
Gerrit-Owner: You-Cheng Syu <youcheng@google.com>
Gerrit-MessageType: newchange