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>
This commit is contained in:
Jarried Lin 2024-11-11 14:46:19 +08:00 committed by Elyes Haouas
commit 94c1307fdb
4 changed files with 26 additions and 0 deletions

View file

@ -13,6 +13,7 @@ all-y += ../common/uart.c
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

View file

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

View file

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

View file

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