coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
spm.c File Reference
#include <assert.h>
#include <console/console.h>
#include <delay.h>
#include <device/mmio.h>
#include <soc/mcu_common.h>
#include <soc/spm.h>
#include <soc/spm_common.h>
#include <soc/symbols.h>
#include <timer.h>
Include dependency graph for spm.c:

Go to the source code of this file.

Macros

#define SPM_SYSTEM_BASE_OFFSET   0x40000000
 

Functions

static void spm_set_power_control (const struct pwr_ctrl *pwrctrl)
 
static void spm_register_init (void)
 
static void spm_set_sysclk_settle (void)
 
static void spm_code_swapping (void)
 
static void spm_reset_and_init_pcm (void)
 
static void spm_kick_im_to_fetch (const struct dyna_load_pcm *pcm)
 
static void spm_init_pcm_register (void)
 
static void spm_set_wakeup_event (const struct pwr_ctrl *pwrctrl)
 
static void spm_set_pcm_flags (const struct pwr_ctrl *pwrctrl)
 
static void spm_kick_pcm_to_run (const struct pwr_ctrl *pwrctrl)
 
static void reset_spm (struct mtk_mcu *mcu)
 
int spm_init (void)
 

Variables

static const struct pwr_ctrl spm_init_ctrl
 
static struct mtk_mcu spm
 

Macro Definition Documentation

◆ SPM_SYSTEM_BASE_OFFSET

#define SPM_SYSTEM_BASE_OFFSET   0x40000000

Definition at line 13 of file spm.c.

Function Documentation

◆ reset_spm()

static void reset_spm ( struct mtk_mcu mcu)
static

◆ spm_code_swapping()

static void spm_code_swapping ( void  )
static

Definition at line 486 of file spm.c.

References mask, mtk_spm, read32(), mtk_spm_regs::spm_cpu_wakeup_event, mtk_spm_regs::spm_wakeup_event_mask, SPM_WAKEUP_EVENT_MASK_BIT0, and write32().

Referenced by spm_reset_and_init_pcm().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ spm_init()

◆ spm_init_pcm_register()

static void spm_init_pcm_register ( void  )
static

Definition at line 566 of file spm.c.

References mtk_spm, mtk_spm_regs::pcm_pwr_io_en, mtk_spm_regs::pcm_reg_data_ini, PCM_RF_SYNC_R0, PCM_RF_SYNC_R7, read32(), mtk_spm_regs::spm_power_on_val0, mtk_spm_regs::spm_power_on_val1, and write32().

Referenced by reset_spm().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ spm_kick_im_to_fetch()

◆ spm_kick_pcm_to_run()

◆ spm_register_init()

◆ spm_reset_and_init_pcm()

◆ spm_set_pcm_flags()

static void spm_set_pcm_flags ( const struct pwr_ctrl pwrctrl)
static

◆ spm_set_power_control()

static void spm_set_power_control ( const struct pwr_ctrl pwrctrl)
static

Definition at line 287 of file spm.c.

References mtk_spm, pwr_ctrl::reg_apu_apsrc_req_mask_b, pwr_ctrl::reg_apu_ddr_en_mask_b, pwr_ctrl::reg_apu_infra_req_mask_b, pwr_ctrl::reg_apu_srcclkena_mask_b, pwr_ctrl::reg_apu_vrf18_req_mask_b, pwr_ctrl::reg_audio_dsp_apsrc_req_mask_b, pwr_ctrl::reg_audio_dsp_ddr_en_mask_b, pwr_ctrl::reg_audio_dsp_infra_req_mask_b, pwr_ctrl::reg_audio_dsp_srcclkena_mask_b, pwr_ctrl::reg_audio_dsp_vrf18_req_mask_b, pwr_ctrl::reg_bak_psri_apsrc_req_mask_b, pwr_ctrl::reg_bak_psri_ddr_en_mask_b, pwr_ctrl::reg_bak_psri_infra_req_mask_b, pwr_ctrl::reg_bak_psri_srcclkena_mask_b, pwr_ctrl::reg_bak_psri_vrf18_req_mask_b, pwr_ctrl::reg_conn_apsrc_sel, pwr_ctrl::reg_cpueb_apsrc_req_mask_b, pwr_ctrl::reg_cpueb_ddr_en_mask_b, pwr_ctrl::reg_cpueb_infra_req_mask_b, pwr_ctrl::reg_cpueb_srcclkena_mask_b, pwr_ctrl::reg_cpueb_vrf18_req_mask_b, pwr_ctrl::reg_disp0_ddr_en_mask_b, pwr_ctrl::reg_disp1_apsrc_req_mask_b, pwr_ctrl::reg_disp1_ddr_en_mask_b, pwr_ctrl::reg_disp2_apsrc_req_mask_b, pwr_ctrl::reg_disp2_ddr_en_mask_b, pwr_ctrl::reg_disp3_apsrc_req_mask_b, pwr_ctrl::reg_disp3_ddr_en_mask_b, pwr_ctrl::reg_ext_wakeup_event_mask, pwr_ctrl::reg_gce0_apsrc_req_mask_b, pwr_ctrl::reg_gce0_ddr_en_mask_b, pwr_ctrl::reg_gce0_infra_req_mask_b, pwr_ctrl::reg_gce0_vrf18_req_mask_b, pwr_ctrl::reg_gce1_apsrc_req_mask_b, pwr_ctrl::reg_gce1_ddr_en_mask_b, pwr_ctrl::reg_gce1_infra_req_mask_b, pwr_ctrl::reg_gce1_vrf18_req_mask_b, pwr_ctrl::reg_infrasys_apsrc_req_mask_b, pwr_ctrl::reg_infrasys_ddr_en_mask_b, pwr_ctrl::reg_mcusys_idle_mask, pwr_ctrl::reg_md_apsrc_0_sel, pwr_ctrl::reg_md_apsrc_1_sel, pwr_ctrl::reg_mp0_cputop_idle_mask, pwr_ctrl::reg_mp1_cputop_idle_mask, pwr_ctrl::reg_msdc0_apsrc_req_mask_b, pwr_ctrl::reg_msdc0_ddr_en_mask_b, pwr_ctrl::reg_msdc0_infra_req_mask_b, pwr_ctrl::reg_msdc0_srcclkena_mask_b, pwr_ctrl::reg_msdc0_vrf18_req_mask_b, pwr_ctrl::reg_msdc1_apsrc_req_mask_b, pwr_ctrl::reg_msdc1_ddr_en_mask_b, pwr_ctrl::reg_msdc1_infra_req_mask_b, pwr_ctrl::reg_msdc1_srcclkena_mask_b, pwr_ctrl::reg_msdc1_vrf18_req_mask_b, pwr_ctrl::reg_msdc2_apsrc_req_mask_b, pwr_ctrl::reg_msdc2_ddr_en_mask_b, pwr_ctrl::reg_msdc2_infra_req_mask_b, pwr_ctrl::reg_msdc2_srcclkena_mask_b, pwr_ctrl::reg_msdc2_vrf18_req_mask_b, pwr_ctrl::reg_pextp_p0_apsrc_req_mask_b, pwr_ctrl::reg_pextp_p0_ddr_en_mask_b, pwr_ctrl::reg_pextp_p0_infra_req_mask_b, pwr_ctrl::reg_pextp_p0_srcclkena_mask_b, pwr_ctrl::reg_pextp_p0_vrf18_req_mask_b, pwr_ctrl::reg_pextp_p1_apsrc_req_mask_b, pwr_ctrl::reg_pextp_p1_ddr_en_mask_b, pwr_ctrl::reg_pextp_p1_infra_req_mask_b, pwr_ctrl::reg_pextp_p1_srcclkena_mask_b, pwr_ctrl::reg_pextp_p1_vrf18_req_mask_b, pwr_ctrl::reg_scp_apsrc_req_mask_b, pwr_ctrl::reg_scp_ddr_en_mask_b, pwr_ctrl::reg_scp_infra_req_mask_b, pwr_ctrl::reg_scp_srcclkena_mask_b, pwr_ctrl::reg_scp_vrf18_req_mask_b, pwr_ctrl::reg_spm_adsp_mailbox_req, pwr_ctrl::reg_spm_apsrc_req, pwr_ctrl::reg_spm_apsrc_req_reserved_mask_b, pwr_ctrl::reg_spm_ddr_en_req, pwr_ctrl::reg_spm_ddr_en_reserved_mask_b, pwr_ctrl::reg_spm_dvfs_req, pwr_ctrl::reg_spm_f26m_req, pwr_ctrl::reg_spm_infra_req, pwr_ctrl::reg_spm_infra_req_reserved_mask_b, pwr_ctrl::reg_spm_scp_mailbox_req, pwr_ctrl::reg_spm_srcclkena_reserved_mask_b, pwr_ctrl::reg_spm_sspm_mailbox_req, pwr_ctrl::reg_spm_sw_mailbox_req, pwr_ctrl::reg_spm_vrf18_req, pwr_ctrl::reg_spm_vrf18_req_reserved_mask_b, pwr_ctrl::reg_sspm_apsrc_req_0_mask_b, pwr_ctrl::reg_sspm_ddr_en_0_mask_b, pwr_ctrl::reg_sspm_infra_req_0_mask_b, pwr_ctrl::reg_sspm_srcclkena_0_mask_b, pwr_ctrl::reg_sspm_vrf18_req_0_mask_b, pwr_ctrl::reg_ufs_apsrc_req_mask_b, pwr_ctrl::reg_ufs_ddr_en_mask_b, pwr_ctrl::reg_ufs_infra_req_mask_b, pwr_ctrl::reg_ufs_srcclkena_mask_b, pwr_ctrl::reg_ufs_vrf18_req_mask_b, pwr_ctrl::reg_usb_apsrc_req_mask_b, pwr_ctrl::reg_usb_ddr_en_mask_b, pwr_ctrl::reg_usb_infra_req_mask_b, pwr_ctrl::reg_usb_srcclkena_mask_b, pwr_ctrl::reg_usb_vrf18_req_mask_b, pwr_ctrl::reg_wakeup_event_mask, pwr_ctrl::reg_wfi_op, pwr_ctrl::reg_wfi_type, mtk_spm_regs::spm_ap_standby_con, mtk_spm_regs::spm_src2_mask, mtk_spm_regs::spm_src3_mask, mtk_spm_regs::spm_src4_mask, mtk_spm_regs::spm_src_mask, mtk_spm_regs::spm_src_req, mtk_spm_regs::spm_wakeup_event_ext_mask, mtk_spm_regs::spm_wakeup_event_mask, and write32().

Referenced by spm_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ spm_set_sysclk_settle()

static void spm_set_sysclk_settle ( void  )
static

Definition at line 481 of file spm.c.

References mtk_spm, mtk_spm_regs::spm_clk_settle, SPM_SYSCLK_SETTLE, and write32().

Referenced by spm_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ spm_set_wakeup_event()

Variable Documentation

◆ spm

struct mtk_mcu spm
static
Initial value:
= {
.firmware_name = CONFIG_SPM_FIRMWARE,
.reset = reset_spm,
}
static void reset_spm(struct mtk_mcu *mcu)
Definition: spm.c:671

Definition at line 671 of file spm.c.

Referenced by spm_init().

◆ spm_init_ctrl

const struct pwr_ctrl spm_init_ctrl
static

Definition at line 1 of file spm.c.

Referenced by reset_spm(), and spm_init().