xref: /rk3399_ARM-atf/plat/mediatek/mt8196/drivers/dcm/mtk_dcm.c (revision 2c09bf93f0cfa0dae8a8829921e62e6093bbeacf)
1*e578702fSGuangjie Song /*
2*e578702fSGuangjie Song  * Copyright (c) 2025, MediaTek Inc. All rights reserved.
3*e578702fSGuangjie Song  *
4*e578702fSGuangjie Song  * SPDX-License-Identifier: BSD-3-Clause
5*e578702fSGuangjie Song  */
6*e578702fSGuangjie Song 
7*e578702fSGuangjie Song #include <common/debug.h>
8*e578702fSGuangjie Song #include <lib/mmio.h>
9*e578702fSGuangjie Song #include <lib/mtk_init/mtk_init.h>
10*e578702fSGuangjie Song #include <mtk_dcm_utils.h>
11*e578702fSGuangjie Song 
dcm_infra(bool on)12*e578702fSGuangjie Song static void dcm_infra(bool on)
13*e578702fSGuangjie Song {
14*e578702fSGuangjie Song 	dcm_bcrm_apinfra_io_ctrl_ao_infra_bus_dcm(on);
15*e578702fSGuangjie Song 	dcm_bcrm_apinfra_io_noc_ao_infra_bus_dcm(on);
16*e578702fSGuangjie Song 	dcm_bcrm_apinfra_mem_ctrl_ao_infra_bus_dcm(on);
17*e578702fSGuangjie Song 	dcm_bcrm_apinfra_mem_intf_noc_ao_infra_bus_dcm(on);
18*e578702fSGuangjie Song }
19*e578702fSGuangjie Song 
dcm_mcusys(bool on)20*e578702fSGuangjie Song static void dcm_mcusys(bool on)
21*e578702fSGuangjie Song {
22*e578702fSGuangjie Song 	dcm_mcusys_par_wrap_mcu_misc_dcm(on);
23*e578702fSGuangjie Song }
24*e578702fSGuangjie Song 
dcm_mcusys_acp(bool on)25*e578702fSGuangjie Song static void dcm_mcusys_acp(bool on)
26*e578702fSGuangjie Song {
27*e578702fSGuangjie Song 	dcm_mcusys_par_wrap_mcu_acp_dcm(on);
28*e578702fSGuangjie Song }
29*e578702fSGuangjie Song 
dcm_mcusys_adb(bool on)30*e578702fSGuangjie Song static void dcm_mcusys_adb(bool on)
31*e578702fSGuangjie Song {
32*e578702fSGuangjie Song 	dcm_mcusys_par_wrap_mcu_adb_dcm(on);
33*e578702fSGuangjie Song }
34*e578702fSGuangjie Song 
dcm_mcusys_apb(bool on)35*e578702fSGuangjie Song static void dcm_mcusys_apb(bool on)
36*e578702fSGuangjie Song {
37*e578702fSGuangjie Song 	dcm_mcusys_par_wrap_mcu_apb_dcm(on);
38*e578702fSGuangjie Song }
39*e578702fSGuangjie Song 
dcm_mcusys_bus(bool on)40*e578702fSGuangjie Song static void dcm_mcusys_bus(bool on)
41*e578702fSGuangjie Song {
42*e578702fSGuangjie Song 	dcm_mcusys_par_wrap_mcu_bus_qdcm(on);
43*e578702fSGuangjie Song }
44*e578702fSGuangjie Song 
dcm_mcusys_cbip(bool on)45*e578702fSGuangjie Song static void dcm_mcusys_cbip(bool on)
46*e578702fSGuangjie Song {
47*e578702fSGuangjie Song 	dcm_mcusys_par_wrap_mcu_cbip_dcm(on);
48*e578702fSGuangjie Song }
49*e578702fSGuangjie Song 
dcm_mcusys_chi_mon(bool on)50*e578702fSGuangjie Song static void dcm_mcusys_chi_mon(bool on)
51*e578702fSGuangjie Song {
52*e578702fSGuangjie Song 	dcm_mcusys_par_wrap_mcu_chi_mon_dcm(on);
53*e578702fSGuangjie Song }
54*e578702fSGuangjie Song 
dcm_mcusys_core(bool on)55*e578702fSGuangjie Song static void dcm_mcusys_core(bool on)
56*e578702fSGuangjie Song {
57*e578702fSGuangjie Song 	dcm_mcusys_par_wrap_mcu_core_qdcm(on);
58*e578702fSGuangjie Song }
59*e578702fSGuangjie Song 
dcm_mcusys_dsu_acp(bool on)60*e578702fSGuangjie Song static void dcm_mcusys_dsu_acp(bool on)
61*e578702fSGuangjie Song {
62*e578702fSGuangjie Song 	dcm_mcusys_par_wrap_mcu_dsu_acp_dcm(on);
63*e578702fSGuangjie Song }
64*e578702fSGuangjie Song 
dcm_mcusys_ebg(bool on)65*e578702fSGuangjie Song static void dcm_mcusys_ebg(bool on)
66*e578702fSGuangjie Song {
67*e578702fSGuangjie Song 	dcm_mcusys_par_wrap_mcu_ebg_dcm(on);
68*e578702fSGuangjie Song }
69*e578702fSGuangjie Song 
dcm_mcusys_gic_spi(bool on)70*e578702fSGuangjie Song static void dcm_mcusys_gic_spi(bool on)
71*e578702fSGuangjie Song {
72*e578702fSGuangjie Song 	dcm_mcusys_par_wrap_mcu_gic_spi_dcm(on);
73*e578702fSGuangjie Song }
74*e578702fSGuangjie Song 
dcm_mcusys_io(bool on)75*e578702fSGuangjie Song static void dcm_mcusys_io(bool on)
76*e578702fSGuangjie Song {
77*e578702fSGuangjie Song 	dcm_mcusys_par_wrap_mcu_io_dcm(on);
78*e578702fSGuangjie Song }
79*e578702fSGuangjie Song 
dcm_mcusys_l3c(bool on)80*e578702fSGuangjie Song static void dcm_mcusys_l3c(bool on)
81*e578702fSGuangjie Song {
82*e578702fSGuangjie Song 	dcm_mcusys_par_wrap_mcu_l3c_dcm(on);
83*e578702fSGuangjie Song }
84*e578702fSGuangjie Song 
dcm_mcusys_stall(bool on)85*e578702fSGuangjie Song static void dcm_mcusys_stall(bool on)
86*e578702fSGuangjie Song {
87*e578702fSGuangjie Song 	dcm_mcusys_par_wrap_mcu_stalldcm(on);
88*e578702fSGuangjie Song }
89*e578702fSGuangjie Song 
dcm_vlp(bool on)90*e578702fSGuangjie Song static void dcm_vlp(bool on)
91*e578702fSGuangjie Song {
92*e578702fSGuangjie Song 	dcm_vlp_ao_bcrm_vlp_bus_dcm(on);
93*e578702fSGuangjie Song }
94*e578702fSGuangjie Song 
mtk_dcm_init(void)95*e578702fSGuangjie Song int mtk_dcm_init(void)
96*e578702fSGuangjie Song {
97*e578702fSGuangjie Song 	dcm_infra(true);
98*e578702fSGuangjie Song 	dcm_mcusys(true);
99*e578702fSGuangjie Song 	dcm_mcusys_acp(true);
100*e578702fSGuangjie Song 	dcm_mcusys_adb(true);
101*e578702fSGuangjie Song 	dcm_mcusys_apb(true);
102*e578702fSGuangjie Song 	dcm_mcusys_bus(true);
103*e578702fSGuangjie Song 	dcm_mcusys_cbip(true);
104*e578702fSGuangjie Song 	dcm_mcusys_chi_mon(true);
105*e578702fSGuangjie Song 	dcm_mcusys_core(true);
106*e578702fSGuangjie Song 	dcm_mcusys_dsu_acp(true);
107*e578702fSGuangjie Song 	dcm_mcusys_ebg(true);
108*e578702fSGuangjie Song 	dcm_mcusys_gic_spi(true);
109*e578702fSGuangjie Song 	dcm_mcusys_io(true);
110*e578702fSGuangjie Song 	dcm_mcusys_l3c(true);
111*e578702fSGuangjie Song 	dcm_mcusys_stall(true);
112*e578702fSGuangjie Song 	dcm_vlp(true);
113*e578702fSGuangjie Song 
114*e578702fSGuangjie Song 	return 0;
115*e578702fSGuangjie Song }
116*e578702fSGuangjie Song 
117*e578702fSGuangjie Song MTK_PLAT_SETUP_0_INIT(mtk_dcm_init);
118