diff options
author | Jarried Lin <jarried.lin@mediatek.corp-partner.google.com> | 2024-07-14 19:02:21 +0800 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2024-09-30 11:11:01 +0000 |
commit | ced0c208e43ebcdf9560754a6db27d10ae7df81f (patch) | |
tree | 70afc6bb88e628be7c0e1c16f4be11fdaf7ba55c /src/soc/mediatek/mt8196/include | |
parent | 16fe2eec083fa9465b157a322111cd6678a306d4 (diff) |
soc/mediatek/mt8196: Fix timer reset in BL31
After reboot, the system does not need to serve pending IRQ from
systimer. Therefore, clear systimer IRQ pending bits in init_timer().
For that to work, the systimer compensation version 2.0 needs to be
enabled.
TEST=Build pass and timestamp is not reset in ATF and payload
BUG=b:343881008
Change-Id: I520986b81ca153ec3ce56558a80619448cfc0c59
Signed-off-by: Zhanzhan Ge <zhanzhan.ge@mediatek.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83928
Reviewed-by: Yidi Lin <yidilin@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Diffstat (limited to 'src/soc/mediatek/mt8196/include')
-rw-r--r-- | src/soc/mediatek/mt8196/include/soc/timer.h | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/soc/mediatek/mt8196/include/soc/timer.h b/src/soc/mediatek/mt8196/include/soc/timer.h index d6422c5442..f6841fc250 100644 --- a/src/soc/mediatek/mt8196/include/soc/timer.h +++ b/src/soc/mediatek/mt8196/include/soc/timer.h @@ -2,12 +2,44 @@ /* * This file is created based on MT8196 Functional Specification - * Chapter number: 5.13 + * Chapter number: 1.2 2.2 */ #ifndef SOC_MEDIATEK_MT8196_TIMER_H #define SOC_MEDIATEK_MT8196_TIMER_H #include <soc/timer_v2.h> +#include <stdint.h> + +DEFINE_BITFIELD(COMP_FEATURE, 12, 10) +DEFINE_BITFIELD(COMP_FEATURE_TIE, 4, 3) +DEFINE_BITFIELD(REV_SET, 18, 17) +DEFINE_BITFIELD(SYST_CON, 4, 0) + +#define SYST_CON_EN BIT(0) +#define SYST_CON_IRQ_CLR BIT(4) +#define REV_CLR_EN 0x3 +#define COMP_FEATURE_20_EN 0x2 +#define COMP_FEATURE_TIE_EN 0x1 +#define COMP_FEATURE_CLR 0 +#define COMP_FEATURE_TIE_CLR 0 +#define SYSTIMER_CNT 8 +#define SYST_CON_CLR 0 + +struct systimer { + u32 cntcr; + u32 reserved; + u32 cntcv_l; + u32 cntcv_h; + u32 reserved1[0x30]; + struct { + u32 con; + u32 val; + } cnttval[SYSTIMER_CNT]; +}; + +check_member(systimer, cntcr, 0x0); +check_member(systimer, cntcv_l, 0x0008); +check_member(systimer, cntcv_h, 0x000c); #endif |