From 4f92943c899c1e1b571582559fd0a9a0ed6d3027 Mon Sep 17 00:00:00 2001 From: Ke Zheng Date: Thu, 12 Dec 2024 09:38:42 +0800 Subject: [PATCH] soc/mediatek/common: Rename GPT_MHZ to TIMER_MHZ for readability Update timer macro name for common. The new ICs (e.g. mt8196, mt8189) will no longer use GPT. In order to improve code readability, replace GPT_MHZ with TIMER_MHZ for existing SoCs. BUG=b:379008996 BRANCH=none TEST=Build pass, Macro name is correct. Change-Id: I02f18bfa5b5912f28e322d40cd46823a0095bbf4 Signed-off-by: Ke Zheng Reviewed-on: https://review.coreboot.org/c/coreboot/+/85681 Reviewed-by: Yidi Lin Reviewed-by: Yu-Ping Wu Tested-by: build bot (Jenkins) --- src/soc/mediatek/common/include/soc/timer_v1.h | 2 +- src/soc/mediatek/common/include/soc/timer_v2.h | 2 +- src/soc/mediatek/common/timer.c | 2 +- src/soc/mediatek/mt8173/timer.c | 2 +- src/soc/mediatek/mt8196/timer.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/soc/mediatek/common/include/soc/timer_v1.h b/src/soc/mediatek/common/include/soc/timer_v1.h index 8d64b5d163..d71d270d0b 100644 --- a/src/soc/mediatek/common/include/soc/timer_v1.h +++ b/src/soc/mediatek/common/include/soc/timer_v1.h @@ -7,7 +7,7 @@ #include #include -#define GPT_MHZ 13 +#define TIMER_MHZ 13 struct mtk_gpt_regs { u32 reserved1[24]; diff --git a/src/soc/mediatek/common/include/soc/timer_v2.h b/src/soc/mediatek/common/include/soc/timer_v2.h index 23059284ce..d4f854c605 100644 --- a/src/soc/mediatek/common/include/soc/timer_v2.h +++ b/src/soc/mediatek/common/include/soc/timer_v2.h @@ -7,7 +7,7 @@ #include #include -#define GPT_MHZ 13 +#define TIMER_MHZ 13 enum { TIE_0_EN = 1 << 3, diff --git a/src/soc/mediatek/common/timer.c b/src/soc/mediatek/common/timer.c index 5feed3420b..5412a9e7e1 100644 --- a/src/soc/mediatek/common/timer.c +++ b/src/soc/mediatek/common/timer.c @@ -27,7 +27,7 @@ static uint64_t timer_raw_value(void) void timer_monotonic_get(struct mono_time *mt) { - mono_time_set_usecs(mt, timer_raw_value() / GPT_MHZ); + mono_time_set_usecs(mt, timer_raw_value() / TIMER_MHZ); } void init_timer(void) diff --git a/src/soc/mediatek/mt8173/timer.c b/src/soc/mediatek/mt8173/timer.c index 0a9de6bfb9..fc7187714d 100644 --- a/src/soc/mediatek/mt8173/timer.c +++ b/src/soc/mediatek/mt8173/timer.c @@ -18,5 +18,5 @@ void timer_prepare(void) */ write32(&mt8173_mcucfg->xgpt_idx, 0); /* Set clock mode to 13Mhz and enable XGPT */ - write32(&mt8173_mcucfg->xgpt_ctl, (0x1 | ((26 / GPT_MHZ) << 8))); + write32(&mt8173_mcucfg->xgpt_ctl, (0x1 | ((26 / TIMER_MHZ) << 8))); } diff --git a/src/soc/mediatek/mt8196/timer.c b/src/soc/mediatek/mt8196/timer.c index bf3f3cee63..5db5c4ac2f 100644 --- a/src/soc/mediatek/mt8196/timer.c +++ b/src/soc/mediatek/mt8196/timer.c @@ -9,5 +9,5 @@ void init_timer(void) { timer_prepare(); - raw_write_cntfrq_el0(GPT_MHZ * MHz); + raw_write_cntfrq_el0(TIMER_MHZ * MHz); }