summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBo-Chen Chen <rex-bc.chen@mediatek.com>2022-07-04 19:46:33 +0800
committerFelix Held <felix-coreboot@felixheld.de>2022-07-06 15:21:03 +0000
commit22d30c4faeea969c934912bfe921490bc77b2a47 (patch)
treecbb7877b5bcb0fd4d19ed8175d60c18d74e556c6
parent0e03fa3f6e474aa28a9151e5d9f152619636650c (diff)
soc/mediatek/mt8188: Initialize watchdog
Add watchdog support for MT8188. This implementation is based on chapter 3.10.10 in MT8188 Functional Specification. TEST=build pass BUG=b:233720142 Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com> Change-Id: Iaf56c78d89af53d0272583b463c050e69bbeb07a Reviewed-on: https://review.coreboot.org/c/coreboot/+/65587 Reviewed-by: Yidi Lin <yidilin@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com>
-rw-r--r--src/soc/mediatek/mt8188/Makefile.inc1
-rw-r--r--src/soc/mediatek/mt8188/bootblock.c2
-rw-r--r--src/soc/mediatek/mt8188/include/soc/wdt.h14
-rw-r--r--src/soc/mediatek/mt8188/wdt.c20
4 files changed, 37 insertions, 0 deletions
diff --git a/src/soc/mediatek/mt8188/Makefile.inc b/src/soc/mediatek/mt8188/Makefile.inc
index 9a2ff7dc5a..2bef2e2596 100644
--- a/src/soc/mediatek/mt8188/Makefile.inc
+++ b/src/soc/mediatek/mt8188/Makefile.inc
@@ -6,6 +6,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
diff --git a/src/soc/mediatek/mt8188/bootblock.c b/src/soc/mediatek/mt8188/bootblock.c
index f48e78c309..770c6031da 100644
--- a/src/soc/mediatek/mt8188/bootblock.c
+++ b/src/soc/mediatek/mt8188/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/mt8188/include/soc/wdt.h b/src/soc/mediatek/mt8188/include/soc/wdt.h
new file mode 100644
index 0000000000..39d5b179f3
--- /dev/null
+++ b/src/soc/mediatek/mt8188/include/soc/wdt.h
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef SOC_MEDIATEK_MT8188_WDT_H
+#define SOC_MEDIATEK_MT8188_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, 17)
+DEFINE_BIT(MTK_WDT_THERMAL_IRQ, 17)
+
+#endif /* SOC_MEDIATEK_MT8188_WDT_H */
diff --git a/src/soc/mediatek/mt8188/wdt.c b/src/soc/mediatek/mt8188/wdt.c
new file mode 100644
index 0000000000..5218de39b8
--- /dev/null
+++ b/src/soc/mediatek/mt8188/wdt.c
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+/*
+ * This file is created based on MT8188 Functional Specification
+ * Chapter number: 3.10.10
+ */
+
+#include <device/mmio.h>
+#include <soc/addressmap.h>
+#include <soc/wdt.h>
+
+#define MTK_WDT_CLR_STATUS_VAL 0x22
+
+DEFINE_BITFIELD(MTK_WDT_CLR_STATUS, 31, 24)
+
+void mtk_wdt_clr_status(void)
+{
+ SET32_BITFIELDS(&mtk_wdt->wdt_mode,
+ MTK_WDT_CLR_STATUS, MTK_WDT_CLR_STATUS_VAL);
+}