coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
spm.h File Reference
#include <device/mmio.h>
#include <soc/addressmap.h>
#include <soc/mtcmos.h>
#include <types.h>
Include dependency graph for spm.h:

Go to the source code of this file.

Data Structures

struct  pwr_ctrl
 
struct  mtk_spm_regs
 
struct  pcm_desc
 
struct  dyna_load_pcm
 

Macros

#define SPM_PROJECT_CODE   0xb16
 
#define SPM_REGWR_CFG_KEY   (SPM_PROJECT_CODE << 16)
 
#define BCLK_CG_EN_LSB   (1U << 0)
 
#define PCM_CK_EN_LSB   (1U << 2)
 
#define PCM_SW_RESET_LSB   (1U << 15)
 
#define RG_IM_SLAVE_LSB   (1U << 0)
 
#define RG_AHBMIF_APBEN_LSB   (1U << 3)
 
#define RG_PCM_TIMER_EN_LSB   (1U << 5)
 
#define SPM_EVENT_COUNTER_CLR_LSB   (1U << 6)
 
#define RG_PCM_WDT_WAKE_LSB   (1U << 9)
 
#define REG_SPM_SRAM_ISOINT_B_LSB   (1U << 11)
 
#define REG_EVENT_LOCK_EN_LSB   (1U << 12)
 
#define REG_MD32_APB_INTERNAL_EN_LSB   (1U << 14)
 
#define SPM_WAKEUP_EVENT_MASK_BIT0   (1U << 0)
 
#define SPM_WAKEUP_EVENT_MASK_CSYSPWREQ_B   (1U << 11)
 
#define REG_ALL_DDR_EN_DBC_EN_LSB   (1U << 0)
 
#define SPM_FLAG_DISABLE_VCORE_DVS   (1U << 3)
 
#define SPM_FLAG_DISABLE_VCORE_DFS   (1U << 4)
 
#define SPM_FLAG_RUN_COMMON_SCENARIO   (1U << 10)
 
#define POWER_ON_VAL1_DEF   0x80015860
 
#define SPM_WAKEUP_EVENT_MASK_DEF   0xffffffff
 
#define SPM_BUS_PROTECT_MASK_B_DEF   0xffffffff
 
#define SPM_BUS_PROTECT2_MASK_B_DEF   0xffffffff
 
#define MD32PCM_DMA0_CON_VAL   0x0003820e
 
#define MD32PCM_DMA0_START_VAL   0x00008000
 
#define MD32PCM_CFGREG_SW_RSTN_RUN   0x1
 
#define SPM_DVFS_LEVEL_DEF   0x00000001
 
#define SPM_DVS_DFS_LEVEL_DEF   0x00010001
 
#define SPM_RESOURCE_ACK_CON0_DEF   0xffffffff
 
#define SPM_RESOURCE_ACK_CON1_DEF   0xffffffff
 
#define SPM_RESOURCE_ACK_CON2_DEF   0xffffffff
 
#define SPM_RESOURCE_ACK_CON3_DEF   0xffffffff
 
#define ARMPLL_CLK_SEL_DEF   0x3ff
 
#define SPM_SYSCLK_SETTLE   0x60fe
 
#define SPM_INIT_DONE_US   20
 
#define PCM_WDT_TIMEOUT   (30 * 32768)
 
#define PCM_TIMER_MAX   (0xffffffff - PCM_WDT_TIMEOUT)
 
#define ISRM_TWAM   (1U << 2)
 
#define ISRM_RET_IRQ_AUX   (0x3ff << 8)
 
#define ISRM_ALL_EXC_TWAM   (ISRM_RET_IRQ_AUX)
 
#define ISRM_ALL   (ISRM_ALL_EXC_TWAM | ISRM_TWAM)
 
#define ISRS_TWAM   (1U << 2)
 
#define ISRS_PCM_RETURN   (1U << 3)
 
#define ISRC_TWAM   ISRS_TWAM
 
#define ISRC_ALL_EXC_TWAM   ISRS_PCM_RETURN
 
#define ISRC_ALL   (ISRC_ALL_EXC_TWAM | ISRC_TWAM)
 
#define PCM_PWRIO_EN_R0   (1U << 0)
 
#define PCM_PWRIO_EN_R7   (1U << 7)
 
#define PCM_RF_SYNC_R0   (1U << 16)
 
#define PCM_RF_SYNC_R6   (1U << 22)
 
#define PCM_RF_SYNC_R7   (1U << 23)
 
#define PCM_SW_INT_ALL   0x3ff
 

Enumerations

enum  {
  DISP_PWR_STA_MASK = 0x1 << 20 , DISP_SRAM_PDN_MASK = 0x1 << 8 , DISP_SRAM_ACK_MASK = 0x1 << 12 , AUDIO_PWR_STA_MASK = 0x1 << 21 ,
  AUDIO_SRAM_PDN_MASK = 0x1 << 8 , AUDIO_SRAM_ACK_MASK = 0x1 << 12
}
 

Functions

 check_member (mtk_spm_regs, pwr_status, 0x016c)
 
 check_member (mtk_spm_regs, audio_pwr_con, 0x0358)
 
 check_member (mtk_spm_regs, adsp_pwr_con, 0x0360)
 
 check_member (mtk_spm_regs, ap_mdsrc_req, 0x043c)
 
 check_member (mtk_spm_regs, ulposc_con, 0x644)
 
int spm_init (void)
 

Variables

static struct mtk_spm_regs *const mtk_spm = (void *)SPM_BASE
 
static const struct power_domain_data disp []
 
static const struct power_domain_data audio []
 

Macro Definition Documentation

◆ ARMPLL_CLK_SEL_DEF

#define ARMPLL_CLK_SEL_DEF   0x3ff

Definition at line 73 of file spm.h.

◆ BCLK_CG_EN_LSB

#define BCLK_CG_EN_LSB   (1U << 0)

Definition at line 16 of file spm.h.

◆ ISRC_ALL

#define ISRC_ALL   (ISRC_ALL_EXC_TWAM | ISRC_TWAM)

Definition at line 95 of file spm.h.

◆ ISRC_ALL_EXC_TWAM

#define ISRC_ALL_EXC_TWAM   ISRS_PCM_RETURN

Definition at line 94 of file spm.h.

◆ ISRC_TWAM

#define ISRC_TWAM   ISRS_TWAM

Definition at line 93 of file spm.h.

◆ ISRM_ALL

#define ISRM_ALL   (ISRM_ALL_EXC_TWAM | ISRM_TWAM)

Definition at line 88 of file spm.h.

◆ ISRM_ALL_EXC_TWAM

#define ISRM_ALL_EXC_TWAM   (ISRM_RET_IRQ_AUX)

Definition at line 87 of file spm.h.

◆ ISRM_RET_IRQ_AUX

#define ISRM_RET_IRQ_AUX   (0x3ff << 8)

Definition at line 86 of file spm.h.

◆ ISRM_TWAM

#define ISRM_TWAM   (1U << 2)

Definition at line 85 of file spm.h.

◆ ISRS_PCM_RETURN

#define ISRS_PCM_RETURN   (1U << 3)

Definition at line 92 of file spm.h.

◆ ISRS_TWAM

#define ISRS_TWAM   (1U << 2)

Definition at line 91 of file spm.h.

◆ MD32PCM_CFGREG_SW_RSTN_RUN

#define MD32PCM_CFGREG_SW_RSTN_RUN   0x1

Definition at line 66 of file spm.h.

◆ MD32PCM_DMA0_CON_VAL

#define MD32PCM_DMA0_CON_VAL   0x0003820e

Definition at line 64 of file spm.h.

◆ MD32PCM_DMA0_START_VAL

#define MD32PCM_DMA0_START_VAL   0x00008000

Definition at line 65 of file spm.h.

◆ PCM_CK_EN_LSB

#define PCM_CK_EN_LSB   (1U << 2)

Definition at line 22 of file spm.h.

◆ PCM_PWRIO_EN_R0

#define PCM_PWRIO_EN_R0   (1U << 0)

Definition at line 98 of file spm.h.

◆ PCM_PWRIO_EN_R7

#define PCM_PWRIO_EN_R7   (1U << 7)

Definition at line 99 of file spm.h.

◆ PCM_RF_SYNC_R0

#define PCM_RF_SYNC_R0   (1U << 16)

Definition at line 100 of file spm.h.

◆ PCM_RF_SYNC_R6

#define PCM_RF_SYNC_R6   (1U << 22)

Definition at line 101 of file spm.h.

◆ PCM_RF_SYNC_R7

#define PCM_RF_SYNC_R7   (1U << 23)

Definition at line 102 of file spm.h.

◆ PCM_SW_INT_ALL

#define PCM_SW_INT_ALL   0x3ff

Definition at line 105 of file spm.h.

◆ PCM_SW_RESET_LSB

#define PCM_SW_RESET_LSB   (1U << 15)

Definition at line 23 of file spm.h.

◆ PCM_TIMER_MAX

#define PCM_TIMER_MAX   (0xffffffff - PCM_WDT_TIMEOUT)

Definition at line 77 of file spm.h.

◆ PCM_WDT_TIMEOUT

#define PCM_WDT_TIMEOUT   (30 * 32768)

Definition at line 76 of file spm.h.

◆ POWER_ON_VAL1_DEF

#define POWER_ON_VAL1_DEF   0x80015860

Definition at line 60 of file spm.h.

◆ REG_ALL_DDR_EN_DBC_EN_LSB

#define REG_ALL_DDR_EN_DBC_EN_LSB   (1U << 0)

Definition at line 40 of file spm.h.

◆ REG_EVENT_LOCK_EN_LSB

#define REG_EVENT_LOCK_EN_LSB   (1U << 12)

Definition at line 32 of file spm.h.

◆ REG_MD32_APB_INTERNAL_EN_LSB

#define REG_MD32_APB_INTERNAL_EN_LSB   (1U << 14)

Definition at line 33 of file spm.h.

◆ REG_SPM_SRAM_ISOINT_B_LSB

#define REG_SPM_SRAM_ISOINT_B_LSB   (1U << 11)

Definition at line 31 of file spm.h.

◆ RG_AHBMIF_APBEN_LSB

#define RG_AHBMIF_APBEN_LSB   (1U << 3)

Definition at line 27 of file spm.h.

◆ RG_IM_SLAVE_LSB

#define RG_IM_SLAVE_LSB   (1U << 0)

Definition at line 26 of file spm.h.

◆ RG_PCM_TIMER_EN_LSB

#define RG_PCM_TIMER_EN_LSB   (1U << 5)

Definition at line 28 of file spm.h.

◆ RG_PCM_WDT_WAKE_LSB

#define RG_PCM_WDT_WAKE_LSB   (1U << 9)

Definition at line 30 of file spm.h.

◆ SPM_BUS_PROTECT2_MASK_B_DEF

#define SPM_BUS_PROTECT2_MASK_B_DEF   0xffffffff

Definition at line 63 of file spm.h.

◆ SPM_BUS_PROTECT_MASK_B_DEF

#define SPM_BUS_PROTECT_MASK_B_DEF   0xffffffff

Definition at line 62 of file spm.h.

◆ SPM_DVFS_LEVEL_DEF

#define SPM_DVFS_LEVEL_DEF   0x00000001

Definition at line 67 of file spm.h.

◆ SPM_DVS_DFS_LEVEL_DEF

#define SPM_DVS_DFS_LEVEL_DEF   0x00010001

Definition at line 68 of file spm.h.

◆ SPM_EVENT_COUNTER_CLR_LSB

#define SPM_EVENT_COUNTER_CLR_LSB   (1U << 6)

Definition at line 29 of file spm.h.

◆ SPM_FLAG_DISABLE_VCORE_DFS

#define SPM_FLAG_DISABLE_VCORE_DFS   (1U << 4)

Definition at line 48 of file spm.h.

◆ SPM_FLAG_DISABLE_VCORE_DVS

#define SPM_FLAG_DISABLE_VCORE_DVS   (1U << 3)

Definition at line 47 of file spm.h.

◆ SPM_FLAG_RUN_COMMON_SCENARIO

#define SPM_FLAG_RUN_COMMON_SCENARIO   (1U << 10)

Definition at line 49 of file spm.h.

◆ SPM_INIT_DONE_US

#define SPM_INIT_DONE_US   20

Definition at line 75 of file spm.h.

◆ SPM_PROJECT_CODE

#define SPM_PROJECT_CODE   0xb16

Definition at line 12 of file spm.h.

◆ SPM_REGWR_CFG_KEY

#define SPM_REGWR_CFG_KEY   (SPM_PROJECT_CODE << 16)

Definition at line 13 of file spm.h.

◆ SPM_RESOURCE_ACK_CON0_DEF

#define SPM_RESOURCE_ACK_CON0_DEF   0xffffffff

Definition at line 69 of file spm.h.

◆ SPM_RESOURCE_ACK_CON1_DEF

#define SPM_RESOURCE_ACK_CON1_DEF   0xffffffff

Definition at line 70 of file spm.h.

◆ SPM_RESOURCE_ACK_CON2_DEF

#define SPM_RESOURCE_ACK_CON2_DEF   0xffffffff

Definition at line 71 of file spm.h.

◆ SPM_RESOURCE_ACK_CON3_DEF

#define SPM_RESOURCE_ACK_CON3_DEF   0xffffffff

Definition at line 72 of file spm.h.

◆ SPM_SYSCLK_SETTLE

#define SPM_SYSCLK_SETTLE   0x60fe

Definition at line 74 of file spm.h.

◆ SPM_WAKEUP_EVENT_MASK_BIT0

#define SPM_WAKEUP_EVENT_MASK_BIT0   (1U << 0)

Definition at line 36 of file spm.h.

◆ SPM_WAKEUP_EVENT_MASK_CSYSPWREQ_B

#define SPM_WAKEUP_EVENT_MASK_CSYSPWREQ_B   (1U << 11)

Definition at line 37 of file spm.h.

◆ SPM_WAKEUP_EVENT_MASK_DEF

#define SPM_WAKEUP_EVENT_MASK_DEF   0xffffffff

Definition at line 61 of file spm.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
DISP_PWR_STA_MASK 
DISP_SRAM_PDN_MASK 
DISP_SRAM_ACK_MASK 
AUDIO_PWR_STA_MASK 
AUDIO_SRAM_PDN_MASK 
AUDIO_SRAM_ACK_MASK 

Definition at line 404 of file spm.h.

Function Documentation

◆ check_member() [1/5]

check_member ( mtk_spm_regs  ,
adsp_pwr_con  ,
0x0360   
)

◆ check_member() [2/5]

check_member ( mtk_spm_regs  ,
ap_mdsrc_req  ,
0x043c   
)

◆ check_member() [3/5]

check_member ( mtk_spm_regs  ,
audio_pwr_con  ,
0x0358   
)

◆ check_member() [4/5]

check_member ( mtk_spm_regs  ,
pwr_status  ,
0x016c   
)

◆ check_member() [5/5]

check_member ( mtk_spm_regs  ,
ulposc_con  ,
0x644   
)

◆ spm_init()

Variable Documentation

◆ audio

const struct power_domain_data audio[]
static
Initial value:
= {
{
.pwr_con = &mtk_spm->adsp_pwr_con,
.pwr_sta_mask = 0x1 << 10,
.sram_pdn_mask = 0x1 << 8,
.sram_ack_mask = 0x1 << 12,
},
{
.pwr_con = &mtk_spm->audio_pwr_con,
.pwr_sta_mask = 0x1 << 8,
.sram_pdn_mask = 0x1 << 8,
.sram_ack_mask = 0x1 << 12,
},
}
static struct mtk_spm_regs *const mtk_spm
Definition: spm.h:953
u32 audio_pwr_con
Definition: spm.h:60
uint32_t adsp_pwr_con
Definition: spm.h:354

Definition at line 967 of file spm.h.

◆ disp

const struct power_domain_data disp[]
static

Definition at line 967 of file spm.h.

◆ mtk_spm

struct mtk_spm_regs* const mtk_spm = (void *)SPM_BASE
static

Definition at line 953 of file spm.h.