From 1e24b2047565e1ab01facb8185c06292550b3050 Mon Sep 17 00:00:00 2001 From: Rex-BC Chen Date: Tue, 15 Mar 2022 10:30:06 +0800 Subject: soc/mediatek: Trigger wdt SW reset when wdt status is not equal to 0 Because we close external signal in kernel driver since MT8195, it's more reasonable to trigger sw reset with exteranl signal again whenever the wdt status is not equal to 0. BUG=none TEST=build pass Signed-off-by: Rex-BC Chen Change-Id: Ic6128df7eadaebcf7ff8d4c5492e3e0cfbab6e36 Reviewed-on: https://review.coreboot.org/c/coreboot/+/62797 Reviewed-by: Yu-Ping Wu Tested-by: build bot (Jenkins) --- src/soc/mediatek/common/wdt.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'src/soc/mediatek/common/wdt.c') diff --git a/src/soc/mediatek/common/wdt.c b/src/soc/mediatek/common/wdt.c index 108648f80f..d58ac32b33 100644 --- a/src/soc/mediatek/common/wdt.c +++ b/src/soc/mediatek/common/wdt.c @@ -40,18 +40,21 @@ int mtk_wdt_init(void) printk(BIOS_INFO, "WDT: Status = %#x\n", wdt_sta); printk(BIOS_INFO, "WDT: Last reset was "); - if (wdt_sta & MTK_WDT_STA_HW_RST) { - printk(BIOS_INFO, "hardware watchdog\n"); + if (!wdt_sta) { + printk(BIOS_INFO, "cold boot\n"); + } else { + if (wdt_sta & MTK_WDT_STA_HW_RST) + printk(BIOS_INFO, "hardware watchdog\n"); + 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) + printk(BIOS_INFO, "SPM reboot\n"); + else + printk(BIOS_INFO, "other reset type: %#.8x\n", wdt_sta); + mark_watchdog_tombstone(); mtk_wdt_swreset(); - } 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) - printk(BIOS_INFO, "SPM reboot\n"); - else if (!wdt_sta) - printk(BIOS_INFO, "cold boot\n"); - else - printk(BIOS_INFO, "unexpected reset type: %#.8x\n", wdt_sta); + } /* Config watchdog reboot mode: * Clearing bits: -- cgit v1.2.3