static void pmu_sleep_mode_config(void) { uint32_t pwrmd_core, pwrmd_com; pwrmd_core = BIT(pmu_mdcr_cpu0_pd) | BIT(pmu_mdcr_scu_l_pd) | BIT(pmu_mdcr_l2_flush) | BIT(pmu_mdcr_l2_idle) | BIT(pmu_mdcr_clr_clst_l) | BIT(pmu_mdcr_clr_core) | BIT(pmu_mdcr_clr_cci) | BIT(pmu_mdcr_core_pd); pwrmd_com = BIT(pmu_mode_en) | BIT(pmu_mode_sref_enter) | BIT(pmu_mode_pwr_off); regs_updata_bit_set(PMU_BASE + PMU_WKUP_CFG2, pmu_cluster_l_wkup_en); regs_updata_bit_set(PMU_BASE + PMU_WKUP_CFG2, pmu_cluster_b_wkup_en); regs_updata_bit_clr(PMU_BASE + PMU_WKUP_CFG2, pmu_gpio_wkup_en); mmio_write_32(PMU_BASE + PMU_PLLLOCK_CNT, CYCL_24M_CNT_MS(2)); mmio_write_32(PMU_BASE + PMU_PLLRST_CNT, CYCL_24M_CNT_US(100)); mmio_write_32(PMU_BASE + PMU_STABLE_CNT, CYCL_24M_CNT_MS(2)); mmio_write_32(PMU_BASE + PMU_PWRMD_CORE, pwrmd_core); mmio_write_32(PMU_BASE + PMU_PWRMD_COM, pwrmd_com); dsb(); }
static void sys_slp_config(void) { uint32_t slp_mode_cfg = 0; mmio_write_32(PMU_BASE + PMU_CCI500_CON, BIT_WITH_WMSK(PMU_CLR_PREQ_CCI500_HW) | BIT_WITH_WMSK(PMU_CLR_QREQ_CCI500_HW) | BIT_WITH_WMSK(PMU_QGATING_CCI500_CFG)); mmio_write_32(PMU_BASE + PMU_ADB400_CON, BIT_WITH_WMSK(PMU_CLR_CORE_L_HW) | BIT_WITH_WMSK(PMU_CLR_CORE_L_2GIC_HW) | BIT_WITH_WMSK(PMU_CLR_GIC2_CORE_L_HW)); mmio_write_32(PMUGRF_BASE + PMUGRF_GPIO1A_IOMUX, BIT_WITH_WMSK(AP_PWROFF)); slp_mode_cfg = BIT(PMU_PWR_MODE_EN) | BIT(PMU_POWER_OFF_REQ_CFG) | BIT(PMU_CPU0_PD_EN) | BIT(PMU_L2_FLUSH_EN) | BIT(PMU_L2_IDLE_EN) | BIT(PMU_SCU_PD_EN); mmio_setbits_32(PMU_BASE + PMU_WKUP_CFG4, PMU_CLUSTER_L_WKUP_EN); mmio_setbits_32(PMU_BASE + PMU_WKUP_CFG4, PMU_CLUSTER_B_WKUP_EN); mmio_clrbits_32(PMU_BASE + PMU_WKUP_CFG4, PMU_GPIO_WKUP_EN); mmio_write_32(PMU_BASE + PMU_PWRMODE_CON, slp_mode_cfg); mmio_write_32(PMU_BASE + PMU_STABLE_CNT, CYCL_24M_CNT_MS(5)); mmio_write_32(PMU_BASE + PMU_SCU_L_PWRDN_CNT, CYCL_24M_CNT_MS(2)); mmio_write_32(PMU_BASE + PMU_SCU_L_PWRUP_CNT, CYCL_24M_CNT_MS(2)); mmio_write_32(PMU_BASE + PMU_SCU_B_PWRDN_CNT, CYCL_24M_CNT_MS(2)); mmio_write_32(PMU_BASE + PMU_SCU_B_PWRUP_CNT, CYCL_24M_CNT_MS(2)); }