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

Go to the source code of this file.

Functions

static void mt6366_protect_control (bool en_protect)
 
static u32 pmic_read_efuse (int i)
 
static int pmic_get_efuse_votrim (void)
 
static u32 pmic_get_vcore_vol (void)
 
static void pmic_set_vcore_vol (u32 vcore_uv)
 
static u32 pmic_get_vproc12_vol (void)
 
static void pmic_set_vproc12_vol (u32 v_uv)
 
static u32 pmic_get_vsram_proc12_vol (void)
 
static void pmic_set_vsram_proc12_vol (u32 v_uv)
 
static u32 pmic_get_vdram1_vol (void)
 
static void pmic_set_vdram1_vol (u32 vdram_uv)
 
static u32 pmic_get_vddq_vol (void)
 
static void pmic_set_vddq_vol (u32 vddq_uv)
 
static u32 pmic_get_vmch_vol (void)
 
static void pmic_set_vmch_vol (u32 vmch_uv)
 
static u32 pmic_get_vmc_vol (void)
 
static void pmic_set_vmc_vol (u32 vmc_uv)
 
static u32 pmic_get_vrf12_vol (void)
 
static void pmic_enable_vrf12 (void)
 
static u32 pmic_get_vcn33_vol (void)
 
static void pmic_set_vcn33_vol (u32 vcn33_uv)
 
static void pmic_wdt_set (void)
 
static void mt6366_init_setting (void)
 
static void wk_sleep_voltage_by_ddr (void)
 
static void wk_power_down_seq (void)
 
static void mt6366_lp_setting (void)
 
static void pmic_check_hwcid (void)
 
void mt6366_set_power_hold (bool enable)
 
void mt6366_init_scp_voltage (void)
 
void mt6366_set_vsim2_cali_mv (u32 vsim2_mv)
 
void mt6366_set_voltage (enum mt6366_regulator_id id, u32 voltage_uv)
 
u32 mt6366_get_voltage (enum mt6366_regulator_id id)
 
void mt6366_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

◆ mt6366_get_voltage()

◆ mt6366_init()

void mt6366_init ( void  )

◆ mt6366_init_scp_voltage()

void mt6366_init_scp_voltage ( void  )

Definition at line 834 of file mt6366.c.

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

Here is the call graph for this function:

◆ mt6366_init_setting()

static void mt6366_init_setting ( void  )
static

Definition at line 791 of file mt6366.c.

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

Referenced by mt6366_init().

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

◆ mt6366_lp_setting()

static void mt6366_lp_setting ( void  )
static

Definition at line 815 of file mt6366.c.

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

Referenced by mt6366_init().

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

◆ mt6366_protect_control()

static void mt6366_protect_control ( bool  en_protect)
static

Definition at line 428 of file mt6366.c.

References PMIC_TOP_TMA_KEY, and pwrap_write_field().

Referenced by mt6366_init_setting(), pmic_set_vddq_vol(), and wk_power_down_seq().

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

◆ mt6366_set_power_hold()

void mt6366_set_power_hold ( bool  enable)

Definition at line 829 of file mt6366.c.

References PMIC_PWRHOLD, and pwrap_write_field().

Referenced by mt6366_init(), and rtc_bbpu_power_on().

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

◆ mt6366_set_voltage()

◆ mt6366_set_vsim2_cali_mv()

void mt6366_set_vsim2_cali_mv ( u32  vsim2_mv)

Definition at line 842 of file mt6366.c.

References assert, BIOS_ERR, PMIC_VSIM2_ANA_CON0, printk, and pwrap_write_field().

Here is the call graph for this function:

◆ pmic_check_hwcid()

static void pmic_check_hwcid ( void  )
static

Definition at line 823 of file mt6366.c.

References BIOS_INFO, printk, and pwrap_read_field().

Referenced by mt6366_init().

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

◆ pmic_enable_vrf12()

static void pmic_enable_vrf12 ( void  )
static

Definition at line 725 of file mt6366.c.

References PMIC_LDO_VRF12_CON0, PMIC_LDO_VRF12_OP_EN, and pwrap_write_field().

Referenced by mt6366_set_voltage().

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 470 of file mt6366.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_vcn33_vol()

static u32 pmic_get_vcn33_vol ( void  )
static

Definition at line 731 of file mt6366.c.

References BIOS_ERR, PMIC_VCN33_ANA_CON0, printk, and pwrap_read_field().

Referenced by mt6366_get_voltage().

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

◆ pmic_get_vcore_vol()

static u32 pmic_get_vcore_vol ( void  )
static

Definition at line 477 of file mt6366.c.

References PMIC_VCORE_DBG0, and pwrap_read_field().

Referenced by mt6366_get_voltage().

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

◆ pmic_get_vddq_vol()

static u32 pmic_get_vddq_vol ( void  )
static

Definition at line 565 of file mt6366.c.

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

Referenced by mt6366_get_voltage().

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

◆ pmic_get_vdram1_vol()

static u32 pmic_get_vdram1_vol ( void  )
static

Definition at line 543 of file mt6366.c.

References PMIC_VDRAM1_DBG0, and pwrap_read_field().

Referenced by mt6366_get_voltage().

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

◆ pmic_get_vmc_vol()

static u32 pmic_get_vmc_vol ( void  )
static

Definition at line 662 of file mt6366.c.

References BIOS_ERR, PMIC_VMC_ANA_CON0, printk, and pwrap_read_field().

Referenced by mt6366_get_voltage().

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

◆ pmic_get_vmch_vol()

static u32 pmic_get_vmch_vol ( void  )
static

Definition at line 611 of file mt6366.c.

References BIOS_ERR, PMIC_VMCH_ANA_CON0, printk, and pwrap_read_field().

Referenced by mt6366_get_voltage().

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

◆ pmic_get_vproc12_vol()

static u32 pmic_get_vproc12_vol ( void  )
static

Definition at line 499 of file mt6366.c.

References PMIC_VPROC12_DBG0, and pwrap_read_field().

Referenced by mt6366_get_voltage().

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

◆ pmic_get_vrf12_vol()

static u32 pmic_get_vrf12_vol ( void  )
static

Definition at line 719 of file mt6366.c.

References PMIC_LDO_VRF12_CON0, PMIC_LDO_VRF12_OP_EN, and pwrap_read_field().

Referenced by mt6366_get_voltage().

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

◆ pmic_get_vsram_proc12_vol()

static u32 pmic_get_vsram_proc12_vol ( void  )
static

Definition at line 521 of file mt6366.c.

References PMIC_VSRAM_PROC12_DBG0, and pwrap_read_field().

Referenced by mt6366_get_voltage().

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

◆ pmic_read_efuse()

static u32 pmic_read_efuse ( int  i)
static

Definition at line 434 of file mt6366.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_vcn33_vol()

static void pmic_set_vcn33_vol ( u32  vcn33_uv)
static

Definition at line 756 of file mt6366.c.

References die(), PMIC_LDO_VCN33_CON0_0, PMIC_VCN33_ANA_CON0, pwrap_write_field(), and val.

Referenced by mt6366_set_voltage().

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

◆ pmic_set_vcore_vol()

static void pmic_set_vcore_vol ( u32  vcore_uv)
static

Definition at line 485 of file mt6366.c.

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

Referenced by mt6366_set_voltage().

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

◆ pmic_set_vddq_vol()

static void pmic_set_vddq_vol ( u32  vddq_uv)
static

Definition at line 579 of file mt6366.c.

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

Referenced by mt6366_set_voltage().

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

◆ pmic_set_vdram1_vol()

static void pmic_set_vdram1_vol ( u32  vdram_uv)
static

Definition at line 551 of file mt6366.c.

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

Referenced by mt6366_set_voltage().

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

◆ pmic_set_vmc_vol()

static void pmic_set_vmc_vol ( u32  vmc_uv)
static

Definition at line 690 of file mt6366.c.

References die(), PMIC_LDO_VMC_CON0, PMIC_LDO_VMC_OP_EN, PMIC_VMC_ANA_CON0, pwrap_write_field(), and val.

Referenced by mt6366_set_voltage().

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

◆ pmic_set_vmch_vol()

static void pmic_set_vmch_vol ( u32  vmch_uv)
static

Definition at line 636 of file mt6366.c.

References die(), PMIC_LDO_VMCH_CON0, PMIC_LDO_VMCH_OP_EN, PMIC_VMCH_ANA_CON0, pwrap_write_field(), and val.

Referenced by mt6366_set_voltage().

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

◆ pmic_set_vproc12_vol()

static void pmic_set_vproc12_vol ( u32  v_uv)
static

Definition at line 507 of file mt6366.c.

References assert, PMIC_VPROC12_OP_EN, PMIC_VPROC12_VOSEL, pwrap_write_field(), and udelay().

Referenced by mt6366_set_voltage().

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

◆ pmic_set_vsram_proc12_vol()

static void pmic_set_vsram_proc12_vol ( u32  v_uv)
static

Definition at line 529 of file mt6366.c.

References assert, PMIC_VSRAM_PROC12_OP_EN, PMIC_VSRAM_PROC12_VOSEL, pwrap_write_field(), and udelay().

Referenced by mt6366_set_voltage().

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 781 of file mt6366.c.

References PMIC_TOP_RST_MISC_CLR, PMIC_TOP_RST_MISC_SET, and pwrap_write_field().

Referenced by mt6366_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 807 of file mt6366.c.

References mt6366_protect_control(), PMIC_CPSDSA4, and pwrap_write_field().

Referenced by mt6366_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 801 of file mt6366.c.

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

Referenced by mt6366_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 mt6366.c.

Referenced by mt6366_init_setting().

◆ lp_setting

struct pmic_setting lp_setting[]
static

Definition at line 1 of file mt6366.c.

Referenced by mt6366_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 mt6366.c.

Referenced by mt6366_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 423 of file mt6366.c.

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