123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562 |
- /*
- * Copyright (c) 2020, MediaTek Inc. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
- #include <lib/mmio.h>
- #include <lib/utils_def.h>
- #include <mtk_dcm_utils.h>
- #define MP_CPUSYS_TOP_ADB_DCM_REG0_MASK (BIT(17))
- #define MP_CPUSYS_TOP_ADB_DCM_REG1_MASK (BIT(15) | \
- BIT(16) | \
- BIT(17) | \
- BIT(18) | \
- BIT(21))
- #define MP_CPUSYS_TOP_ADB_DCM_REG2_MASK (BIT(15) | \
- BIT(16) | \
- BIT(17) | \
- BIT(18))
- #define MP_CPUSYS_TOP_ADB_DCM_REG0_ON (BIT(17))
- #define MP_CPUSYS_TOP_ADB_DCM_REG1_ON (BIT(15) | \
- BIT(16) | \
- BIT(17) | \
- BIT(18) | \
- BIT(21))
- #define MP_CPUSYS_TOP_ADB_DCM_REG2_ON (BIT(15) | \
- BIT(16) | \
- BIT(17) | \
- BIT(18))
- #define MP_CPUSYS_TOP_ADB_DCM_REG0_OFF ((0x0 << 17))
- #define MP_CPUSYS_TOP_ADB_DCM_REG1_OFF ((0x0 << 15) | \
- (0x0 << 16) | \
- (0x0 << 17) | \
- (0x0 << 18) | \
- (0x0 << 21))
- #define MP_CPUSYS_TOP_ADB_DCM_REG2_OFF ((0x0 << 15) | \
- (0x0 << 16) | \
- (0x0 << 17) | \
- (0x0 << 18))
- bool dcm_mp_cpusys_top_adb_dcm_is_on(void)
- {
- bool ret = true;
- ret &= ((mmio_read_32(MP_ADB_DCM_CFG0) &
- MP_CPUSYS_TOP_ADB_DCM_REG0_MASK) ==
- (unsigned int) MP_CPUSYS_TOP_ADB_DCM_REG0_ON);
- ret &= ((mmio_read_32(MP_ADB_DCM_CFG4) &
- MP_CPUSYS_TOP_ADB_DCM_REG1_MASK) ==
- (unsigned int) MP_CPUSYS_TOP_ADB_DCM_REG1_ON);
- ret &= ((mmio_read_32(MCUSYS_DCM_CFG0) &
- MP_CPUSYS_TOP_ADB_DCM_REG2_MASK) ==
- (unsigned int) MP_CPUSYS_TOP_ADB_DCM_REG2_ON);
- return ret;
- }
- void dcm_mp_cpusys_top_adb_dcm(bool on)
- {
- if (on) {
- /* TINFO = "Turn ON DCM 'mp_cpusys_top_adb_dcm'" */
- mmio_clrsetbits_32(MP_ADB_DCM_CFG0,
- MP_CPUSYS_TOP_ADB_DCM_REG0_MASK,
- MP_CPUSYS_TOP_ADB_DCM_REG0_ON);
- mmio_clrsetbits_32(MP_ADB_DCM_CFG4,
- MP_CPUSYS_TOP_ADB_DCM_REG1_MASK,
- MP_CPUSYS_TOP_ADB_DCM_REG1_ON);
- mmio_clrsetbits_32(MCUSYS_DCM_CFG0,
- MP_CPUSYS_TOP_ADB_DCM_REG2_MASK,
- MP_CPUSYS_TOP_ADB_DCM_REG2_ON);
- } else {
- /* TINFO = "Turn OFF DCM 'mp_cpusys_top_adb_dcm'" */
- mmio_clrsetbits_32(MP_ADB_DCM_CFG0,
- MP_CPUSYS_TOP_ADB_DCM_REG0_MASK,
- MP_CPUSYS_TOP_ADB_DCM_REG0_OFF);
- mmio_clrsetbits_32(MP_ADB_DCM_CFG4,
- MP_CPUSYS_TOP_ADB_DCM_REG1_MASK,
- MP_CPUSYS_TOP_ADB_DCM_REG1_OFF);
- mmio_clrsetbits_32(MCUSYS_DCM_CFG0,
- MP_CPUSYS_TOP_ADB_DCM_REG2_MASK,
- MP_CPUSYS_TOP_ADB_DCM_REG2_OFF);
- }
- }
- #define MP_CPUSYS_TOP_APB_DCM_REG0_MASK (BIT(5))
- #define MP_CPUSYS_TOP_APB_DCM_REG1_MASK (BIT(8))
- #define MP_CPUSYS_TOP_APB_DCM_REG2_MASK (BIT(16))
- #define MP_CPUSYS_TOP_APB_DCM_REG0_ON (BIT(5))
- #define MP_CPUSYS_TOP_APB_DCM_REG1_ON (BIT(8))
- #define MP_CPUSYS_TOP_APB_DCM_REG2_ON (BIT(16))
- #define MP_CPUSYS_TOP_APB_DCM_REG0_OFF ((0x0 << 5))
- #define MP_CPUSYS_TOP_APB_DCM_REG1_OFF ((0x0 << 8))
- #define MP_CPUSYS_TOP_APB_DCM_REG2_OFF ((0x0 << 16))
- bool dcm_mp_cpusys_top_apb_dcm_is_on(void)
- {
- bool ret = true;
- ret &= ((mmio_read_32(MP_MISC_DCM_CFG0) &
- MP_CPUSYS_TOP_APB_DCM_REG0_MASK) ==
- (unsigned int) MP_CPUSYS_TOP_APB_DCM_REG0_ON);
- ret &= ((mmio_read_32(MCUSYS_DCM_CFG0) &
- MP_CPUSYS_TOP_APB_DCM_REG1_MASK) ==
- (unsigned int) MP_CPUSYS_TOP_APB_DCM_REG1_ON);
- ret &= ((mmio_read_32(MP0_DCM_CFG0) &
- MP_CPUSYS_TOP_APB_DCM_REG2_MASK) ==
- (unsigned int) MP_CPUSYS_TOP_APB_DCM_REG2_ON);
- return ret;
- }
- void dcm_mp_cpusys_top_apb_dcm(bool on)
- {
- if (on) {
- /* TINFO = "Turn ON DCM 'mp_cpusys_top_apb_dcm'" */
- mmio_clrsetbits_32(MP_MISC_DCM_CFG0,
- MP_CPUSYS_TOP_APB_DCM_REG0_MASK,
- MP_CPUSYS_TOP_APB_DCM_REG0_ON);
- mmio_clrsetbits_32(MCUSYS_DCM_CFG0,
- MP_CPUSYS_TOP_APB_DCM_REG1_MASK,
- MP_CPUSYS_TOP_APB_DCM_REG1_ON);
- mmio_clrsetbits_32(MP0_DCM_CFG0,
- MP_CPUSYS_TOP_APB_DCM_REG2_MASK,
- MP_CPUSYS_TOP_APB_DCM_REG2_ON);
- } else {
- /* TINFO = "Turn OFF DCM 'mp_cpusys_top_apb_dcm'" */
- mmio_clrsetbits_32(MP_MISC_DCM_CFG0,
- MP_CPUSYS_TOP_APB_DCM_REG0_MASK,
- MP_CPUSYS_TOP_APB_DCM_REG0_OFF);
- mmio_clrsetbits_32(MCUSYS_DCM_CFG0,
- MP_CPUSYS_TOP_APB_DCM_REG1_MASK,
- MP_CPUSYS_TOP_APB_DCM_REG1_OFF);
- mmio_clrsetbits_32(MP0_DCM_CFG0,
- MP_CPUSYS_TOP_APB_DCM_REG2_MASK,
- MP_CPUSYS_TOP_APB_DCM_REG2_OFF);
- }
- }
- #define MP_CPUSYS_TOP_BUS_PLL_DIV_DCM_REG0_MASK (BIT(11))
- #define MP_CPUSYS_TOP_BUS_PLL_DIV_DCM_REG0_ON (BIT(11))
- #define MP_CPUSYS_TOP_BUS_PLL_DIV_DCM_REG0_OFF ((0x0 << 11))
- bool dcm_mp_cpusys_top_bus_pll_div_dcm_is_on(void)
- {
- bool ret = true;
- ret &= ((mmio_read_32(BUS_PLLDIV_CFG) &
- MP_CPUSYS_TOP_BUS_PLL_DIV_DCM_REG0_MASK) ==
- (unsigned int) MP_CPUSYS_TOP_BUS_PLL_DIV_DCM_REG0_ON);
- return ret;
- }
- void dcm_mp_cpusys_top_bus_pll_div_dcm(bool on)
- {
- if (on) {
- /* TINFO = "Turn ON DCM 'mp_cpusys_top_bus_pll_div_dcm'" */
- mmio_clrsetbits_32(BUS_PLLDIV_CFG,
- MP_CPUSYS_TOP_BUS_PLL_DIV_DCM_REG0_MASK,
- MP_CPUSYS_TOP_BUS_PLL_DIV_DCM_REG0_ON);
- } else {
- /* TINFO = "Turn OFF DCM 'mp_cpusys_top_bus_pll_div_dcm'" */
- mmio_clrsetbits_32(BUS_PLLDIV_CFG,
- MP_CPUSYS_TOP_BUS_PLL_DIV_DCM_REG0_MASK,
- MP_CPUSYS_TOP_BUS_PLL_DIV_DCM_REG0_OFF);
- }
- }
- #define MP_CPUSYS_TOP_CORE_STALL_DCM_REG0_MASK (BIT(0))
- #define MP_CPUSYS_TOP_CORE_STALL_DCM_REG0_ON (BIT(0))
- #define MP_CPUSYS_TOP_CORE_STALL_DCM_REG0_OFF ((0x0 << 0))
- bool dcm_mp_cpusys_top_core_stall_dcm_is_on(void)
- {
- bool ret = true;
- ret &= ((mmio_read_32(MP0_DCM_CFG7) &
- MP_CPUSYS_TOP_CORE_STALL_DCM_REG0_MASK) ==
- (unsigned int) MP_CPUSYS_TOP_CORE_STALL_DCM_REG0_ON);
- return ret;
- }
- void dcm_mp_cpusys_top_core_stall_dcm(bool on)
- {
- if (on) {
- /* TINFO = "Turn ON DCM 'mp_cpusys_top_core_stall_dcm'" */
- mmio_clrsetbits_32(MP0_DCM_CFG7,
- MP_CPUSYS_TOP_CORE_STALL_DCM_REG0_MASK,
- MP_CPUSYS_TOP_CORE_STALL_DCM_REG0_ON);
- } else {
- /* TINFO = "Turn OFF DCM 'mp_cpusys_top_core_stall_dcm'" */
- mmio_clrsetbits_32(MP0_DCM_CFG7,
- MP_CPUSYS_TOP_CORE_STALL_DCM_REG0_MASK,
- MP_CPUSYS_TOP_CORE_STALL_DCM_REG0_OFF);
- }
- }
- #define MP_CPUSYS_TOP_CPUBIU_DCM_REG0_MASK ((0xffff << 0))
- #define MP_CPUSYS_TOP_CPUBIU_DCM_REG0_ON ((0xffff << 0))
- #define MP_CPUSYS_TOP_CPUBIU_DCM_REG0_OFF ((0x0 << 0))
- bool dcm_mp_cpusys_top_cpubiu_dcm_is_on(void)
- {
- bool ret = true;
- ret &= ((mmio_read_32(MCSI_DCM0) &
- MP_CPUSYS_TOP_CPUBIU_DCM_REG0_MASK) ==
- (unsigned int) MP_CPUSYS_TOP_CPUBIU_DCM_REG0_ON);
- return ret;
- }
- void dcm_mp_cpusys_top_cpubiu_dcm(bool on)
- {
- if (on) {
- /* TINFO = "Turn ON DCM 'mp_cpusys_top_cpubiu_dcm'" */
- mmio_clrsetbits_32(MCSI_DCM0,
- MP_CPUSYS_TOP_CPUBIU_DCM_REG0_MASK,
- MP_CPUSYS_TOP_CPUBIU_DCM_REG0_ON);
- } else {
- /* TINFO = "Turn OFF DCM 'mp_cpusys_top_cpubiu_dcm'" */
- mmio_clrsetbits_32(MCSI_DCM0,
- MP_CPUSYS_TOP_CPUBIU_DCM_REG0_MASK,
- MP_CPUSYS_TOP_CPUBIU_DCM_REG0_OFF);
- }
- }
- #define MP_CPUSYS_TOP_CPU_PLL_DIV_0_DCM_REG0_MASK (BIT(11))
- #define MP_CPUSYS_TOP_CPU_PLL_DIV_0_DCM_REG0_ON (BIT(11))
- #define MP_CPUSYS_TOP_CPU_PLL_DIV_0_DCM_REG0_OFF ((0x0 << 11))
- bool dcm_mp_cpusys_top_cpu_pll_div_0_dcm_is_on(void)
- {
- bool ret = true;
- ret &= ((mmio_read_32(CPU_PLLDIV_CFG0) &
- MP_CPUSYS_TOP_CPU_PLL_DIV_0_DCM_REG0_MASK) ==
- (unsigned int) MP_CPUSYS_TOP_CPU_PLL_DIV_0_DCM_REG0_ON);
- return ret;
- }
- void dcm_mp_cpusys_top_cpu_pll_div_0_dcm(bool on)
- {
- if (on) {
- /* TINFO = "Turn ON DCM 'mp_cpusys_top_cpu_pll_div_0_dcm'" */
- mmio_clrsetbits_32(CPU_PLLDIV_CFG0,
- MP_CPUSYS_TOP_CPU_PLL_DIV_0_DCM_REG0_MASK,
- MP_CPUSYS_TOP_CPU_PLL_DIV_0_DCM_REG0_ON);
- } else {
- /* TINFO = "Turn OFF DCM 'mp_cpusys_top_cpu_pll_div_0_dcm'" */
- mmio_clrsetbits_32(CPU_PLLDIV_CFG0,
- MP_CPUSYS_TOP_CPU_PLL_DIV_0_DCM_REG0_MASK,
- MP_CPUSYS_TOP_CPU_PLL_DIV_0_DCM_REG0_OFF);
- }
- }
- #define MP_CPUSYS_TOP_CPU_PLL_DIV_1_DCM_REG0_MASK (BIT(11))
- #define MP_CPUSYS_TOP_CPU_PLL_DIV_1_DCM_REG0_ON (BIT(11))
- #define MP_CPUSYS_TOP_CPU_PLL_DIV_1_DCM_REG0_OFF ((0x0 << 11))
- bool dcm_mp_cpusys_top_cpu_pll_div_1_dcm_is_on(void)
- {
- bool ret = true;
- ret &= ((mmio_read_32(CPU_PLLDIV_CFG1) &
- MP_CPUSYS_TOP_CPU_PLL_DIV_1_DCM_REG0_MASK) ==
- (unsigned int) MP_CPUSYS_TOP_CPU_PLL_DIV_1_DCM_REG0_ON);
- return ret;
- }
- void dcm_mp_cpusys_top_cpu_pll_div_1_dcm(bool on)
- {
- if (on) {
- /* TINFO = "Turn ON DCM 'mp_cpusys_top_cpu_pll_div_1_dcm'" */
- mmio_clrsetbits_32(CPU_PLLDIV_CFG1,
- MP_CPUSYS_TOP_CPU_PLL_DIV_1_DCM_REG0_MASK,
- MP_CPUSYS_TOP_CPU_PLL_DIV_1_DCM_REG0_ON);
- } else {
- /* TINFO = "Turn OFF DCM 'mp_cpusys_top_cpu_pll_div_1_dcm'" */
- mmio_clrsetbits_32(CPU_PLLDIV_CFG1,
- MP_CPUSYS_TOP_CPU_PLL_DIV_1_DCM_REG0_MASK,
- MP_CPUSYS_TOP_CPU_PLL_DIV_1_DCM_REG0_OFF);
- }
- }
- #define MP_CPUSYS_TOP_CPU_PLL_DIV_2_DCM_REG0_MASK (BIT(11))
- #define MP_CPUSYS_TOP_CPU_PLL_DIV_2_DCM_REG0_ON (BIT(11))
- #define MP_CPUSYS_TOP_CPU_PLL_DIV_2_DCM_REG0_OFF ((0x0 << 11))
- bool dcm_mp_cpusys_top_cpu_pll_div_2_dcm_is_on(void)
- {
- bool ret = true;
- ret &= ((mmio_read_32(CPU_PLLDIV_CFG2) &
- MP_CPUSYS_TOP_CPU_PLL_DIV_2_DCM_REG0_MASK) ==
- (unsigned int) MP_CPUSYS_TOP_CPU_PLL_DIV_2_DCM_REG0_ON);
- return ret;
- }
- void dcm_mp_cpusys_top_cpu_pll_div_2_dcm(bool on)
- {
- if (on) {
- /* TINFO = "Turn ON DCM 'mp_cpusys_top_cpu_pll_div_2_dcm'" */
- mmio_clrsetbits_32(CPU_PLLDIV_CFG2,
- MP_CPUSYS_TOP_CPU_PLL_DIV_2_DCM_REG0_MASK,
- MP_CPUSYS_TOP_CPU_PLL_DIV_2_DCM_REG0_ON);
- } else {
- /* TINFO = "Turn OFF DCM 'mp_cpusys_top_cpu_pll_div_2_dcm'" */
- mmio_clrsetbits_32(CPU_PLLDIV_CFG2,
- MP_CPUSYS_TOP_CPU_PLL_DIV_2_DCM_REG0_MASK,
- MP_CPUSYS_TOP_CPU_PLL_DIV_2_DCM_REG0_OFF);
- }
- }
- #define MP_CPUSYS_TOP_CPU_PLL_DIV_3_DCM_REG0_MASK (BIT(11))
- #define MP_CPUSYS_TOP_CPU_PLL_DIV_3_DCM_REG0_ON (BIT(11))
- #define MP_CPUSYS_TOP_CPU_PLL_DIV_3_DCM_REG0_OFF ((0x0 << 11))
- bool dcm_mp_cpusys_top_cpu_pll_div_3_dcm_is_on(void)
- {
- bool ret = true;
- ret &= ((mmio_read_32(CPU_PLLDIV_CFG3) &
- MP_CPUSYS_TOP_CPU_PLL_DIV_3_DCM_REG0_MASK) ==
- (unsigned int) MP_CPUSYS_TOP_CPU_PLL_DIV_3_DCM_REG0_ON);
- return ret;
- }
- void dcm_mp_cpusys_top_cpu_pll_div_3_dcm(bool on)
- {
- if (on) {
- /* TINFO = "Turn ON DCM 'mp_cpusys_top_cpu_pll_div_3_dcm'" */
- mmio_clrsetbits_32(CPU_PLLDIV_CFG3,
- MP_CPUSYS_TOP_CPU_PLL_DIV_3_DCM_REG0_MASK,
- MP_CPUSYS_TOP_CPU_PLL_DIV_3_DCM_REG0_ON);
- } else {
- /* TINFO = "Turn OFF DCM 'mp_cpusys_top_cpu_pll_div_3_dcm'" */
- mmio_clrsetbits_32(CPU_PLLDIV_CFG3,
- MP_CPUSYS_TOP_CPU_PLL_DIV_3_DCM_REG0_MASK,
- MP_CPUSYS_TOP_CPU_PLL_DIV_3_DCM_REG0_OFF);
- }
- }
- #define MP_CPUSYS_TOP_CPU_PLL_DIV_4_DCM_REG0_MASK (BIT(11))
- #define MP_CPUSYS_TOP_CPU_PLL_DIV_4_DCM_REG0_ON (BIT(11))
- #define MP_CPUSYS_TOP_CPU_PLL_DIV_4_DCM_REG0_OFF ((0x0 << 11))
- bool dcm_mp_cpusys_top_cpu_pll_div_4_dcm_is_on(void)
- {
- bool ret = true;
- ret &= ((mmio_read_32(CPU_PLLDIV_CFG4) &
- MP_CPUSYS_TOP_CPU_PLL_DIV_4_DCM_REG0_MASK) ==
- (unsigned int) MP_CPUSYS_TOP_CPU_PLL_DIV_4_DCM_REG0_ON);
- return ret;
- }
- void dcm_mp_cpusys_top_cpu_pll_div_4_dcm(bool on)
- {
- if (on) {
- /* TINFO = "Turn ON DCM 'mp_cpusys_top_cpu_pll_div_4_dcm'" */
- mmio_clrsetbits_32(CPU_PLLDIV_CFG4,
- MP_CPUSYS_TOP_CPU_PLL_DIV_4_DCM_REG0_MASK,
- MP_CPUSYS_TOP_CPU_PLL_DIV_4_DCM_REG0_ON);
- } else {
- /* TINFO = "Turn OFF DCM 'mp_cpusys_top_cpu_pll_div_4_dcm'" */
- mmio_clrsetbits_32(CPU_PLLDIV_CFG4,
- MP_CPUSYS_TOP_CPU_PLL_DIV_4_DCM_REG0_MASK,
- MP_CPUSYS_TOP_CPU_PLL_DIV_4_DCM_REG0_OFF);
- }
- }
- #define MP_CPUSYS_TOP_FCM_STALL_DCM_REG0_MASK (BIT(4))
- #define MP_CPUSYS_TOP_FCM_STALL_DCM_REG0_ON (BIT(4))
- #define MP_CPUSYS_TOP_FCM_STALL_DCM_REG0_OFF ((0x0 << 4))
- bool dcm_mp_cpusys_top_fcm_stall_dcm_is_on(void)
- {
- bool ret = true;
- ret &= ((mmio_read_32(MP0_DCM_CFG7) &
- MP_CPUSYS_TOP_FCM_STALL_DCM_REG0_MASK) ==
- (unsigned int) MP_CPUSYS_TOP_FCM_STALL_DCM_REG0_ON);
- return ret;
- }
- void dcm_mp_cpusys_top_fcm_stall_dcm(bool on)
- {
- if (on) {
- /* TINFO = "Turn ON DCM 'mp_cpusys_top_fcm_stall_dcm'" */
- mmio_clrsetbits_32(MP0_DCM_CFG7,
- MP_CPUSYS_TOP_FCM_STALL_DCM_REG0_MASK,
- MP_CPUSYS_TOP_FCM_STALL_DCM_REG0_ON);
- } else {
- /* TINFO = "Turn OFF DCM 'mp_cpusys_top_fcm_stall_dcm'" */
- mmio_clrsetbits_32(MP0_DCM_CFG7,
- MP_CPUSYS_TOP_FCM_STALL_DCM_REG0_MASK,
- MP_CPUSYS_TOP_FCM_STALL_DCM_REG0_OFF);
- }
- }
- #define MP_CPUSYS_TOP_LAST_COR_IDLE_DCM_REG0_MASK ((0x1U << 31))
- #define MP_CPUSYS_TOP_LAST_COR_IDLE_DCM_REG0_ON ((0x1U << 31))
- #define MP_CPUSYS_TOP_LAST_COR_IDLE_DCM_REG0_OFF ((0x0U << 31))
- bool dcm_mp_cpusys_top_last_cor_idle_dcm_is_on(void)
- {
- bool ret = true;
- ret &= ((mmio_read_32(BUS_PLLDIV_CFG) &
- MP_CPUSYS_TOP_LAST_COR_IDLE_DCM_REG0_MASK) ==
- (unsigned int) MP_CPUSYS_TOP_LAST_COR_IDLE_DCM_REG0_ON);
- return ret;
- }
- void dcm_mp_cpusys_top_last_cor_idle_dcm(bool on)
- {
- if (on) {
- /* TINFO = "Turn ON DCM 'mp_cpusys_top_last_cor_idle_dcm'" */
- mmio_clrsetbits_32(BUS_PLLDIV_CFG,
- MP_CPUSYS_TOP_LAST_COR_IDLE_DCM_REG0_MASK,
- MP_CPUSYS_TOP_LAST_COR_IDLE_DCM_REG0_ON);
- } else {
- /* TINFO = "Turn OFF DCM 'mp_cpusys_top_last_cor_idle_dcm'" */
- mmio_clrsetbits_32(BUS_PLLDIV_CFG,
- MP_CPUSYS_TOP_LAST_COR_IDLE_DCM_REG0_MASK,
- MP_CPUSYS_TOP_LAST_COR_IDLE_DCM_REG0_OFF);
- }
- }
- #define MP_CPUSYS_TOP_MISC_DCM_REG0_MASK (BIT(1) | \
- BIT(4))
- #define MP_CPUSYS_TOP_MISC_DCM_REG0_ON (BIT(1) | \
- BIT(4))
- #define MP_CPUSYS_TOP_MISC_DCM_REG0_OFF ((0x0 << 1) | \
- (0x0 << 4))
- bool dcm_mp_cpusys_top_misc_dcm_is_on(void)
- {
- bool ret = true;
- ret &= ((mmio_read_32(MP_MISC_DCM_CFG0) &
- MP_CPUSYS_TOP_MISC_DCM_REG0_MASK) ==
- (unsigned int) MP_CPUSYS_TOP_MISC_DCM_REG0_ON);
- return ret;
- }
- void dcm_mp_cpusys_top_misc_dcm(bool on)
- {
- if (on) {
- /* TINFO = "Turn ON DCM 'mp_cpusys_top_misc_dcm'" */
- mmio_clrsetbits_32(MP_MISC_DCM_CFG0,
- MP_CPUSYS_TOP_MISC_DCM_REG0_MASK,
- MP_CPUSYS_TOP_MISC_DCM_REG0_ON);
- } else {
- /* TINFO = "Turn OFF DCM 'mp_cpusys_top_misc_dcm'" */
- mmio_clrsetbits_32(MP_MISC_DCM_CFG0,
- MP_CPUSYS_TOP_MISC_DCM_REG0_MASK,
- MP_CPUSYS_TOP_MISC_DCM_REG0_OFF);
- }
- }
- #define MP_CPUSYS_TOP_MP0_QDCM_REG0_MASK (BIT(3))
- #define MP_CPUSYS_TOP_MP0_QDCM_REG1_MASK (BIT(0) | \
- BIT(1) | \
- BIT(2) | \
- BIT(3))
- #define MP_CPUSYS_TOP_MP0_QDCM_REG0_ON (BIT(3))
- #define MP_CPUSYS_TOP_MP0_QDCM_REG1_ON (BIT(0) | \
- BIT(1) | \
- BIT(2) | \
- BIT(3))
- #define MP_CPUSYS_TOP_MP0_QDCM_REG0_OFF ((0x0 << 3))
- #define MP_CPUSYS_TOP_MP0_QDCM_REG1_OFF ((0x0 << 0) | \
- (0x0 << 1) | \
- (0x0 << 2) | \
- (0x0 << 3))
- bool dcm_mp_cpusys_top_mp0_qdcm_is_on(void)
- {
- bool ret = true;
- ret &= ((mmio_read_32(MP_MISC_DCM_CFG0) &
- MP_CPUSYS_TOP_MP0_QDCM_REG0_MASK) ==
- (unsigned int) MP_CPUSYS_TOP_MP0_QDCM_REG0_ON);
- ret &= ((mmio_read_32(MP0_DCM_CFG0) &
- MP_CPUSYS_TOP_MP0_QDCM_REG1_MASK) ==
- (unsigned int) MP_CPUSYS_TOP_MP0_QDCM_REG1_ON);
- return ret;
- }
- void dcm_mp_cpusys_top_mp0_qdcm(bool on)
- {
- if (on) {
- /* TINFO = "Turn ON DCM 'mp_cpusys_top_mp0_qdcm'" */
- mmio_clrsetbits_32(MP_MISC_DCM_CFG0,
- MP_CPUSYS_TOP_MP0_QDCM_REG0_MASK,
- MP_CPUSYS_TOP_MP0_QDCM_REG0_ON);
- mmio_clrsetbits_32(MP0_DCM_CFG0,
- MP_CPUSYS_TOP_MP0_QDCM_REG1_MASK,
- MP_CPUSYS_TOP_MP0_QDCM_REG1_ON);
- } else {
- /* TINFO = "Turn OFF DCM 'mp_cpusys_top_mp0_qdcm'" */
- mmio_clrsetbits_32(MP_MISC_DCM_CFG0,
- MP_CPUSYS_TOP_MP0_QDCM_REG0_MASK,
- MP_CPUSYS_TOP_MP0_QDCM_REG0_OFF);
- mmio_clrsetbits_32(MP0_DCM_CFG0,
- MP_CPUSYS_TOP_MP0_QDCM_REG1_MASK,
- MP_CPUSYS_TOP_MP0_QDCM_REG1_OFF);
- }
- }
- #define CPCCFG_REG_EMI_WFIFO_REG0_MASK (BIT(0) | \
- BIT(1) | \
- BIT(2) | \
- BIT(3))
- #define CPCCFG_REG_EMI_WFIFO_REG0_ON (BIT(0) | \
- BIT(1) | \
- BIT(2) | \
- BIT(3))
- #define CPCCFG_REG_EMI_WFIFO_REG0_OFF ((0x0 << 0) | \
- (0x0 << 1) | \
- (0x0 << 2) | \
- (0x0 << 3))
- bool dcm_cpccfg_reg_emi_wfifo_is_on(void)
- {
- bool ret = true;
- ret &= ((mmio_read_32(EMI_WFIFO) &
- CPCCFG_REG_EMI_WFIFO_REG0_MASK) ==
- (unsigned int) CPCCFG_REG_EMI_WFIFO_REG0_ON);
- return ret;
- }
- void dcm_cpccfg_reg_emi_wfifo(bool on)
- {
- if (on) {
- /* TINFO = "Turn ON DCM 'cpccfg_reg_emi_wfifo'" */
- mmio_clrsetbits_32(EMI_WFIFO,
- CPCCFG_REG_EMI_WFIFO_REG0_MASK,
- CPCCFG_REG_EMI_WFIFO_REG0_ON);
- } else {
- /* TINFO = "Turn OFF DCM 'cpccfg_reg_emi_wfifo'" */
- mmio_clrsetbits_32(EMI_WFIFO,
- CPCCFG_REG_EMI_WFIFO_REG0_MASK,
- CPCCFG_REG_EMI_WFIFO_REG0_OFF);
- }
- }
|