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 <rex-bc.chen@mediatek.com>
Change-Id: I1904ff9387f7677a077068f2c3df923bd642ea3d
Reviewed-on: https://review.coreboot.org/c/coreboot/+/64861
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
This commit is contained in:
Rex-BC Chen 2022-06-01 18:38:56 +08:00 committed by Paul Fagerburg
parent cdc1de7e92
commit f0604afa02
6 changed files with 7 additions and 5 deletions

View File

@ -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 */

View File

@ -8,6 +8,7 @@
#include <vendorcode/google/chromeos/chromeos.h>
__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);

View File

@ -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();

View File

@ -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,

View File

@ -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,

View File

@ -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,