1 /* 2 * Copyright (c) 2021, MediaTek Inc. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef MTK_DCM_UTILS_H 8 #define MTK_DCM_UTILS_H 9 10 #include <stdbool.h> 11 12 #include <mtk_dcm.h> 13 #include <platform_def.h> 14 15 /* Base */ 16 #define MP_CPUSYS_TOP_BASE 0xc538000 17 #define CPCCFG_REG_BASE 0xc53a800 18 19 /* Register Definition */ 20 #define CPCCFG_REG_EMI_WFIFO (CPCCFG_REG_BASE + 0x100) 21 #define MP_CPUSYS_TOP_BUS_PLLDIV_CFG (MP_CPUSYS_TOP_BASE + 0x22e0) 22 #define MP_CPUSYS_TOP_CPU_PLLDIV_CFG0 (MP_CPUSYS_TOP_BASE + 0x22a0) 23 #define MP_CPUSYS_TOP_CPU_PLLDIV_CFG1 (MP_CPUSYS_TOP_BASE + 0x22a4) 24 #define MP_CPUSYS_TOP_MCSIC_DCM0 (MP_CPUSYS_TOP_BASE + 0x2440) 25 #define MP_CPUSYS_TOP_MCSI_CFG2 (MP_CPUSYS_TOP_BASE + 0x2418) 26 #define MP_CPUSYS_TOP_MCUSYS_DCM_CFG0 (MP_CPUSYS_TOP_BASE + 0x25c0) 27 #define MP_CPUSYS_TOP_MP0_DCM_CFG0 (MP_CPUSYS_TOP_BASE + 0x4880) 28 #define MP_CPUSYS_TOP_MP0_DCM_CFG7 (MP_CPUSYS_TOP_BASE + 0x489c) 29 #define MP_CPUSYS_TOP_MP_ADB_DCM_CFG4 (MP_CPUSYS_TOP_BASE + 0x2510) 30 #define MP_CPUSYS_TOP_MP_MISC_DCM_CFG0 (MP_CPUSYS_TOP_BASE + 0x2518) 31 32 bool dcm_mp_cpusys_top_adb_dcm_is_on(void); 33 void dcm_mp_cpusys_top_adb_dcm(bool on); 34 bool dcm_mp_cpusys_top_apb_dcm_is_on(void); 35 void dcm_mp_cpusys_top_apb_dcm(bool on); 36 bool dcm_mp_cpusys_top_bus_pll_div_dcm_is_on(void); 37 void dcm_mp_cpusys_top_bus_pll_div_dcm(bool on); 38 bool dcm_mp_cpusys_top_core_stall_dcm_is_on(void); 39 void dcm_mp_cpusys_top_core_stall_dcm(bool on); 40 bool dcm_mp_cpusys_top_cpubiu_dbg_cg_is_on(void); 41 void dcm_mp_cpusys_top_cpubiu_dbg_cg(bool on); 42 bool dcm_mp_cpusys_top_cpubiu_dcm_is_on(void); 43 void dcm_mp_cpusys_top_cpubiu_dcm(bool on); 44 bool dcm_mp_cpusys_top_cpu_pll_div_0_dcm_is_on(void); 45 void dcm_mp_cpusys_top_cpu_pll_div_0_dcm(bool on); 46 bool dcm_mp_cpusys_top_cpu_pll_div_1_dcm_is_on(void); 47 void dcm_mp_cpusys_top_cpu_pll_div_1_dcm(bool on); 48 bool dcm_mp_cpusys_top_fcm_stall_dcm_is_on(void); 49 void dcm_mp_cpusys_top_fcm_stall_dcm(bool on); 50 bool dcm_mp_cpusys_top_last_cor_idle_dcm_is_on(void); 51 void dcm_mp_cpusys_top_last_cor_idle_dcm(bool on); 52 bool dcm_mp_cpusys_top_misc_dcm_is_on(void); 53 void dcm_mp_cpusys_top_misc_dcm(bool on); 54 bool dcm_mp_cpusys_top_mp0_qdcm_is_on(void); 55 void dcm_mp_cpusys_top_mp0_qdcm(bool on); 56 bool dcm_cpccfg_reg_emi_wfifo_is_on(void); 57 void dcm_cpccfg_reg_emi_wfifo(bool on); 58 #endif 59