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

Go to the source code of this file.

Functions

static void mt6359p_write (u32 reg, u32 data)
 
static u32 mt6359p_read_field (u32 reg, u32 mask, u32 shift)
 
void mt6359p_write_field (u32 reg, u32 val, u32 mask, u32 shift)
 
static void pmic_set_power_hold (void)
 
static void pmic_wdt_set (void)
 
static void pmic_protect_key_setting (bool lock)
 
static int check_idle (u32 timeout, u32 addr, u32 mask)
 
static u32 pmic_read_efuse (u32 efuse_bit, u32 mask)
 
static void pmic_efuse_setting (void)
 
static void pmic_wk_vs2_voter_setting (void)
 
void mt6359p_buck_set_voltage (u32 buck_id, u32 buck_uv)
 
u32 mt6359p_buck_get_voltage (u32 buck_id)
 
void mt6359p_set_vm18_voltage (u32 vm18_uv)
 
u32 mt6359p_get_vm18_voltage (void)
 
static void init_pmif_arb (void)
 
void mt6359p_init (void)
 

Variables

static const struct pmic_setting key_protect_setting []
 
static const struct pmic_efuse efuse_setting []
 
static struct pmifpmif_arb = NULL
 

Function Documentation

◆ check_idle()

static int check_idle ( u32  timeout,
u32  addr,
u32  mask 
)
static

Definition at line 85 of file mt6359p.c.

References addr, mask, mt6359p_read_field(), and wait_us.

Referenced by pmic_read_efuse().

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

◆ init_pmif_arb()

static void init_pmif_arb ( void  )
static

Definition at line 257 of file mt6359p.c.

References die(), get_pmif_controller(), pmif::is_pmif_init_done, pmif_arb, and PMIF_SPI.

Referenced by mt6359p_init().

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

◆ mt6359p_buck_get_voltage()

u32 mt6359p_buck_get_voltage ( u32  buck_id)

Definition at line 193 of file mt6359p.c.

References die(), MT6359P_CORE, MT6359P_GPU11, mt6359p_read_field(), MT6359P_SRAM_PROC1, MT6359P_SRAM_PROC2, PMIC_VCORE_DBG0, PMIC_VGPU11_DBG0, PMIC_VSRAM_PROC1_VOSEL1, PMIC_VSRAM_PROC2_VOSEL1, and pmif_arb.

Referenced by mainboard_get_regulator_vol().

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

◆ mt6359p_buck_set_voltage()

void mt6359p_buck_set_voltage ( u32  buck_id,
u32  buck_uv 
)

Definition at line 160 of file mt6359p.c.

References die(), MT6359P_CORE, MT6359P_GPU11, MT6359P_SRAM_PROC1, MT6359P_SRAM_PROC2, mt6359p_write_field(), PMIC_VCORE_ELR0, PMIC_VGPU11_ELR0, PMIC_VSRAM_PROC1_ELR, PMIC_VSRAM_PROC2_ELR, and pmif_arb.

Referenced by mainboard_set_regulator_vol(), and raise_little_cpu_freq().

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

◆ mt6359p_get_vm18_voltage()

u32 mt6359p_get_vm18_voltage ( void  )

Definition at line 245 of file mt6359p.c.

References die(), mt6359p_read_field(), PMIC_VM18_ANA_CON0, pmif_arb, VM18_VOL_OFFSET, and VM18_VOL_REG_SHIFT.

Referenced by mainboard_get_regulator_vol().

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

◆ mt6359p_init()

void mt6359p_init ( void  )

Definition at line 269 of file mt6359p.c.

References init_pmif_arb(), pmic_efuse_setting(), pmic_init_setting(), pmic_lp_setting(), pmic_protect_key_setting(), pmic_set_power_hold(), pmic_wdt_set(), and pmic_wk_vs2_voter_setting().

Referenced by platform_romstage_main().

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

◆ mt6359p_read_field()

static u32 mt6359p_read_field ( u32  reg,
u32  mask,
u32  shift 
)
static

Definition at line 53 of file mt6359p.c.

References mask, pmif_arb, and pmif::read_field.

Referenced by check_idle(), mt6359p_buck_get_voltage(), mt6359p_get_vm18_voltage(), and pmic_read_efuse().

Here is the caller graph for this function:

◆ mt6359p_set_vm18_voltage()

void mt6359p_set_vm18_voltage ( u32  vm18_uv)

Definition at line 230 of file mt6359p.c.

References assert, die(), mt6359p_write(), PMIC_VM18_ANA_CON0, pmif_arb, VM18_VOL_OFFSET, and VM18_VOL_REG_SHIFT.

Referenced by mainboard_set_regulator_vol().

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

◆ mt6359p_write()

static void mt6359p_write ( u32  reg,
u32  data 
)
static

Definition at line 48 of file mt6359p.c.

References pmif_arb, and pmif::write.

Referenced by mt6359p_set_vm18_voltage(), pmic_efuse_setting(), and pmic_protect_key_setting().

Here is the caller graph for this function:

◆ mt6359p_write_field()

void mt6359p_write_field ( u32  reg,
u32  val,
u32  mask,
u32  shift 
)

◆ pmic_efuse_setting()

static void pmic_efuse_setting ( void  )
static

Definition at line 124 of file mt6359p.c.

References addr, ARRAY_SIZE, BIOS_DEBUG, EFUSE_RG_VPA_OC_FT, efuse_setting, mask, mt6359p_write(), mt6359p_write_field(), PMIC_BUCK_VPA_DLC_CON0, PMIC_BUCK_VPA_DLC_CON1, pmic_read_efuse(), printk, stopwatch_duration_msecs(), and stopwatch_init().

Referenced by mt6359p_init().

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

◆ pmic_protect_key_setting()

static void pmic_protect_key_setting ( bool  lock)
static

Definition at line 78 of file mt6359p.c.

References addr, ARRAY_SIZE, key_protect_setting, lock(), mt6359p_write(), and val.

Referenced by mt6359p_init().

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

◆ pmic_read_efuse()

static u32 pmic_read_efuse ( u32  efuse_bit,
u32  mask 
)
static

Definition at line 93 of file mt6359p.c.

References check_idle(), die(), EFUSE_BUSY, EFUSE_WAIT_US, mask, mt6359p_read_field(), mt6359p_write_field(), PMIC_OTP_CON0, PMIC_OTP_CON11, PMIC_OTP_CON12, PMIC_OTP_CON13, PMIC_OTP_CON8, PMIC_TOP_CKHWEN_CON0, PMIC_TOP_CKPDN_CON0, and udelay().

Referenced by pmic_efuse_setting().

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

◆ pmic_set_power_hold()

static void pmic_set_power_hold ( void  )
static

Definition at line 63 of file mt6359p.c.

References mt6359p_write_field(), and PMIC_PWRHOLD.

Referenced by mt6359p_init(), poweroff(), and rtc_bbpu_power_on().

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

◆ pmic_wdt_set()

static void pmic_wdt_set ( void  )
static

Definition at line 68 of file mt6359p.c.

References mt6359p_write_field(), PMIC_TOP_RST_MISC_CLR, and PMIC_TOP_RST_MISC_SET.

Referenced by mt6359p_init().

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

◆ pmic_wk_vs2_voter_setting()

static void pmic_wk_vs2_voter_setting ( void  )
static

Definition at line 148 of file mt6359p.c.

References mt6359p_write_field(), PMIC_VS2_ELR0, PMIC_VS2_VOTER, and PMIC_VS2_VOTER_CFG.

Referenced by mt6359p_init().

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

Variable Documentation

◆ efuse_setting

const struct pmic_efuse efuse_setting[]
static
Initial value:
= {
{79, 0xa0e, 0x1, 0xf},
{886, 0x198c, 0xf, 0x8},
{890, 0x198e, 0xf, 0x0},
{902, 0x1998, 0xf, 0x8},
{906, 0x1998, 0xf, 0xc},
{918, 0x19a2, 0xf, 0x8},
{922, 0x19a2, 0xf, 0xc},
{1014, 0x19ae, 0xf, 0x7},
{1018, 0x19ae, 0xf, 0xb},
{1158, 0x1a0a, 0xf, 0x7},
{1162, 0x1a0a, 0xf, 0xb},
{1206, 0x1a16, 0xf, 0x7},
{1210, 0x1a16, 0xf, 0xb},
{1254, 0x1a22, 0xf, 0x7},
{1258, 0x1a22, 0xf, 0xb},
{1304, 0x1a2c, 0x7, 0x4},
{1307, 0x1a32, 0x7, 0x8},
{1336, 0x1a34, 0x7, 0x4},
{1339, 0x1a3a, 0x7, 0x8},
{1683, 0x79c, 0xf, 0x4},
{1688, 0xc8a, 0x1, 0x3},
{1689, 0xc88, 0x1, 0x3},
{1690, 0xc88, 0x7, 0x0},
}

Definition at line 1 of file mt6359p.c.

Referenced by pmic_efuse_setting().

◆ key_protect_setting

const struct pmic_setting key_protect_setting[]
static
Initial value:
= {
{0x3A8, 0x9CA6, 0xFFFF, 0},
{0x44A, 0xBADE, 0xFFFF, 0},
{0xA3A, 0x4729, 0xFFFF, 0},
{0xC58, 0x1605, 0xFFFF, 0},
{0xC5A, 0x1706, 0xFFFF, 0},
{0xC5C, 0x1807, 0xFFFF, 0},
{0xFB4, 0x6359, 0xFFFF, 0},
{0x1432, 0x5543, 0xFFFF, 0},
}

Definition at line 1 of file mt6359p.c.

Referenced by pmic_protect_key_setting().

◆ pmif_arb