Elyes Haouas has submitted this change. ( https://review.coreboot.org/c/coreboot/+/85774?usp=email )
Change subject: soc/mediatek/mt8196: Add dynamic power-saving for peripheral clocks ......................................................................
soc/mediatek/mt8196: Add dynamic power-saving for peripheral clocks
In MT8196, CKSYS achieves power efficiency by dynamically turning the clocks on or off based on the status provided by PERI.
TEST=Build pass, boot log: mtk_cksys_init = 0x1 BUG=b:317009620
Change-Id: I70f710f068d7d882037691930a90c83adaab15d2 Signed-off-by: Jarried Lin jarried.lin@mediatek.corp-partner.google.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/85774 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Yidi Lin yidilin@google.com Reviewed-by: Yu-Ping Wu yupingso@google.com --- M src/soc/mediatek/mt8196/Makefile.mk M src/soc/mediatek/mt8196/bootblock.c A src/soc/mediatek/mt8196/cksys.c A src/soc/mediatek/mt8196/include/soc/cksys.h 4 files changed, 26 insertions(+), 0 deletions(-)
Approvals: Yu-Ping Wu: Looks good to me, approved build bot (Jenkins): Verified Yidi Lin: Looks good to me, approved
diff --git a/src/soc/mediatek/mt8196/Makefile.mk b/src/soc/mediatek/mt8196/Makefile.mk index 73661bd..d49925b 100644 --- a/src/soc/mediatek/mt8196/Makefile.mk +++ b/src/soc/mediatek/mt8196/Makefile.mk @@ -13,6 +13,7 @@ bootblock-y += booker.c bootblock-y += bootblock.c bootblock-y += ../common/bootblock.c bootblock.c +bootblock-y += cksys.c bootblock-y += ../common/early_init.c bootblock-y += ../common/lastbus_v2.c lastbus.c bootblock-y += mminfra.c diff --git a/src/soc/mediatek/mt8196/bootblock.c b/src/soc/mediatek/mt8196/bootblock.c index 95555d1..bd3c418 100644 --- a/src/soc/mediatek/mt8196/bootblock.c +++ b/src/soc/mediatek/mt8196/bootblock.c @@ -2,6 +2,7 @@
#include <soc/booker.h> #include <bootblock_common.h> +#include <soc/cksys.h> #include <soc/early_init.h> #include <soc/lastbus_v2.h> #include <soc/mminfra.h> @@ -14,6 +15,7 @@ void bootblock_soc_init(void) { booker_init(); + mtk_cksys_init(); mtk_mmu_init(); bustracker_init(); lastbus_init(); diff --git a/src/soc/mediatek/mt8196/cksys.c b/src/soc/mediatek/mt8196/cksys.c new file mode 100644 index 0000000..0869adc --- /dev/null +++ b/src/soc/mediatek/mt8196/cksys.c @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0-only OR MIT */ + +#include <console/console.h> +#include <device/mmio.h> +#include <soc/addressmap.h> +#include <soc/cksys.h> + +#define CKSYS_OFFSET 0x270 +#define PERI_MASK_IDLE_TO_CKSYS (PERICFG_AO_SEC_BASE + CKSYS_OFFSET) + +void mtk_cksys_init(void) +{ + setbits32p(PERI_MASK_IDLE_TO_CKSYS, BIT(0)); + printk(BIOS_INFO, "%s = %#x\n", __func__, read32p(PERI_MASK_IDLE_TO_CKSYS)); +} diff --git a/src/soc/mediatek/mt8196/include/soc/cksys.h b/src/soc/mediatek/mt8196/include/soc/cksys.h new file mode 100644 index 0000000..bb28add --- /dev/null +++ b/src/soc/mediatek/mt8196/include/soc/cksys.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0-only OR MIT */ + +#ifndef __SOC_MEDIATEK_MT8196_CKSYS_H__ +#define __SOC_MEDIATEK_MT8196_CKSYS_H__ + +void mtk_cksys_init(void); + +#endif /* __SOC_MEDIATEK_MT8196_CKSYS_H__ */