summaryrefslogtreecommitdiff
path: root/src/soc/mediatek/common
diff options
context:
space:
mode:
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 1277436e3c..5587d504e8 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 0000000000..6dfd608b69
--- /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);
+}