![]() |
coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
|
#include <device/mmio.h>
#include <console/console.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>
Go to the source code of this file.
Variables | |
static u8 | opt_gw_coarse_value [CHANNEL_NUM][DUAL_RANKS] |
static u8 | opt_gw_fine_value [CHANNEL_NUM][DUAL_RANKS] |
static s8 | wrlevel_dqs_dly [CHANNEL_NUM][DQS_NUMBER] |
void ca_training | ( | u32 | channel, |
const struct mt8173_sdram_params * | sdram_params | ||
) |
Definition at line 46 of file dramc_pi_calibration_api.c.
References ao_regs, CATRAINING_NUM, ch, CHANNEL_NUM, clrsetbits32, dramc_ddrphy_regs::cmddly, CMDDLY0_RA2_SHIFT, CMDDLY1_RA7_SHIFT, CMDDLY3_BA0_SHIFT, CMDDLY3_BA1_SHIFT, CMDDLY3_BA2_SHIFT, CMDDLY4_CAS_SHIFT, CMDDLY4_CKE_SHIFT, CMDDLY4_CS_SHIFT, CMDDLY4_RAS_SHIFT, CMDDLY5_RA13_SHIFT, CMDDLY5_WE_SHIFT, ddrphy_regs, dramc_ddrphy_regs::dqscal0, DQSCAL0_RA14_SHIFT, dramc_ao_regs::dqscal1, DQSCAL1_CKE1_SHIFT, dramc_dbg, dramc_ddrphy_regs::padctl1, PADCTL1_CLK_SHIFT, PADCTL1_CS1_SHIFT, params, and read32().
Referenced by do_calib().
Definition at line 607 of file dramc_pi_calibration_api.c.
References ch, clrsetbits32, ddrphy_regs, dramc_dbg, dramc_ddrphy_regs::phyclkduty, PHYCLKDUTY_CMDCLKP0DUTYN_SHIFT, PHYCLKDUTY_CMDCLKP0DUTYP_SHIFT, PHYCLKDUTY_CMDCLKP0DUTYSEL_SHIFT, and read32().
Referenced by do_calib().
Definition at line 319 of file dramc_pi_calibration_api.c.
References BIOS_ERR, dqs_gw_test(), printk, and set_gw_coarse_factor().
Referenced by rx_dqs_gating_cal().
Definition at line 261 of file dramc_pi_calibration_api.c.
References ao_regs, ch, clrbits32, dramc_phy_reset(), setbits32, dramc_ao_regs::spcmd, and SPCMD_DQSGCNTRST_SHIFT.
Referenced by dqs_gw_test(), and rx_dqs_gating_cal().
Definition at line 291 of file dramc_pi_calibration_api.c.
References ARRAY_SIZE, die(), dqs_gw_test(), MAX, MIN, and set_gw_fine_factor().
Referenced by rx_dqs_gating_cal().
|
static |
Definition at line 269 of file dramc_pi_calibration_api.c.
References ch, dqs_gw_counter_reset(), DQS_GW_GOLD_COUNTER_32BIT, DQS_GW_PATTERN1, DQS_GW_PATTERN2, DQS_GW_TE_OFFSET, dramc_nao_regs::dqsgnwcnt, dramc_engine2(), nao_regs, read32(), and TE_OP_READ_CHECK.
Referenced by dqs_gw_coarse_tune_calib(), and dqs_gw_fine_tune_calib().
Definition at line 447 of file dramc_pi_calibration_api.c.
References DEFAULT_TEST2_1_CAL, DEFAULT_TEST2_2_CAL, dramc_engine2(), and TE_OP_WRITE_READ_CHECK.
Referenced by dramc_window_perbit_cal_partial(), and perbit_window_cal().
void dramc_rankinctl_config | ( | u32 | channel, |
const struct mt8173_sdram_params * | sdram_params | ||
) |
Definition at line 426 of file dramc_pi_calibration_api.c.
References ao_regs, ch, clrsetbits32, dramc_ao_regs::dqscal1, dramc_ao_regs::dummy, is_dual_rank(), MIN, opt_gw_coarse_value, dramc_ao_regs::rkcfg, RKCFG_PBREF_DISBYRATE_SHIFT, setbits32, and value.
Referenced by do_calib().
u8 dramk_calcu_best_dly | ( | u8 | bit, |
struct dqs_perbit_dly * | p, | ||
u8 * | p_max_byte | ||
) |
Definition at line 545 of file dramc_pi_calibration_api.c.
References dqs_perbit_dly::best_dqdly, dqs_perbit_dly::best_dqsdly, dqs_perbit_dly::best_first_dqdly_pass, dqs_perbit_dly::best_first_dqsdly_pass, dqs_perbit_dly::best_last_dqdly_pass, dqs_perbit_dly::best_last_dqsdly_pass, BIOS_ERR, dramc_dbg, and printk.
Referenced by perbit_window_cal().
void dramk_check_dq_win | ( | struct dqs_perbit_dly * | p, |
u8 | dly_step, | ||
u8 | last_step, | ||
u32 | fail_bit | ||
) |
Definition at line 501 of file dramc_pi_calibration_api.c.
References dqs_perbit_dly::best_first_dqdly_pass, dqs_perbit_dly::best_last_dqdly_pass, dqs_perbit_dly::first_dqdly_pass, and dqs_perbit_dly::last_dqdly_pass.
Referenced by perbit_window_cal().
void dramk_check_dqs_win | ( | struct dqs_perbit_dly * | p, |
u8 | dly_step, | ||
u8 | last_step, | ||
u32 | fail_bit | ||
) |
Definition at line 458 of file dramc_pi_calibration_api.c.
References dqs_perbit_dly::best_first_dqsdly_pass, dqs_perbit_dly::best_last_dqsdly_pass, dqs_perbit_dly::first_dqsdly_pass, and dqs_perbit_dly::last_dqsdly_pass.
Referenced by perbit_window_cal().
void dual_rank_rx_datlat_cal | ( | u32 | channel, |
const struct mt8173_sdram_params * | sdram_params | ||
) |
Definition at line 651 of file dramc_pi_calibration_api.c.
References ao_regs, ch, clrbits32, dramc_dbg, MASK_RKCFG_RKSWAP_EN, opt_gw_coarse_value, opt_gw_fine_value, dramc_ao_regs::rkcfg, rx_datlat_cal(), set_dle_factor(), set_gw_coarse_factor(), set_gw_fine_factor(), and setbits32.
Referenced by do_calib().
void dual_rank_rx_dqs_gating_cal | ( | u32 | channel, |
const struct mt8173_sdram_params * | sdram_params | ||
) |
Definition at line 395 of file dramc_pi_calibration_api.c.
References ao_regs, ch, clrbits32, dramc_ao_regs::dqsctl1, DQSCTL1_DQSINCTL_SHIFT, MASK_RKCFG_RKSWAP_EN, opt_gw_coarse_value, opt_gw_fine_value, read32(), dramc_ao_regs::rkcfg, rx_dqs_gating_cal(), set_gw_coarse_factor(), set_gw_coarse_factor_rank1(), set_gw_fine_factor(), and setbits32.
Referenced by do_calib().
Definition at line 936 of file dramc_pi_calibration_api.c.
References dqs_perbit_dly::best_dqdly, dqs_perbit_dly::best_dqsdly, dqs_perbit_dly::best_first_dqdly_pass, dqs_perbit_dly::best_first_dqsdly_pass, dqs_perbit_dly::best_last_dqdly_pass, dqs_perbit_dly::best_last_dqsdly_pass, DATA_WIDTH_32BIT, die(), DQ_DATA_WIDTH, DQS_BIT_NUMBER, DQS_NUMBER, dram_k_perbit(), dramc_dbg, dramc_phy_reset(), dramk_calcu_best_dly(), dramk_check_dq_win(), dramk_check_dqs_win(), FIRST_DQ_DELAY, dqs_perbit_dly::first_dqdly_pass, FIRST_DQS_DELAY, dqs_perbit_dly::first_dqsdly_pass, dqs_perbit_dly::last_dqdly_pass, dqs_perbit_dly::last_dqsdly_pass, MAX_DQDLY_TAPS, MAX_RX_DQSDLY_TAPS, MAX_TX_DQSDLY_TAPS, set_dly_factor(), set_rx_best_dly_factor(), set_tx_best_dly_factor(), STAGE_HOLD, STAGE_SETUP, tx_delay_for_wrleveling(), TX_WIN, and type.
Referenced by do_calib().
u8 rx_datlat_cal | ( | u32 | channel, |
u8 | rank, | ||
const struct mt8173_sdram_params * | sdram_params | ||
) |
Definition at line 694 of file dramc_pi_calibration_api.c.
References ao_regs, BIOS_ERR, ch, clrbits32, DEFAULT_TEST2_1_CAL, DEFAULT_TEST2_2_CAL, DLE_TEST_NUM, dramc_dbg, dramc_engine2(), dramc_ao_regs::mckdly, MCKDLY_DQIENLAT_SHIFT, MCKDLY_DQIENQKEND_SHIFT, printk, set_dle_factor(), and TE_OP_WRITE_READ_CHECK.
Referenced by do_calib(), and dual_rank_rx_datlat_cal().
void rx_dqs_gating_cal | ( | u32 | channel, |
u8 | rank, | ||
const struct mt8173_sdram_params * | sdram_params | ||
) |
Definition at line 341 of file dramc_pi_calibration_api.c.
References ao_regs, BIOS_INFO, ch, clrbits32, ddrphy_regs, dqs_gw_coarse_tune_calib(), dqs_gw_counter_reset(), dqs_gw_fine_tune_calib(), dramc_ao_regs::dqscal0, DQSCAL0_STBCALEN_SHIFT, dramc_ao_regs::dqsctl1, DQSCTL1_DQSIENMODE_SHIFT, dramc_ddrphy_regs::dqsgctl, DQSGCTL_DQSGDUALP_SHIFT, dramc_dbg, opt_gw_coarse_value, opt_gw_fine_value, printk, set_gw_coarse_factor(), set_gw_fine_factor(), setbits32, dramc_ao_regs::spcmd, and SPCMD_DQSGCNTEN_SHIFT.
Referenced by do_calib(), and dual_rank_rx_dqs_gating_cal().
Definition at line 627 of file dramc_pi_calibration_api.c.
References ao_regs, ch, clrsetbits32, dramc_ao_regs::ddr2ctl, DDR2CTL_DATLAT_SHIFT, dramc_ao_regs::misc, MISC_DATLAT_DSEL_SHIFT, MISC_LATNORMP_SHIFT, dramc_ao_regs::padctl4, PADCTL4_DATLAT3_SHIFT, dramc_ao_regs::phyctl1, and PHYCTL1_DATLAT4_SHIFT.
Referenced by dual_rank_rx_datlat_cal(), and rx_datlat_cal().
Definition at line 840 of file dramc_pi_calibration_api.c.
References RX_DQ, RX_DQS, set_rx_dly_factor(), set_tx_dly_factor(), STAGE_HOLD_RX_WIN, STAGE_HOLD_TX_WIN, STAGE_SETUP_RX_WIN, STAGE_SETUP_TX_WIN, TX_DQ, TX_DQM, TX_DQS, and type.
Referenced by perbit_window_cal().
Definition at line 172 of file dramc_pi_calibration_api.c.
References ao_regs, ch, clrsetbits32, dramc_ao_regs::dqsctl1, DQSCTL1_DQSINCTL_SHIFT, dramc_ao_regs::selph2, SELPH2_TXDLY_DQSGATE_P1_SHIFT, SELPH2_TXDLY_DQSGATE_SHIFT, dramc_ao_regs::selph5, SELPH5_DLY_DQSGATE_P1_SHIFT, and SELPH5_DLY_DQSGATE_SHIFT.
Referenced by dqs_gw_coarse_tune_calib(), dual_rank_rx_datlat_cal(), dual_rank_rx_dqs_gating_cal(), and rx_dqs_gating_cal().
Definition at line 233 of file dramc_pi_calibration_api.c.
References ao_regs, ch, clrsetbits32, dramc_ao_regs::dqsctl2, DQSCTL2_DQSINCTL_SHIFT, dramc_ao_regs::selph6_1, SELPH6_1_DLY_R1DQSGATE_P1_SHIFT, SELPH6_1_DLY_R1DQSGATE_SHIFT, SELPH6_1_TXDLY_R1DQSGATE_P1_SHIFT, and SELPH6_1_TXDLY_R1DQSGATE_SHIFT.
Referenced by dual_rank_rx_dqs_gating_cal().
Definition at line 218 of file dramc_pi_calibration_api.c.
References ao_regs, ch, clrsetbits32, dramc_ao_regs::dqsien, DQSIEN_DQS0IEN_SHIFT, DQSIEN_DQS1IEN_SHIFT, DQSIEN_DQS2IEN_SHIFT, and DQSIEN_DQS3IEN_SHIFT.
Referenced by dqs_gw_fine_tune_calib(), dual_rank_rx_datlat_cal(), dual_rank_rx_dqs_gating_cal(), and rx_dqs_gating_cal().
|
static |
Definition at line 864 of file dramc_pi_calibration_api.c.
References ao_regs, dqs_perbit_dly::best_dqdly, ch, DATA_WIDTH_32BIT, dramc_ao_regs::dqidly, DQS_NUMBER, dramc_dbg, dramc_ao_regs::r0deldly, dramc_ao_regs::r1deldly, read32(), value, and write32().
Referenced by perbit_window_cal().
Definition at line 798 of file dramc_pi_calibration_api.c.
References ao_regs, ch, DATA_WIDTH_32BIT, dramc_ao_regs::dqidly, DQS_NUMBER, dramc_ao_regs::r0deldly, RX_DQ, RX_DQS, type, value, and write32().
Referenced by set_dly_factor().
|
static |
Definition at line 893 of file dramc_pi_calibration_api.c.
References ch, DATA_WIDTH_32BIT, ddrphy_regs, dramc_ddrphy_regs::dqodly, DQS_BIT_NUMBER, DQS_NUMBER, dramc_dbg, MASK_PADCTL2, dramc_ddrphy_regs::padctl2, dramc_ddrphy_regs::padctl3, read32(), value, and write32().
Referenced by perbit_window_cal().
Definition at line 816 of file dramc_pi_calibration_api.c.
References ch, ddrphy_regs, dramc_ddrphy_regs::dqodly, DQS_BIT_NUMBER, DQS_NUMBER, dramc_ddrphy_regs::padctl2, dramc_ddrphy_regs::padctl3, TX_DQ, TX_DQM, TX_DQS, type, value, and write32().
Referenced by set_dly_factor().
void sw_impedance_cal | ( | u32 | channel, |
const struct mt8173_sdram_params * | sdram_params | ||
) |
Definition at line 16 of file dramc_pi_calibration_api.c.
References ao_regs, ch, clrbits32, clrsetbits32, ddrphy_regs, dramc_dbg, dramc_ao_regs::drvctl1, dramc_ddrphy_regs::drvctl1, IMP_CALI_DRVN_SHIFT, IMP_CALI_DRVP_SHIFT, IMP_CALI_EN_SHIFT, IMP_CALI_ENN_SHIFT, IMP_CALI_ENP_SHIFT, dramc_ao_regs::impcal, dramc_ao_regs::iodrv4, dramc_ao_regs::iodrv6, mask, params, and value.
Referenced by do_calib().
void tx_delay_for_wrleveling | ( | u32 | channel, |
struct dqs_perbit_dly * | dqdqs_perbit_dly, | ||
u8 * | max_dqsdly_byte, | ||
u8 * | ave_dqdly_byte | ||
) |
Definition at line 745 of file dramc_pi_calibration_api.c.
References dqs_perbit_dly::best_dqdly, BIOS_ERR, DATA_WIDTH_32BIT, DQS_BIT_NUMBER, dramc_dbg, MAX_DQDLY_TAPS, printk, and wrlevel_dqs_dly.
Referenced by perbit_window_cal().
void write_leveling | ( | u32 | channel, |
const struct mt8173_sdram_params * | sdram_params | ||
) |
Definition at line 129 of file dramc_pi_calibration_api.c.
References ch, clrsetbits32, ddrphy_regs, dramc_ddrphy_regs::dqodly, DQS_BIT_NUMBER, DQS_NUMBER, dramc_dbg, MASK_PADCTL2_32BIT, dramc_ddrphy_regs::padctl2, PADCTL2_SHIFT, dramc_ddrphy_regs::padctl3, read32(), val, value, sdram_params::wr_level, write32(), and wrlevel_dqs_dly.
Referenced by do_calib().
|
static |
Definition at line 12 of file dramc_pi_calibration_api.c.
Referenced by dramc_rankinctl_config(), dual_rank_rx_datlat_cal(), dual_rank_rx_dqs_gating_cal(), and rx_dqs_gating_cal().
|
static |
Definition at line 13 of file dramc_pi_calibration_api.c.
Referenced by dual_rank_rx_datlat_cal(), dual_rank_rx_dqs_gating_cal(), and rx_dqs_gating_cal().
|
static |
Definition at line 14 of file dramc_pi_calibration_api.c.
Referenced by tx_delay_for_wrleveling(), and write_leveling().