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

Go to the source code of this file.

Functions

static unsigned int pmic_read_efuse (int i)
 
static int pmic_get_efuse_votrim (void)
 
void pmic_set_power_hold (bool enable)
 
void pmic_init_scp_voltage (void)
 
void pmic_set_vsim2_cali (unsigned int vsim2_mv)
 
unsigned int pmic_get_vcore_vol (void)
 
void pmic_set_vcore_vol (unsigned int vcore_uv)
 
unsigned int pmic_get_vdram1_vol (void)
 
void pmic_set_vdram1_vol (unsigned int vdram_uv)
 
unsigned int pmic_get_vddq_vol (void)
 
void pmic_set_vddq_vol (unsigned int vddq_uv)
 
static void pmic_wdt_set (void)
 
static void mt6358_init_setting (void)
 
static void wk_sleep_voltage_by_ddr (void)
 
static void wk_power_down_seq (void)
 
static void mt6358_lp_setting (void)
 
void mt6358_init (void)
 

Variables

static struct pmic_setting init_setting []
 
static struct pmic_setting lp_setting []
 
static struct pmic_setting scp_setting []
 
static const int vddq_votrim []
 

Function Documentation

◆ mt6358_init()

void mt6358_init ( void  )

Definition at line 975 of file mt6358.c.

References die(), mt6358_init_setting(), mt6358_lp_setting(), pmic_set_power_hold(), pmic_wdt_set(), pwrap_init(), stopwatch_expired(), stopwatch_init_usecs_expire(), wk_power_down_seq(), and wk_sleep_voltage_by_ddr().

Referenced by platform_romstage_main().

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

◆ mt6358_init_setting()

static void mt6358_init_setting ( void  )
static

Definition at line 944 of file mt6358.c.

References addr, ARRAY_SIZE, init_setting, mask, pwrap_write_field(), pmic_setting::shift, and val.

Referenced by mt6358_init().

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

◆ mt6358_lp_setting()

static void mt6358_lp_setting ( void  )
static

Definition at line 967 of file mt6358.c.

References addr, ARRAY_SIZE, lp_setting, mask, pwrap_write_field(), pmic_setting::shift, and val.

Referenced by mt6358_init().

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

◆ pmic_get_efuse_votrim()

static int pmic_get_efuse_votrim ( void  )
static

Definition at line 785 of file mt6358.c.

References ARRAY_SIZE, assert, pmic_read_efuse(), and vddq_votrim.

Referenced by pmic_get_vddq_vol(), and pmic_set_vddq_vol().

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

◆ pmic_get_vcore_vol()

unsigned int pmic_get_vcore_vol ( void  )

Definition at line 845 of file mt6358.c.

References PMIC_VCORE_DBG0, and pwrap_read_field().

Here is the call graph for this function:

◆ pmic_get_vddq_vol()

unsigned int pmic_get_vddq_vol ( void  )

Definition at line 889 of file mt6358.c.

References ARRAY_SIZE, assert, pmic_get_efuse_votrim(), PMIC_VDDQ_ELR_0, PMIC_VDDQ_OP_EN, pwrap_read_field(), and vddq_votrim.

Here is the call graph for this function:

◆ pmic_get_vdram1_vol()

unsigned int pmic_get_vdram1_vol ( void  )

Definition at line 867 of file mt6358.c.

References PMIC_VDRAM1_DBG0, and pwrap_read_field().

Here is the call graph for this function:

◆ pmic_init_scp_voltage()

void pmic_init_scp_voltage ( void  )

Definition at line 797 of file mt6358.c.

References addr, ARRAY_SIZE, mask, pwrap_write_field(), scp_setting, pmic_setting::shift, and val.

Referenced by platform_romstage_main().

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

◆ pmic_read_efuse()

static unsigned int pmic_read_efuse ( int  i)
static

Definition at line 749 of file mt6358.c.

References PMIC_OTP_CON0, PMIC_OTP_CON11, PMIC_OTP_CON12, PMIC_OTP_CON13, PMIC_OTP_CON8, PMIC_TOP_CKHWEN_CON0_CLR, PMIC_TOP_CKHWEN_CON0_SET, PMIC_TOP_CKPDN_CON0_CLR, PMIC_TOP_CKPDN_CON0_SET, pwrap_read_field(), pwrap_write_field(), and udelay().

Referenced by pmic_get_efuse_votrim().

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

◆ pmic_set_power_hold()

void pmic_set_power_hold ( bool  enable)

Definition at line 792 of file mt6358.c.

References PMIC_PWRHOLD, and pwrap_write_field().

Referenced by mt6358_init().

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

◆ pmic_set_vcore_vol()

void pmic_set_vcore_vol ( unsigned int  vcore_uv)

Definition at line 853 of file mt6358.c.

References assert, PMIC_VCORE_OP_EN, PMIC_VCORE_VOSEL, pwrap_write_field(), and udelay().

Referenced by mt_mem_init(), and set_vcore_voltage().

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

◆ pmic_set_vddq_vol()

void pmic_set_vddq_vol ( unsigned int  vddq_uv)

Definition at line 903 of file mt6358.c.

References ARRAY_SIZE, assert, pmic_get_efuse_votrim(), PMIC_TOP_TMA_KEY, PMIC_VDDQ_ELR_0, pwrap_write_field(), udelay(), and vddq_votrim.

Referenced by set_vdram1_vddq_voltage().

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

◆ pmic_set_vdram1_vol()

void pmic_set_vdram1_vol ( unsigned int  vdram_uv)

Definition at line 875 of file mt6358.c.

References assert, PMIC_VDRAM1_OP_EN, PMIC_VDRAM1_VOSEL, pwrap_write_field(), and udelay().

Referenced by set_vdram1_vddq_voltage().

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

◆ pmic_set_vsim2_cali()

void pmic_set_vsim2_cali ( unsigned int  vsim2_mv)

Definition at line 805 of file mt6358.c.

References assert, BUG, PMIC_VSIM2_ANA_CON0, and pwrap_write_field().

Referenced by platform_romstage_main().

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 934 of file mt6358.c.

References PMIC_TOP_RST_MISC_CLR, PMIC_TOP_RST_MISC_SET, and pwrap_write_field().

Referenced by mt6358_init().

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

◆ wk_power_down_seq()

static void wk_power_down_seq ( void  )
static

Definition at line 958 of file mt6358.c.

References PMIC_CPSDSA4, PMIC_TOP_TMA_KEY, and pwrap_write_field().

Referenced by mt6358_init().

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

◆ wk_sleep_voltage_by_ddr()

static void wk_sleep_voltage_by_ddr ( void  )
static

Definition at line 952 of file mt6358.c.

References PMIC_VDRAM1_VOSEL_SLEEP, PMIC_VM_MODE, pwrap_read_field(), and pwrap_write_field().

Referenced by mt6358_init().

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

Variable Documentation

◆ init_setting

struct pmic_setting init_setting[]
static

Definition at line 1 of file mt6358.c.

Referenced by mt6358_init_setting().

◆ lp_setting

struct pmic_setting lp_setting[]
static

Definition at line 1 of file mt6358.c.

Referenced by mt6358_lp_setting().

◆ scp_setting

struct pmic_setting scp_setting[]
static
Initial value:
= {
{0x14A6, 0x20, 0x7F, 0},
{0x14A6, 0x20, 0x7F, 8},
{0x14A4, 0x1, 0x1, 0},
{0x14A4, 0x0, 0x1, 1},
{0x1BC6, 0x40, 0x7F, 0},
{0x1BC6, 0x40, 0x7F, 8},
{0x1BC4, 0x1, 0x1, 0},
{0x1BC4, 0x0, 0x1, 1},
{0x134, 0x1, 0x1, 4},
}

Definition at line 1 of file mt6358.c.

Referenced by pmic_init_scp_voltage().

◆ vddq_votrim

const int vddq_votrim[]
static
Initial value:
= {
0, -10000, -20000, -30000, -40000, -50000, -60000, -70000,
80000, 70000, 60000, 50000, 40000, 30000, 20000, 10000,
}

Definition at line 744 of file mt6358.c.

Referenced by pmic_get_efuse_votrim(), pmic_get_vddq_vol(), and pmic_set_vddq_vol().