coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
dramc_pi_basic_api.c File Reference
#include <device/mmio.h>
#include <assert.h>
#include <console/console.h>
#include <delay.h>
#include <soc/addressmap.h>
#include <soc/dramc_common.h>
#include <soc/dramc_register.h>
#include <soc/dramc_pi_api.h>
#include <soc/dramc_soc.h>
#include <soc/emi.h>
#include <soc/mt6391.h>
#include <soc/pll.h>
#include <soc/spm.h>
#include <types.h>
Include dependency graph for dramc_pi_basic_api.c:

Go to the source code of this file.

Data Structures

struct  mem_pll
 

Functions

u8 is_dual_rank (u32 channel, const struct mt8173_sdram_params *sdram_params)
 
static void mem_pll_pre_init (u32 channel)
 
static void mem_pll_init_set_params (u32 channel)
 
static void mem_pll_init_phase_sync (u32 channel)
 
static void pll_phase_adjust (u32 channel, struct mem_pll *mempll, int reg_offs)
 
static void pll_phase_check (u32 channel, struct mem_pll *mempll, int idx)
 
static void mem_pll_phase_cali (u32 channel)
 
void mem_pll_init (const struct mt8173_sdram_params *sdram_params)
 
void dramc_pre_init (u32 channel, const struct mt8173_sdram_params *sdram_params)
 
static void mrs_write (int channel, int rank, u32 mrs_value, unsigned int dly)
 
static void dramc_set_mrs_value (int channel, int rank, const struct mt8173_sdram_params *sdram_params)
 
void dramc_init (u32 channel, const struct mt8173_sdram_params *sdram_params)
 
void div2_phase_sync (void)
 
void dramc_phy_reset (u32 channel)
 
void dramc_runtime_config (u32 channel, const struct mt8173_sdram_params *sdram_params)
 
void transfer_to_spm_control (void)
 
void transfer_to_reg_control (void)
 
u32 dramc_engine2 (u32 channel, enum dram_tw_op wr, u32 test2_1, u32 test2_2, u8 testaudpat, u8 log2loopcount)
 

Function Documentation

◆ div2_phase_sync()

void div2_phase_sync ( void  )

Definition at line 651 of file dramc_pi_basic_api.c.

References ch, CHANNEL_B, clrbits32, ddrphy_regs, MEMCLKENB_SHIFT, dramc_ddrphy_regs::mempll_divider, setbits32, and udelay().

Referenced by init_dram(), and mem_pll_init().

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

◆ dramc_engine2()

◆ dramc_init()

void dramc_init ( u32  channel,
const struct mt8173_sdram_params sdram_params 
)

Definition at line 451 of file dramc_pi_basic_api.c.

References dramc_ao_regs::actim0, dramc_ao_regs::actim1, ao_regs, dramc_ao_regs::arbctl0, assert, ch, dramc_ao_regs::clk1delay, dramc_ao_regs::clkctl, clrbits32, dramc_ao_regs::conf1, dramc_ao_regs::conf2, dramc_ao_regs::ddr2ctl, dramc_ddrphy_regs::ddr2ctl, ddrphy_regs, DEFAULT_DRIVING, dramc_ao_regs::dllconf, dramc_ao_regs::dqidly, DQS_BIT_NUMBER, dramc_ao_regs::dqscal0, dramc_ddrphy_regs::dqscal0, dramc_ao_regs::dqsctl1, dramc_ao_regs::dqsctl2, dramc_ddrphy_regs::dqsgctl, dramc_ao_regs::dqsien, dramc_ddrphy_regs::dqsisel, dramc_ao_regs::dramc_pd_ctrl, dramc_set_mrs_value(), DRIVING_DS2_0, dramc_ao_regs::drvctl1, dramc_ddrphy_regs::drvctl1, dramc_ao_regs::dummy, dramc_ao_regs::gddr3ctl1, dramc_ddrphy_regs::gddr3ctl1, dramc_ddrphy_regs::ioctl, dramc_ao_regs::iodrv6, is_dual_rank(), dramc_ao_regs::mckdly, dramc_ddrphy_regs::mckdly, dramc_ao_regs::misc, dramc_ao_regs::misctl0, dramc_ddrphy_regs::misctl0, dramc_ao_regs::ocdk, dramc_ddrphy_regs::ocdk, dramc_ddrphy_regs::padctl1, dramc_ddrphy_regs::padctl2, dramc_ao_regs::padctl4, dramc_ao_regs::padctl7, dramc_ao_regs::perfctl0, dramc_ddrphy_regs::peri, dramc_ddrphy_regs::phyclkduty, dramc_ao_regs::phyctl1, dramc_ao_regs::r0deldly, dramc_ao_regs::r1deldly, dramc_ao_regs::rkcfg, mt8173_calib_params::rx_dq_dly, mt8173_calib_params::rx_dqs_dly, setbits32, dramc_ddrphy_regs::tdsel, dramc_ao_regs::test2_3, dramc_ao_regs::test2_4, udelay(), dramc_ao_regs::wodt, write32(), and dramc_ao_regs::zqcs.

Referenced by dfs_init_for_calibration(), and init_dram().

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

◆ dramc_phy_reset()

void dramc_phy_reset ( u32  channel)

Definition at line 661 of file dramc_pi_basic_api.c.

References ao_regs, ch, clrbits32, ddrphy_regs, dramc_ao_regs::gddr3ctl1, GDDR3CTL1_RDATRST_SHIFT, dramc_ddrphy_regs::phyctl1, PHYCTL1_PHYRST_SHIFT, setbits32, and udelay().

Referenced by dqs_gw_counter_reset(), and perbit_window_cal().

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

◆ dramc_pre_init()

void dramc_pre_init ( u32  channel,
const struct mt8173_sdram_params sdram_params 
)

◆ dramc_runtime_config()

void dramc_runtime_config ( u32  channel,
const struct mt8173_sdram_params sdram_params 
)

Definition at line 680 of file dramc_pi_basic_api.c.

References ao_regs, BIT, ch, CHANNEL_A, clrbits32, dramc_ddrphy_regs::ddrphy_cg_ctrl, ddrphy_regs, die(), dramc_ao_regs::dqscal0, DQSCAL0_STBCALEN_SHIFT, dramc_ddrphy_regs::dqsgctl, dramc_ao_regs::dummy, MHz, dramc_ao_regs::perfctl0, setbits32, and dramc_ao_regs::spcmd.

Referenced by after_calib(), and do_calib().

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

◆ dramc_set_mrs_value()

static void dramc_set_mrs_value ( int  channel,
int  rank,
const struct mt8173_sdram_params sdram_params 
)
static

Definition at line 434 of file dramc_pi_basic_api.c.

References mrs_write().

Referenced by dramc_init().

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

◆ is_dual_rank()

u8 is_dual_rank ( u32  channel,
const struct mt8173_sdram_params sdram_params 
)
inline

Definition at line 24 of file dramc_pi_basic_api.c.

Referenced by do_calib(), dramc_init(), dramc_rankinctl_config(), and set_rank_info_to_conf().

Here is the caller graph for this function:

◆ mem_pll_init()

◆ mem_pll_init_phase_sync()

static void mem_pll_init_phase_sync ( u32  channel)
static

Definition at line 141 of file dramc_pi_basic_api.c.

References BIT, ch, clrsetbits32, ddrphy_regs, dramc_ddrphy_regs::mempll_divider, and write32().

Referenced by mem_pll_init().

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

◆ mem_pll_init_set_params()

static void mem_pll_init_set_params ( u32  channel)
static

Definition at line 94 of file dramc_pi_basic_api.c.

References ch, ddrphy_regs, dramc_ddrphy_regs::mempll, and write32().

Referenced by mem_pll_init().

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

◆ mem_pll_phase_cali()

static void mem_pll_phase_cali ( u32  channel)
static

Definition at line 225 of file dramc_pi_basic_api.c.

References ch, clrbits32, clrsetbits32, ddrphy_regs, delay(), die(), mem_pll::done, dramc_dbg, dramc_ddrphy_regs::jmeter, JMETER_COUNT, JMETER_COUNTER_MASK, JMETER_COUNTER_SHIFT, JMETER_EN_BIT, JMETER_WAIT_DONE_US, pll_phase_adjust(), pll_phase_check(), setbits32, and udelay().

Referenced by mem_pll_init().

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

◆ mem_pll_pre_init()

◆ mrs_write()

static void mrs_write ( int  channel,
int  rank,
u32  mrs_value,
unsigned int  dly 
)
static

Definition at line 425 of file dramc_pi_basic_api.c.

References ao_regs, ch, dramc_ao_regs::mrs, dramc_ao_regs::spcmd, udelay(), and write32().

Referenced by dramc_set_mrs_value().

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

◆ pll_phase_adjust()

static void pll_phase_adjust ( u32  channel,
struct mem_pll mempll,
int  reg_offs 
)
static

◆ pll_phase_check()

static void pll_phase_check ( u32  channel,
struct mem_pll mempll,
int  idx 
)
static

Definition at line 182 of file dramc_pi_basic_api.c.

References ch, ddrphy_regs, mem_pll::delay, mem_pll::done, dramc_dbg, JMETER_COUNT_N, dramc_ddrphy_regs::jmeter_pll_st, MEMPLL_INIT, MEMPLL_REF_LAG, MEMPLL_REF_LEAD, mem_pll::phase, read32(), and value.

Referenced by mem_pll_phase_cali().

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

◆ transfer_to_reg_control()

void transfer_to_reg_control ( void  )

Definition at line 740 of file dramc_pi_basic_api.c.

References BIT, ch, CHANNEL_A, CHANNEL_B, ddrphy_regs, mtk_apmixed, dramc_ddrphy_regs::peri, setbits32, val, and write32().

Referenced by do_calib().

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

◆ transfer_to_spm_control()

void transfer_to_spm_control ( void  )

Definition at line 722 of file dramc_pi_basic_api.c.

References BIT, ch, CHANNEL_A, CHANNEL_B, clrbits32, ddrphy_regs, mtk_apmixed, and dramc_ddrphy_regs::peri.

Referenced by do_calib().

Here is the caller graph for this function: