coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
dramc_pi_api.h File Reference
#include <types.h>
#include <soc/dramc_common.h>
#include <soc/emi.h>
Include dependency graph for dramc_pi_api.h:

Go to the source code of this file.

Data Structures

struct  reg_value
 

Macros

#define DATLAT_TAP_NUMBER   32
 
#define HW_REG_SHUFFLE_MAX   4
 
#define DRAMC_BROADCAST_ON   0x1f
 
#define DRAMC_BROADCAST_OFF   0x0
 
#define TX_DQ_COARSE_TUNE_TO_FINE_TUNE_TAP   64
 
#define IMP_LP4X_TERM_VREF_SEL   0x1b
 
#define IMP_DRVP_LP4X_UNTERM_VREF_SEL   0x1a
 
#define IMP_DRVN_LP4X_UNTERM_VREF_SEL   0x16
 
#define IMP_TRACK_LP4X_UNTERM_VREF_SEL   0x1a
 
#define MR23_DEFAULT_VALUE   0x3f
 
#define CA_TRAINING_NUM   10
 
#define _SELPH_DQS_BITS(l, h)
 

Enumerations

enum  dram_te_op { TE_OP_WRITE_READ_CHECK = 0 , TE_OP_READ_CHECK }
 
enum  { PASS_RANGE_NA = 0x7fff }
 
enum  { GATING_PATTERN_NUM = 0x23 , GATING_GOLDEND_DQSCNT = 0x4646 }
 
enum  cke_type { CKE_FIXOFF = 0 , CKE_FIXON , CKE_DYNAMIC }
 
enum  cbt_freq { CBT_LOW_FREQ = 0 , CBT_HIGH_FREQ }
 
enum  { IMPCAL_STAGE_DRVP = 0x1 , IMPCAL_STAGE_DRVN , IMPCAL_STAGE_TRACKING }
 
enum  {
  DQS_GW_COARSE_STEP = 1 , DQS_GW_FINE_END = 32 , DQS_GW_FINE_STEP = 4 , RX_DQS_CTL_LOOP = 8 ,
  RX_DLY_DQSIENSTB_LOOP = 32
}
 
enum  { DLL_MASTER = 0 , DLL_SLAVE }
 
enum  {
  DQ_DIV_SHIFT = 3 , DQ_DIV_MASK = BIT(DQ_DIV_SHIFT) - 1 , OEN_SHIFT = 16 , SELPH_DQS0_1600 = _SELPH_DQS_BITS(0x2, 0x1) ,
  SELPH_DQS1_1600 = _SELPH_DQS_BITS(0x1, 0x6) , SELPH_DQS0_2400 = _SELPH_DQS_BITS(0x3, 0x2) , SELPH_DQS1_2400 = _SELPH_DQS_BITS(0x1, 0x6) , SELPH_DQS0_3200 = _SELPH_DQS_BITS(0x3, 0x3) ,
  SELPH_DQS1_3200 = _SELPH_DQS_BITS(0x5, 0x2) , SELPH_DQS0_3600 = _SELPH_DQS_BITS(0x4, 0x3) , SELPH_DQS1_3600 = _SELPH_DQS_BITS(0x1, 0x6)
}
 

Functions

void dramc_get_rank_size (u64 *dram_rank_size)
 
void dramc_runtime_config (u32 rk_num)
 
void dramc_set_broadcast (u32 onoff)
 
u32 dramc_get_broadcast (void)
 
u8 get_freq_fsq (u8 freq_group)
 
void dramc_init (const struct sdram_params *params, u8 freq_group, struct dram_shared_data *shared)
 
void dramc_sw_impedance_save_reg (u8 freq_group, const struct dram_impedance *impedance)
 
void dramc_sw_impedance_cal (const struct sdram_params *params, u8 term_option, struct dram_impedance *impedance)
 
void dramc_apply_config_before_calibration (u8 freq_group, u32 cbt_mode)
 
void dramc_apply_config_after_calibration (const struct mr_value *mr, u32 rk_num)
 
int dramc_calibrate_all_channels (const struct sdram_params *pams, u8 freq_group, struct mr_value *mr, bool run_dvfs)
 
void dramc_hw_gating_onoff (u8 chn, bool onoff)
 
void dramc_enable_phy_dcm (u8 chn, bool bEn)
 
void dramc_mode_reg_write (u8 chn, u8 mr_idx, u8 value)
 
u32 get_shu_freq (u8 shu)
 
void dramc_hw_dqsosc (u8 chn, u32 rk_num)
 
void dramc_dqs_precalculation_preset (void)
 
void get_dram_info_after_cal (u8 *density, u32 rk_num)
 
void set_mrr_pinmux_mapping (void)
 
void dramc_cke_fix_onoff (enum cke_type option, u8 chn)
 
void cbt_mrr_pinmux_mapping (void)
 

Macro Definition Documentation

◆ _SELPH_DQS_BITS

#define _SELPH_DQS_BITS (   l,
 
)
Value:
((l << 0) | (l << 4) | (l << 8) | (l << 12) | \
(h << 16) | (h << 20) | (h << 24) | (h << 28))

Definition at line 73 of file dramc_pi_api.h.

◆ CA_TRAINING_NUM

#define CA_TRAINING_NUM   10

Definition at line 22 of file dramc_pi_api.h.

◆ DATLAT_TAP_NUMBER

#define DATLAT_TAP_NUMBER   32

Definition at line 10 of file dramc_pi_api.h.

◆ DRAMC_BROADCAST_OFF

#define DRAMC_BROADCAST_OFF   0x0

Definition at line 14 of file dramc_pi_api.h.

◆ DRAMC_BROADCAST_ON

#define DRAMC_BROADCAST_ON   0x1f

Definition at line 13 of file dramc_pi_api.h.

◆ HW_REG_SHUFFLE_MAX

#define HW_REG_SHUFFLE_MAX   4

Definition at line 11 of file dramc_pi_api.h.

◆ IMP_DRVN_LP4X_UNTERM_VREF_SEL

#define IMP_DRVN_LP4X_UNTERM_VREF_SEL   0x16

Definition at line 19 of file dramc_pi_api.h.

◆ IMP_DRVP_LP4X_UNTERM_VREF_SEL

#define IMP_DRVP_LP4X_UNTERM_VREF_SEL   0x1a

Definition at line 18 of file dramc_pi_api.h.

◆ IMP_LP4X_TERM_VREF_SEL

#define IMP_LP4X_TERM_VREF_SEL   0x1b

Definition at line 17 of file dramc_pi_api.h.

◆ IMP_TRACK_LP4X_UNTERM_VREF_SEL

#define IMP_TRACK_LP4X_UNTERM_VREF_SEL   0x1a

Definition at line 20 of file dramc_pi_api.h.

◆ MR23_DEFAULT_VALUE

#define MR23_DEFAULT_VALUE   0x3f

Definition at line 21 of file dramc_pi_api.h.

◆ TX_DQ_COARSE_TUNE_TO_FINE_TUNE_TAP

#define TX_DQ_COARSE_TUNE_TO_FINE_TUNE_TAP   64

Definition at line 15 of file dramc_pi_api.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
PASS_RANGE_NA 

Definition at line 29 of file dramc_pi_api.h.

◆ anonymous enum

anonymous enum
Enumerator
GATING_PATTERN_NUM 
GATING_GOLDEND_DQSCNT 

Definition at line 33 of file dramc_pi_api.h.

◆ anonymous enum

anonymous enum
Enumerator
IMPCAL_STAGE_DRVP 
IMPCAL_STAGE_DRVN 
IMPCAL_STAGE_TRACKING 

Definition at line 49 of file dramc_pi_api.h.

◆ anonymous enum

anonymous enum
Enumerator
DQS_GW_COARSE_STEP 
DQS_GW_FINE_END 
DQS_GW_FINE_STEP 
RX_DQS_CTL_LOOP 
RX_DLY_DQSIENSTB_LOOP 

Definition at line 55 of file dramc_pi_api.h.

◆ anonymous enum

anonymous enum
Enumerator
DLL_MASTER 
DLL_SLAVE 

Definition at line 63 of file dramc_pi_api.h.

◆ anonymous enum

anonymous enum
Enumerator
DQ_DIV_SHIFT 
DQ_DIV_MASK 
OEN_SHIFT 
SELPH_DQS0_1600 
SELPH_DQS1_1600 
SELPH_DQS0_2400 
SELPH_DQS1_2400 
SELPH_DQS0_3200 
SELPH_DQS1_3200 
SELPH_DQS0_3600 
SELPH_DQS1_3600 

Definition at line 76 of file dramc_pi_api.h.

◆ cbt_freq

enum cbt_freq
Enumerator
CBT_LOW_FREQ 
CBT_HIGH_FREQ 

Definition at line 44 of file dramc_pi_api.h.

◆ cke_type

enum cke_type
Enumerator
CKE_FIXOFF 
CKE_FIXON 
CKE_DYNAMIC 

Definition at line 38 of file dramc_pi_api.h.

◆ dram_te_op

enum dram_te_op
Enumerator
TE_OP_WRITE_READ_CHECK 
TE_OP_READ_CHECK 

Definition at line 24 of file dramc_pi_api.h.

Function Documentation

◆ cbt_mrr_pinmux_mapping()

void cbt_mrr_pinmux_mapping ( void  )

Definition at line 160 of file emi.c.

References ch, CHANNEL_MAX, phy_mapping, and write32().

Referenced by dramc_cmd_bus_training().

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

◆ dramc_apply_config_after_calibration()

void dramc_apply_config_after_calibration ( const struct mr_value mr,
u32  rk_num 
)

Definition at line 816 of file dramc_pi_calibration_api.c.

References ch, CHANNEL_MAX, CKE_DYNAMIC, clrbits32, clrsetbits32, DRAM_DFS_SHUFFLE_MAX, dramc_cke_fix_onoff(), dramc_set_mr13_vrcg_to_normal(), setbits32, and write32().

Referenced by after_calib().

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

◆ dramc_apply_config_before_calibration()

◆ dramc_calibrate_all_channels()

◆ dramc_cke_fix_onoff()

void dramc_cke_fix_onoff ( enum cke_type  option,
u8  chn 
)

◆ dramc_dqs_precalculation_preset()

void dramc_dqs_precalculation_preset ( void  )

Definition at line 2688 of file dramc_pi_calibration_api.c.

References ch, CHANNEL_MAX, DIV_ROUND_CLOSEST, DRAM_DFS_SHUFFLE_MAX, dramc_dbg, get_shu_freq(), HW_REG_SHUFFLE_MAX, dramc_ao_regs_rk::pre_tdqsck, RANK_0, RANK_MAX, READ32_BITFIELD, and SET32_BITFIELDS.

Referenced by dramc_runtime_config().

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

◆ dramc_enable_phy_dcm()

void dramc_enable_phy_dcm ( u8  chn,
bool  bEn 
)

Definition at line 642 of file dramc_pi_calibration_api.c.

References ch, clrbits32, clrsetbits32, DRAM_DFS_SHUFFLE_MAX, dramc_phy_dcm_2_channel(), mask, setbits32, value, and write32().

Referenced by dramc_apply_config_before_calibration(), and dramc_runtime_config().

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

◆ dramc_get_broadcast()

u32 dramc_get_broadcast ( void  )

Definition at line 64 of file emi.c.

References mt8183_infracfg_regs::dramc_wbr, mt8183_infracfg, and read32().

Referenced by auto_refresh_cke_off(), dramc_mode_reg_init(), and dramc_sw_impedance_cal().

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

◆ dramc_get_rank_size()

void dramc_get_rank_size ( u64 dram_rank_size)

Definition at line 93 of file emi.c.

References CHANNEL_A, CHANNEL_B, emi_regs::cona, emi_regs::conh, get_ch_rank_size(), RANK_0, RANK_1, and read32().

Referenced by mt_mem_test(), and sdram_size().

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

◆ dramc_hw_dqsosc()

void dramc_hw_dqsosc ( u8  chn,
u32  rk_num 
)

Definition at line 2570 of file dramc_pi_calibration_api.c.

References ch, DRAM_DFS_SHUFFLE_1, DRAM_DFS_SHUFFLE_2, DRAM_DFS_SHUFFLE_3, DRAM_DFS_SHUFFLE_MAX, get_shu_freq(), RANK_MAX, and SET32_BITFIELDS.

Referenced by dramc_runtime_config().

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

◆ dramc_hw_gating_onoff()

void dramc_hw_gating_onoff ( u8  chn,
bool  onoff 
)

Definition at line 699 of file dramc_pi_calibration_api.c.

References ch, and clrsetbits32.

Referenced by dramc_apply_config_before_calibration(), dramc_runtime_config(), and dramc_rx_dqs_gating_cal_pre().

Here is the caller graph for this function:

◆ dramc_init()

void dramc_init ( const struct sdram_params params,
u8  freq_group,
struct dram_shared_data shared 
)

◆ dramc_mode_reg_write()

void dramc_mode_reg_write ( u8  chn,
u8  mr_idx,
u8  value 
)

Definition at line 114 of file dramc_pi_calibration_api.c.

References ch, CKE_FIXON, dramc_cke_fix_onoff(), dramc_dbg, read32(), READ32_BITFIELD, SET32_BITFIELDS, udelay(), value, and write32().

Referenced by dqsosc_auto(), dramc_mode_reg_init(), and dramc_mode_reg_write_by_rank().

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

◆ dramc_runtime_config()

◆ dramc_set_broadcast()

void dramc_set_broadcast ( u32  onoff)

Definition at line 59 of file emi.c.

References mt8183_infracfg_regs::dramc_wbr, mt8183_infracfg, and write32().

Referenced by auto_refresh_cke_off(), dramc_mode_reg_init(), dramc_sw_impedance_cal(), dramc_sw_impedance_save_reg(), emi_esl_setting1(), emi_esl_setting2(), init_dram(), and update_initial_settings().

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

◆ dramc_sw_impedance_cal()

void dramc_sw_impedance_cal ( const struct sdram_params params,
u8  term_option,
struct dram_impedance impedance 
)

◆ dramc_sw_impedance_save_reg()

void dramc_sw_impedance_save_reg ( u8  freq_group,
const struct dram_impedance impedance 
)

Definition at line 139 of file dramc_pi_basic_api.c.

References ch, clrsetbits32, dram_impedance::data, DRAMC_BROADCAST_OFF, DRAMC_BROADCAST_ON, dramc_set_broadcast(), FSP_0, get_freq_fsq(), ODT_OFF, ODT_ON, and SET32_BITFIELDS.

Here is the call graph for this function:

◆ get_dram_info_after_cal()

void get_dram_info_after_cal ( u8 density,
u32  rk_num 
)

Definition at line 3052 of file dramc_pi_calibration_api.c.

References CHANNEL_A, dramc_dbg, dramc_mode_reg_read_by_rank(), dramc_show, and RANK_0.

Referenced by run_calib().

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

◆ get_freq_fsq()

◆ get_shu_freq()

u32 get_shu_freq ( u8  shu)

Definition at line 69 of file emi.c.

References CONFIG, freq_shuffle, freq_shuffle_emcp, and frequency_table.

Referenced by dramc_dqs_precalculation_preset(), and dramc_hw_dqsosc().

Here is the caller graph for this function:

◆ set_mrr_pinmux_mapping()

void set_mrr_pinmux_mapping ( void  )

Definition at line 173 of file emi.c.

References ch, CHANNEL_MAX, phy_mapping, and write32().

Referenced by dramc_cmd_bus_training(), and global_option_init().

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