Jarried Lin has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/85774?usp=email )
Change subject: soc/mediatek/mt8196: Add power-saving for peripheral clocks ......................................................................
soc/mediatek/mt8196: Add power-saving for peripheral clocks
CKSYS in MT8196 dynamically controls PERI clocks based on status: - Clock off when idle. - Clock on when busy. This reduces power consumption by turning off clocks when not needed.
TEST=Build pass BUG=b:317009620
Change-Id: I70f710f068d7d882037691930a90c83adaab15d2 Signed-off-by: Jarried Lin jarried.lin@mediatek.corp-partner.google.com --- M src/soc/mediatek/mt8196/Makefile.mk M src/soc/mediatek/mt8196/bootblock.c M src/soc/mediatek/mt8196/include/soc/addressmap.h A src/soc/mediatek/mt8196/include/soc/mtk_cksys.h A src/soc/mediatek/mt8196/mtk_cksys.c 5 files changed, 28 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/74/85774/1
diff --git a/src/soc/mediatek/mt8196/Makefile.mk b/src/soc/mediatek/mt8196/Makefile.mk index 7fe0889..a63a22f 100644 --- a/src/soc/mediatek/mt8196/Makefile.mk +++ b/src/soc/mediatek/mt8196/Makefile.mk @@ -18,6 +18,7 @@ bootblock-y += mminfra.c bootblock-y += ../common/mmu_operations.c bootblock-y += mtcmos.c +bootblock-y += mtk_cksys.c bootblock-$(CONFIG_PCI) += ../common/pcie.c pcie.c bootblock-y += tracker.c bootblock-y += ../common/wdt.c ../common/wdt_req.c wdt.c diff --git a/src/soc/mediatek/mt8196/bootblock.c b/src/soc/mediatek/mt8196/bootblock.c index 95555d1..0577338 100644 --- a/src/soc/mediatek/mt8196/bootblock.c +++ b/src/soc/mediatek/mt8196/bootblock.c @@ -6,6 +6,7 @@ #include <soc/lastbus_v2.h> #include <soc/mminfra.h> #include <soc/mmu_operations.h> +#include <soc/mtk_cksys.h> #include <soc/pll.h> #include <soc/spm_mtcmos.h> #include <soc/tracker.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/include/soc/addressmap.h b/src/soc/mediatek/mt8196/include/soc/addressmap.h index 8d0a4bb..d3ec4c6 100644 --- a/src/soc/mediatek/mt8196/include/soc/addressmap.h +++ b/src/soc/mediatek/mt8196/include/soc/addressmap.h @@ -134,6 +134,7 @@ I2C14_DMA_BASE = IO_PHYS + 0x06500000, PERI_PAR_BCRM_BASE = IO_PHYS + 0x06610000, PERICFG_AO_SEC_BASE = IO_PHYS + 0x06630000, + PERI_MASK_IDLE_TO_CKSYS = IO_PHYS + 0x06630270, PERICFG_AO_BASE = IO_PHYS + 0x06640000, PERI_PAR_AO_DEBUG_BASE = IO_PHYS + 0x06680000, SSUSB_IPPC_BASE = IO_PHYS + 0x06703E00, diff --git a/src/soc/mediatek/mt8196/include/soc/mtk_cksys.h b/src/soc/mediatek/mt8196/include/soc/mtk_cksys.h new file mode 100644 index 0000000..fd7c485 --- /dev/null +++ b/src/soc/mediatek/mt8196/include/soc/mtk_cksys.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0-only OR MIT */ + +#ifndef __SOC_MEDIATEK_MT8196_MTK_CKSYS_H__ +#define __SOC_MEDIATEK_MT8196_MTK_CKSYS_H__ + +#include <device/mmio.h> + +void mtk_cksys_init(void); + +#endif /* __SOC_MEDIATEK_MT8196_MTK_CKSYS_H__ */ diff --git a/src/soc/mediatek/mt8196/mtk_cksys.c b/src/soc/mediatek/mt8196/mtk_cksys.c new file mode 100644 index 0000000..9441f98 --- /dev/null +++ b/src/soc/mediatek/mt8196/mtk_cksys.c @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-only OR MIT */ + +#include <console/console.h> +#include <soc/addressmap.h> +#include <soc/mtk_cksys.h> + + +void mtk_cksys_init(void) +{ + printk(BIOS_INFO, "%s %#x\n", __func__, PERI_MASK_IDLE_TO_CKSYS); + printk(BIOS_INFO, "%s before = %#x\n", __func__, read32p(PERI_MASK_IDLE_TO_CKSYS)); + write32p(PERI_MASK_IDLE_TO_CKSYS, 0x1); + printk(BIOS_INFO, "%s after = %#x\n", __func__, read32((u32 *) PERI_MASK_IDLE_TO_CKSYS)); +}