summaryrefslogtreecommitdiffstats
path: root/src/soc
diff options
context:
space:
mode:
authorRunyang Chen <runyang.chen@mediatek.corp-partner.google.com>2022-05-10 20:13:50 +0800
committerMartin L Roth <gaumless@tutanota.com>2022-05-28 04:25:10 +0000
commit11e2e36c06cb2c443366fe3c31193b011a161251 (patch)
tree3fd640d670035328afa039b2eed96acc40395b40 /src/soc
parent404188f80e7733610fd8d8611b55107f4e1f6431 (diff)
downloadcoreboot-11e2e36c06cb2c443366fe3c31193b011a161251.tar.gz
coreboot-11e2e36c06cb2c443366fe3c31193b011a161251.tar.bz2
coreboot-11e2e36c06cb2c443366fe3c31193b011a161251.zip
soc/mediatek/mt8186: Enable thermal hardware reset
Under the current watchdog setting, the system will not reboot when the temperature is too high. To enable thermal hardware reset, we need to enable thermal control request and set it to reboot mode. Note that because thermal throttle (by lowering cpu frequency) is currently enabled, the thermal hardware reset shouldn't be triggered under normal circumstances. This feature is only for new hardware structure for thermal. Therefore, we only need to apply it on MT8192/MT8195/MT8186. This setting is based on thermal and watchdog section of MT8186 Function Specification. BUG=none TEST=emerge-corsola coreboot TEST=thermal hardware reset is working. Signed-off-by: Runyang Chen <runyang.chen@mediatek.corp-partner.google.com> Change-Id: Id2ed55e6d4f4eec450bf7c849f726a389eeb6694 Reviewed-on: https://review.coreboot.org/c/coreboot/+/64659 Reviewed-by: Bo-Chen Chen <rex-bc.chen@mediatek.com> Reviewed-by: Yu-Ping Wu <yupingso@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc')
-rw-r--r--src/soc/mediatek/common/include/soc/wdt.h3
-rw-r--r--src/soc/mediatek/mt8186/wdt.c8
2 files changed, 10 insertions, 1 deletions
diff --git a/src/soc/mediatek/common/include/soc/wdt.h b/src/soc/mediatek/common/include/soc/wdt.h
index ebf7f490f5c2..5494ff86ef0a 100644
--- a/src/soc/mediatek/common/include/soc/wdt.h
+++ b/src/soc/mediatek/common/include/soc/wdt.h
@@ -16,7 +16,8 @@ struct mtk_wdt_regs {
u32 wdt_swsysrst;
u32 reserved0[5];
u32 wdt_req_mode;
- u32 reserved1[3];
+ u32 wdt_req_irq_en;
+ u32 reserved1[2];
u32 wdt_debug_ctrl;
};
diff --git a/src/soc/mediatek/mt8186/wdt.c b/src/soc/mediatek/mt8186/wdt.c
index f9e0d8a3d7ab..39bc2835c813 100644
--- a/src/soc/mediatek/mt8186/wdt.c
+++ b/src/soc/mediatek/mt8186/wdt.c
@@ -11,16 +11,24 @@
#define MTK_WDT_CLR_STATUS_VAL 0x22
#define MTK_WDT_REQ_MOD_KEY_VAL 0x33
+#define MTK_WDT_REQ_IRQ_KEY_VAL 0x44
DEFINE_BITFIELD(MTK_WDT_CLR_STATUS, 31, 24)
DEFINE_BITFIELD(MTK_WDT_REQ_MOD_KEY, 31, 24)
+DEFINE_BITFIELD(MTK_WDT_REQ_IRQ_KEY, 31, 24)
DEFINE_BIT(MTK_WDT_SPM_THERMAL_EN, 0)
+DEFINE_BIT(MTK_WDT_THERMAL_EN, 18)
+DEFINE_BIT(MTK_WDT_THERMAL_IRQ, 18)
void mtk_wdt_preinit(void)
{
SET32_BITFIELDS(&mtk_wdt->wdt_req_mode,
MTK_WDT_SPM_THERMAL_EN, 0,
+ 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);
}
void mtk_wdt_clr_status(void)