summaryrefslogtreecommitdiffstats
path: root/src/soc/mediatek/common
diff options
context:
space:
mode:
authorBo-Chen Chen <rex-bc.chen@mediatek.com>2022-07-04 18:59:51 +0800
committerFelix Held <felix-coreboot@felixheld.de>2022-07-06 15:20:42 +0000
commit0e03fa3f6e474aa28a9151e5d9f152619636650c (patch)
treeeac4fc3732776269a8b2e9729ef4ba4dac96afcc /src/soc/mediatek/common
parentd4e07090ffb3420f5aa11d8a92dd61c8074412b4 (diff)
downloadcoreboot-0e03fa3f6e474aa28a9151e5d9f152619636650c.tar.gz
coreboot-0e03fa3f6e474aa28a9151e5d9f152619636650c.tar.bz2
coreboot-0e03fa3f6e474aa28a9151e5d9f152619636650c.zip
soc/mediatek: Move wdt_set_req() to common folder
There are more and more variables which are SoC-specific, so add soc/wdt.h for each SoC and rename common/wdt.h to common/wdt_common.h. wdt_set_req() is almost the same for mt8192, mt8195 and mt8186, so move it to a common file wdt_req.c. TEST=build pass BUG=b:233720142 Signed-off-by: Bo-Chen Chen <rex-bc.chen@mediatek.com> Change-Id: I7a334b3e7cd4f24a848dd31aca546dc7236d5fb8 Reviewed-on: https://review.coreboot.org/c/coreboot/+/65636 Reviewed-by: Yidi Lin <yidilin@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Diffstat (limited to 'src/soc/mediatek/common')
-rw-r--r--src/soc/mediatek/common/include/soc/wdt_common.h (renamed from src/soc/mediatek/common/include/soc/wdt.h)14
-rw-r--r--src/soc/mediatek/common/wdt_req.c15
2 files changed, 26 insertions, 3 deletions
diff --git a/src/soc/mediatek/common/include/soc/wdt.h b/src/soc/mediatek/common/include/soc/wdt_common.h
index 1277436e3c65..5587d504e849 100644
--- a/src/soc/mediatek/common/include/soc/wdt.h
+++ b/src/soc/mediatek/common/include/soc/wdt_common.h
@@ -1,8 +1,9 @@
/* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef SOC_MEDIATEK_COMMON_WDT_H
-#define SOC_MEDIATEK_COMMON_WDT_H
+#ifndef SOC_MEDIATEK_WDT_COMMON_H
+#define SOC_MEDIATEK_WDT_COMMON_H
+#include <device/mmio.h>
#include <stdint.h>
#include <soc/addressmap.h>
@@ -39,10 +40,17 @@ enum {
MTK_WDT_STA_HW_RST = 1 << 31
};
+/* WDT_REQ */
+#define MTK_WDT_REQ_MOD_KEY_VAL 0x33
+#define MTK_WDT_REQ_IRQ_KEY_VAL 0x44
+
+DEFINE_BITFIELD(MTK_WDT_REQ_MOD_KEY, 31, 24)
+DEFINE_BITFIELD(MTK_WDT_REQ_IRQ_KEY, 31, 24)
+
static struct mtk_wdt_regs *const mtk_wdt = (void *)RGU_BASE;
int mtk_wdt_init(void);
void mtk_wdt_clr_status(void);
void mtk_wdt_set_req(void);
-#endif /* SOC_MEDIATEK_COMMON_WDT_H */
+#endif /* SOC_MEDIATEK_WDT_COMMON_H */
diff --git a/src/soc/mediatek/common/wdt_req.c b/src/soc/mediatek/common/wdt_req.c
new file mode 100644
index 000000000000..6dfd608b6940
--- /dev/null
+++ b/src/soc/mediatek/common/wdt_req.c
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <device/mmio.h>
+#include <soc/wdt.h>
+
+void mtk_wdt_set_req(void)
+{
+ SET32_BITFIELDS(&mtk_wdt->wdt_req_mode,
+ MTK_WDT_SPM_THERMAL_EN, MTK_WDT_SPM_THERMAL_VAL,
+ MTK_WDT_THERMAL_EN, 1,
+ MTK_WDT_REQ_MOD_KEY, MTK_WDT_REQ_MOD_KEY_VAL);
+ SET32_BITFIELDS(&mtk_wdt->wdt_req_irq_en,
+ MTK_WDT_THERMAL_IRQ, 0,
+ MTK_WDT_REQ_IRQ_KEY, MTK_WDT_REQ_IRQ_KEY_VAL);
+}