From 62aa2bb784af331f5323ced9ebad6497ef3b8274 Mon Sep 17 00:00:00 2001 From: Fengquan Chen Date: Wed, 25 Aug 2021 20:01:33 +0800 Subject: soc/mediatek: preserve WDT reset reason for debugging 1. Disable external output reset signal in first WDT reset to preserve WDT original reset reason for WDT issue in kernel stage. 2. After preserved WDT reset reason, do fully reset again by sending external output reset signal. BUG=b:194025005 TEST=boot to kernel ok and function test pass Signed-off-by: Fengquan Chen Change-Id: I5887a8312f4daab3cbd0a30fea0195670a932e52 Reviewed-on: https://review.coreboot.org/c/coreboot/+/57270 Tested-by: build bot (Jenkins) Reviewed-by: Rex-BC Chen Reviewed-by: Hung-Te Lin Reviewed-by: Yu-Ping Wu --- src/soc/mediatek/common/wdt.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/soc/mediatek') diff --git a/src/soc/mediatek/common/wdt.c b/src/soc/mediatek/common/wdt.c index 44a9ce50b6..05bd27d277 100644 --- a/src/soc/mediatek/common/wdt.c +++ b/src/soc/mediatek/common/wdt.c @@ -19,6 +19,14 @@ int mtk_wdt_init(void) if (wdt_sta & MTK_WDT_STA_HW_RST) { printk(BIOS_INFO, "hardware watchdog\n"); mark_watchdog_tombstone(); + + /* + * We trigger secondary reset by triggering WDT hardware to send signal to EC. + * We do not use do_board_reset() to send signal to EC + * which is controlled by software driver. + */ + write32(&mtk_wdt->wdt_mode, MTK_WDT_MODE_EXTEN | MTK_WDT_MODE_KEY); + write32(&mtk_wdt->wdt_swrst, MTK_WDT_SWRST_KEY); } else if (wdt_sta & MTK_WDT_STA_SW_RST) printk(BIOS_INFO, "normal software reboot\n"); else if (wdt_sta & MTK_WDT_STA_SPM_RST) -- cgit v1.2.3