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

Go to the source code of this file.

Macros

#define PRIORITY_FIELD(x)   ((x % 4) * 8)
 
#define PRIORITY_IN(id, priority)   (id << PRIORITY_FIELD(priority))
 
#define PRIORITY_OUT(id, priority)   (priority << PRIORITY_FIELD(id))
 
#define PENDING_US(x)   x
 

Enumerations

enum  {
  MD_ADCINF0 = 8 , MD_ADCINF1 = 9 , STAUPD = 10 , GPSINF0 = 11 ,
  PRIORITY_IN_SEL_2 , PRIORITY_OUT_SEL_2
}
 
enum  {
  STARVE_ENABLE = 0x1 << 10 , COUNTER0_PENDING_THRES = STARVE_ENABLE | PENDING_US(0x2) , COUNTER1_PENDING_THRES = STARVE_ENABLE | PENDING_US(0x3) , COUNTER2_PENDING_THRES = STARVE_ENABLE | PENDING_US(0x3) ,
  COUNTER3_PENDING_THRES = STARVE_ENABLE | PENDING_US(0x3) , COUNTER4_PENDING_THRES = STARVE_ENABLE | PENDING_US(0xf) , COUNTER5_PENDING_THRES = STARVE_ENABLE | PENDING_US(0x20) , COUNTER6_PENDING_THRES = STARVE_ENABLE | PENDING_US(0x28) ,
  COUNTER7_PENDING_THRES = STARVE_ENABLE | PENDING_US(0x28) , COUNTER8_PENDING_THRES = STARVE_ENABLE | PENDING_US(0x13) , COUNTER9_PENDING_THRES = STARVE_ENABLE | PENDING_US(0x17) , COUNTER10_PENDING_THRES = STARVE_ENABLE | PENDING_US(0x17) ,
  COUNTER11_PENDING_THRES = STARVE_ENABLE | PENDING_US(0x7c) , COUNTER12_PENDING_THRES = STARVE_ENABLE | PENDING_US(0x7c) , COUNTER13_PENDING_THRES = STARVE_ENABLE | PENDING_US(0x340) , COUNTER16_PENDING_THRES = STARVE_ENABLE | PENDING_US(0x340)
}
 

Functions

static void pwrap_soft_reset (void)
 
static void pwrap_spi_clk_set (void)
 
static s32 pwrap_init_dio (u16 dio_en)
 
static void pwrap_lock_spislvreg (void)
 
static void pwrap_initstaupd (void)
 
static void pwrap_starve_set (void)
 
static void pwrap_enable (void)
 
static s32 pwrap_init_sistrobe (void)
 
static void pwrap_init_spislv (void)
 
static void pwrap_init_reg_clock (void)
 
s32 pwrap_init (void)
 

Macro Definition Documentation

◆ PENDING_US

#define PENDING_US (   x)    x

Definition at line 30 of file pmic_wrap.c.

◆ PRIORITY_FIELD

#define PRIORITY_FIELD (   x)    ((x % 4) * 8)

Definition at line 9 of file pmic_wrap.c.

◆ PRIORITY_IN

#define PRIORITY_IN (   id,
  priority 
)    (id << PRIORITY_FIELD(priority))

Definition at line 10 of file pmic_wrap.c.

◆ PRIORITY_OUT

#define PRIORITY_OUT (   id,
  priority 
)    (priority << PRIORITY_FIELD(id))

Definition at line 11 of file pmic_wrap.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MD_ADCINF0 
MD_ADCINF1 
STAUPD 
GPSINF0 
PRIORITY_IN_SEL_2 
PRIORITY_OUT_SEL_2 

Definition at line 13 of file pmic_wrap.c.

◆ anonymous enum

anonymous enum
Enumerator
STARVE_ENABLE 
COUNTER0_PENDING_THRES 
COUNTER1_PENDING_THRES 
COUNTER2_PENDING_THRES 
COUNTER3_PENDING_THRES 
COUNTER4_PENDING_THRES 
COUNTER5_PENDING_THRES 
COUNTER6_PENDING_THRES 
COUNTER7_PENDING_THRES 
COUNTER8_PENDING_THRES 
COUNTER9_PENDING_THRES 
COUNTER10_PENDING_THRES 
COUNTER11_PENDING_THRES 
COUNTER12_PENDING_THRES 
COUNTER13_PENDING_THRES 
COUNTER16_PENDING_THRES 

Definition at line 31 of file pmic_wrap.c.

Function Documentation

◆ pwrap_enable()

static void pwrap_enable ( void  )
static

◆ pwrap_init()

◆ pwrap_init_dio()

static s32 pwrap_init_dio ( u16  dio_en)
static

Definition at line 74 of file pmic_wrap.c.

References mt8173_pwrap_regs::dio_en, mtk_pwrap, PMIC_DEW_DIO_EN, pwrap_write_nochk(), read32(), mt8173_pwrap_regs::wacs2_rdata, wait_for_idle_and_sync(), wait_us, and write32().

Referenced by pwrap_init().

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

◆ pwrap_init_reg_clock()

static void pwrap_init_reg_clock ( void  )
static

Definition at line 234 of file pmic_wrap.c.

References mt8173_pwrap_regs::cshext_read, mt8173_pwrap_regs::cshext_write, DUMMY_READ_CYCLES, mtk_pwrap, PMIC_DEW_RDDMY_NO, pwrap_write_nochk(), mt8173_pwrap_regs::rddmy, and write32().

Referenced by pwrap_init().

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

◆ pwrap_init_sistrobe()

static s32 pwrap_init_sistrobe ( void  )
static

Definition at line 158 of file pmic_wrap.c.

References DEFAULT_VALUE_READ_TEST, E_CLK_EDGE, E_CLK_LAST_SETTING, E_PWR_READ_TEST_FAIL, mtk_pwrap, PMIC_DEW_READ_TEST, PMIC_DEW_WRITE_TEST, PMIC_RG_SPI_CON2, pwrap_err, pwrap_read_nochk(), pwrap_write_nochk(), and write32().

Referenced by pwrap_init().

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

◆ pwrap_init_spislv()

static void pwrap_init_spislv ( void  )
static

Definition at line 220 of file pmic_wrap.c.

References PMIC_DRV_CON1, PMIC_FILTER_CON0, PMIC_GPIO_PULLEN0_CLR, PMIC_RG_SPI_CON0, PMIC_SMT_CON1, pwrap_write_nochk(), SPI_DRIVING, SPI_FILTER, SPI_PULL_DISABLE, and SPI_SMT.

Referenced by pwrap_init().

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

◆ pwrap_initstaupd()

◆ pwrap_lock_spislvreg()

static void pwrap_lock_spislvreg ( void  )
static

Definition at line 86 of file pmic_wrap.c.

References PMIC_SPISLV_KEY, and pwrap_write_nochk().

Referenced by pwrap_init().

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

◆ pwrap_soft_reset()

static void pwrap_soft_reset ( void  )
static

Definition at line 50 of file pmic_wrap.c.

References mt8183_infracfg_regs::infra_globalcon_rst2_clr, mt8183_infracfg_regs::infra_globalcon_rst2_set, mt8183_infracfg, and write32().

Referenced by pwrap_spi_clk_set().

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

◆ pwrap_spi_clk_set()

◆ pwrap_starve_set()