static void spm_trigger_wfi_for_sodi(struct pwr_ctrl *pwrctrl)
{
    if (is_cpu_pdn(pwrctrl->pcm_flags)) {    
        //sodi_debug("enter mt_cpu_dormant(CPU_SODI_MODE)\n");
        mt_cpu_dormant(CPU_SODI_MODE);
        //sodi_debug("exit mt_cpu_dormant(CPU_SODI_MODE)\n");
    } else {
        u32 val = 0;
        
        //backup MP0_AXI_CONFIG
    	val = reg_read(MP0_AXI_CONFIG);
    	
    	//disable snoop function 
        MCUSYS_SMC_WRITE(MP0_AXI_CONFIG, val | ACINACTM);
        
        sodi_debug("enter legacy WIFI, MP0_AXI_CONFIG=0x%x\n", reg_read(MP0_AXI_CONFIG));
        
        //enter WFI
        wfi_with_sync();
        
        //restore MP0_AXI_CONFIG
        MCUSYS_SMC_WRITE(MP0_AXI_CONFIG, val);
        
        sodi_debug("exit legacy WIFI, MP0_AXI_CONFIG=0x%x\n", reg_read(MP0_AXI_CONFIG));
    }
}
int dcm_mcusys(ENUM_MCUSYS_DCM on)
{
        if (on == MCUSYS_DCM_OFF) {
                //MCUSYS CCI CTRL, 
                MCUSYS_SMC_WRITE(MCUCFG_CCI_CLK_CTRL,
                                 aor(reg_read(MCUCFG_CCI_CLK_CTRL), ~MCUCFG_CCI_CLK_CTRL_MASK, MCUCFG_CCI_CLK_CTRL_OFF));  
                //L2C SRAM DCM
                MCUSYS_SMC_WRITE(MCUCFG_L2C_SRAM_CTRL, 
                                 aor(reg_read(MCUCFG_L2C_SRAM_CTRL), ~MCUCFG_L2C_SRAM_CTRL_MASK, MCUCFG_L2C_SRAM_CTRL_OFF));

                //bus_fabric_dcm_ctrl
                MCUSYS_SMC_WRITE(MCUCFG_BUS_FABRIC_DCM_CTRL,
                          aor(reg_read(MCUCFG_BUS_FABRIC_DCM_CTRL), ~MCUCFG_BUS_FABRIC_DCM_CTRL_MASK, MCUCFG_BUS_FABRIC_DCM_CTRL_OFF)); 
        }
        else {
                MCUSYS_SMC_WRITE(MCUCFG_CCI_CLK_CTRL,
                                 aor(reg_read(MCUCFG_CCI_CLK_CTRL), ~MCUCFG_CCI_CLK_CTRL_MASK, MCUCFG_CCI_CLK_CTRL_ON));  
                //L2C SRAM DCM
                MCUSYS_SMC_WRITE(MCUCFG_L2C_SRAM_CTRL, 
                                 aor(reg_read(MCUCFG_L2C_SRAM_CTRL), ~MCUCFG_L2C_SRAM_CTRL_MASK, MCUCFG_L2C_SRAM_CTRL_ON));

                //bus_fabric_dcm_ctrl
                MCUSYS_SMC_WRITE(MCUCFG_BUS_FABRIC_DCM_CTRL,
                          aor(reg_read(MCUCFG_BUS_FABRIC_DCM_CTRL), ~MCUCFG_BUS_FABRIC_DCM_CTRL_MASK, MCUCFG_BUS_FABRIC_DCM_CTRL_ON)); 
        }

        return 0;
}
Exemple #3
0
static void spm_trigger_wfi_for_dpidle(struct pwr_ctrl *pwrctrl)
{
    u32 v0, v1;

    if (is_cpu_pdn(pwrctrl->pcm_flags)) {
        mt_cpu_dormant(CPU_DEEPIDLE_MODE);
    } else {
        //Mp0_axi_config[4] is one by default. No need to program it before entering suspend.
        //backup MPx_AXI_CONFIG
        v0 = reg_read(MP0_AXI_CONFIG);
        v1 = reg_read(MP1_AXI_CONFIG);
        
        //disable snoop function 
        MCUSYS_SMC_WRITE(MP0_AXI_CONFIG, v0 | ACINACTM);
        MCUSYS_SMC_WRITE(MP1_AXI_CONFIG, v1 | ACINACTM);

        wfi_with_sync();

        //restore MP0_AXI_CONFIG
        MCUSYS_SMC_WRITE(MP0_AXI_CONFIG, v0);
        MCUSYS_SMC_WRITE(MP1_AXI_CONFIG, v1);
    }
}