Yidi Lin has submitted this change. ( https://review.coreboot.org/c/coreboot/+/85678?usp=email )
Change subject: soc/mediatek/mt8189: Initialize watchdog ......................................................................
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 --- M src/soc/mediatek/mt8189/Makefile.mk M src/soc/mediatek/mt8189/bootblock.c A src/soc/mediatek/mt8189/include/soc/wdt.h A src/soc/mediatek/mt8189/wdt.c 4 files changed, 39 insertions(+), 0 deletions(-)
Approvals: Yidi Lin: Looks good to me, approved Yu-Ping Wu: Looks good to me, approved build bot (Jenkins): Verified
diff --git a/src/soc/mediatek/mt8189/Makefile.mk b/src/soc/mediatek/mt8189/Makefile.mk index 9b09628..e997ec1 100644 --- a/src/soc/mediatek/mt8189/Makefile.mk +++ b/src/soc/mediatek/mt8189/Makefile.mk @@ -8,6 +8,7 @@
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 diff --git a/src/soc/mediatek/mt8189/bootblock.c b/src/soc/mediatek/mt8189/bootblock.c index 89cd22d..ed78d65 100644 --- a/src/soc/mediatek/mt8189/bootblock.c +++ b/src/soc/mediatek/mt8189/bootblock.c @@ -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(); } diff --git a/src/soc/mediatek/mt8189/include/soc/wdt.h b/src/soc/mediatek/mt8189/include/soc/wdt.h new file mode 100644 index 0000000..f6e808c --- /dev/null +++ b/src/soc/mediatek/mt8189/include/soc/wdt.h @@ -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__ */ diff --git a/src/soc/mediatek/mt8189/wdt.c b/src/soc/mediatek/mt8189/wdt.c new file mode 100644 index 0000000..ca6518b --- /dev/null +++ b/src/soc/mediatek/mt8189/wdt.c @@ -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); +}