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>
This commit is contained in:
Bo-Chen Chen 2022-07-04 19:46:33 +08:00 committed by Felix Held
parent 0e03fa3f6e
commit 22d30c4fae
4 changed files with 37 additions and 0 deletions

View File

@ -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

View File

@ -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();
}

View File

@ -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 */

View File

@ -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);
}