soc/mediatek/mt8189: Initialize watchdog

Add watchdog support for MT8189.

BUG=b:379008996
BRANCH=none
TEST=build pass and WDT makes DUT reboot when MTK_WDT_MODE_ENABLE is
set.

Change-Id: I496fce91e52393db31fd1fb5a1c68d91b2ed073e
Signed-off-by: Vince Liu <vince-wl.liu@mediatek.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/85678
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Reviewed-by: Yidi Lin <yidilin@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Vince Liu 2024-09-02 10:45:19 +08:00 committed by Yidi Lin
commit 40a863cd60
4 changed files with 39 additions and 0 deletions

View file

@ -8,6 +8,7 @@ all-y += ../common/uart.c
bootblock-y += bootblock.c
bootblock-y += ../common/mmu_operations.c
bootblock-y += ../common/wdt.c ../common/wdt_req.c wdt.c
romstage-y += ../common/cbmem.c
romstage-y += emi.c

View file

@ -2,8 +2,10 @@
#include <bootblock_common.h>
#include <soc/mmu_operations.h>
#include <soc/wdt.h>
void bootblock_soc_init(void)
{
mtk_mmu_init();
mtk_wdt_init();
}

View file

@ -0,0 +1,19 @@
/* SPDX-License-Identifier: GPL-2.0-only OR MIT */
/*
* This file is created based on MT8189 Functional Specification
* Chapter number: 8.2
*/
#ifndef __SOC_MEDIATEK_MT8189_INCLUDE_SOC_WDT_H__
#define __SOC_MEDIATEK_MT8189_INCLUDE_SOC_WDT_H__
#include <soc/wdt_common.h>
#define MTK_WDT_SPM_THERMAL_VAL 1
DEFINE_BIT(MTK_WDT_SPM_THERMAL_EN, 0)
DEFINE_BIT(MTK_WDT_THERMAL_EN, 18)
DEFINE_BIT(MTK_WDT_THERMAL_IRQ, 18)
#endif /* __SOC_MEDIATEK_MT8189_INCLUDE_SOC_WDT_H__ */

View file

@ -0,0 +1,17 @@
/* SPDX-License-Identifier: GPL-2.0-only OR MIT */
/*
* This file is created based on MT8189 Functional Specification
* Chapter number: 8.2
*/
#include <device/mmio.h>
#include <soc/addressmap.h>
#include <soc/wdt.h>
#define MTK_WDT_CLR_STATUS 0x230001FF
void mtk_wdt_clr_status(void)
{
write32(&mtk_wdt->wdt_mode, MTK_WDT_CLR_STATUS);
}