From f0604afa02a62837734b6cc212d6ff1d6c98ba66 Mon Sep 17 00:00:00 2001 From: Rex-BC Chen Date: Wed, 1 Jun 2022 18:38:56 +0800 Subject: [PATCH] soc/mediatek: Rename mtk_wdt_preinit() to mtk_wdt_set_req() To simplify the calling sequence for mtk_wdt_preinit() and we always adjust request setting in mtk_wdt_preinit(), we rename mtk_wdt_preinit() to mtk_wdt_set_req() and call it in mtk_wdt_init(). From this modification, we can also enable thermal hardware reset feature (CB:64676, CB:64675) in MT8192 and MT8195. BUG=none TEST=build pass Signed-off-by: Bo-Chen Chen Change-Id: I1904ff9387f7677a077068f2c3df923bd642ea3d Reviewed-on: https://review.coreboot.org/c/coreboot/+/64861 Tested-by: build bot (Jenkins) Reviewed-by: Yu-Ping Wu --- src/soc/mediatek/common/include/soc/wdt.h | 2 +- src/soc/mediatek/common/wdt.c | 3 +++ src/soc/mediatek/mt8186/bootblock.c | 1 - src/soc/mediatek/mt8186/wdt.c | 2 +- src/soc/mediatek/mt8192/wdt.c | 2 +- src/soc/mediatek/mt8195/wdt.c | 2 +- 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/soc/mediatek/common/include/soc/wdt.h b/src/soc/mediatek/common/include/soc/wdt.h index 5494ff86ef..1277436e3c 100644 --- a/src/soc/mediatek/common/include/soc/wdt.h +++ b/src/soc/mediatek/common/include/soc/wdt.h @@ -41,8 +41,8 @@ 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); +void mtk_wdt_set_req(void); #endif /* SOC_MEDIATEK_COMMON_WDT_H */ diff --git a/src/soc/mediatek/common/wdt.c b/src/soc/mediatek/common/wdt.c index d58ac32b33..7ae4661011 100644 --- a/src/soc/mediatek/common/wdt.c +++ b/src/soc/mediatek/common/wdt.c @@ -8,6 +8,7 @@ #include __weak void mtk_wdt_clr_status(void) { /* do nothing */ } +__weak void mtk_wdt_set_req(void) { /* do nothing */ } static inline void mtk_wdt_swreset(void) { @@ -32,6 +33,8 @@ int mtk_wdt_init(void) { uint32_t wdt_sta; + mtk_wdt_set_req(); + /* Writing mode register will clear status register */ wdt_sta = read32(&mtk_wdt->wdt_status); diff --git a/src/soc/mediatek/mt8186/bootblock.c b/src/soc/mediatek/mt8186/bootblock.c index 29de7fbe77..e5d1e73047 100644 --- a/src/soc/mediatek/mt8186/bootblock.c +++ b/src/soc/mediatek/mt8186/bootblock.c @@ -12,7 +12,6 @@ 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 39bc2835c8..5303f9d566 100644 --- a/src/soc/mediatek/mt8186/wdt.c +++ b/src/soc/mediatek/mt8186/wdt.c @@ -20,7 +20,7 @@ DEFINE_BIT(MTK_WDT_SPM_THERMAL_EN, 0) DEFINE_BIT(MTK_WDT_THERMAL_EN, 18) DEFINE_BIT(MTK_WDT_THERMAL_IRQ, 18) -void mtk_wdt_preinit(void) +void mtk_wdt_set_req(void) { SET32_BITFIELDS(&mtk_wdt->wdt_req_mode, MTK_WDT_SPM_THERMAL_EN, 0, diff --git a/src/soc/mediatek/mt8192/wdt.c b/src/soc/mediatek/mt8192/wdt.c index 8c8959a420..d3e3e74921 100644 --- a/src/soc/mediatek/mt8192/wdt.c +++ b/src/soc/mediatek/mt8192/wdt.c @@ -12,7 +12,7 @@ DEFINE_BITFIELD(MTK_WDT_REQ_IRQ_KEY, 31, 24) DEFINE_BIT(MTK_WDT_THERMAL_EN, 18) DEFINE_BIT(MTK_WDT_THERMAL_IRQ, 18) -void mtk_wdt_preinit(void) +void mtk_wdt_set_req(void) { SET32_BITFIELDS(&mtk_wdt->wdt_req_mode, MTK_WDT_THERMAL_EN, 1, diff --git a/src/soc/mediatek/mt8195/wdt.c b/src/soc/mediatek/mt8195/wdt.c index 54038c98aa..ab2934bbc7 100644 --- a/src/soc/mediatek/mt8195/wdt.c +++ b/src/soc/mediatek/mt8195/wdt.c @@ -13,7 +13,7 @@ DEFINE_BITFIELD(MTK_WDT_REQ_IRQ_KEY, 31, 24) DEFINE_BIT(MTK_WDT_THERMAL_EN, 18) DEFINE_BIT(MTK_WDT_THERMAL_IRQ, 18) -void mtk_wdt_preinit(void) +void mtk_wdt_set_req(void) { SET32_BITFIELDS(&mtk_wdt->wdt_req_mode, MTK_WDT_THERMAL_EN, 1,