From bff1210f24a0588f0f6da3c0a1db45115c62080d Mon Sep 17 00:00:00 2001 From: Rex-BC Chen Date: Wed, 9 Mar 2022 20:42:56 +0800 Subject: [PATCH] soc/mediatek/mt8186: Disable unused spm_thermal In MT8186, we need to disable spm_thermal to prevent it from influencing other wdt status. There are two hardware pathes which are used for asserting watchdog from thermal. We can disable status of path 1 because status of path 2 is used. 1. Thermal -> SPM -> WDT 2. Thermal -> WDT Spm_thermal (path 1) is a flexible option for software control, and the hardware designer suggests that we should disable it if we don't use it. BUG=none TEST=build pass Signed-off-by: Rex-BC Chen Change-Id: I0ffde6bad3000a64e3b5782edaa72c62da034302 Reviewed-on: https://review.coreboot.org/c/coreboot/+/62890 Reviewed-by: Yu-Ping Wu Tested-by: build bot (Jenkins) --- src/soc/mediatek/common/include/soc/wdt.h | 5 ++++- src/soc/mediatek/mt8186/bootblock.c | 1 + src/soc/mediatek/mt8186/wdt.c | 10 ++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/soc/mediatek/common/include/soc/wdt.h b/src/soc/mediatek/common/include/soc/wdt.h index cd43134078..ebf7f490f5 100644 --- a/src/soc/mediatek/common/include/soc/wdt.h +++ b/src/soc/mediatek/common/include/soc/wdt.h @@ -14,7 +14,9 @@ struct mtk_wdt_regs { u32 wdt_interval; u32 wdt_swrst; u32 wdt_swsysrst; - u32 reserved[9]; + u32 reserved0[5]; + u32 wdt_req_mode; + u32 reserved1[3]; u32 wdt_debug_ctrl; }; @@ -38,6 +40,7 @@ enum { static struct mtk_wdt_regs *const mtk_wdt = (void *)RGU_BASE; +void mtk_wdt_preinit(void); int mtk_wdt_init(void); void mtk_wdt_clr_status(void); diff --git a/src/soc/mediatek/mt8186/bootblock.c b/src/soc/mediatek/mt8186/bootblock.c index e5d1e73047..29de7fbe77 100644 --- a/src/soc/mediatek/mt8186/bootblock.c +++ b/src/soc/mediatek/mt8186/bootblock.c @@ -12,6 +12,7 @@ void bootblock_soc_init(void) { mtk_mmu_init(); bustracker_init(); + mtk_wdt_preinit(); mtk_wdt_init(); mt_pll_init(); unmask_eint_event_mask(); diff --git a/src/soc/mediatek/mt8186/wdt.c b/src/soc/mediatek/mt8186/wdt.c index fbc9bb9989..f9e0d8a3d7 100644 --- a/src/soc/mediatek/mt8186/wdt.c +++ b/src/soc/mediatek/mt8186/wdt.c @@ -10,8 +10,18 @@ #include #define MTK_WDT_CLR_STATUS_VAL 0x22 +#define MTK_WDT_REQ_MOD_KEY_VAL 0x33 DEFINE_BITFIELD(MTK_WDT_CLR_STATUS, 31, 24) +DEFINE_BITFIELD(MTK_WDT_REQ_MOD_KEY, 31, 24) +DEFINE_BIT(MTK_WDT_SPM_THERMAL_EN, 0) + +void mtk_wdt_preinit(void) +{ + SET32_BITFIELDS(&mtk_wdt->wdt_req_mode, + MTK_WDT_SPM_THERMAL_EN, 0, + MTK_WDT_REQ_MOD_KEY, MTK_WDT_REQ_MOD_KEY_VAL); +} void mtk_wdt_clr_status(void) {