Hello Duan huayang,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/44709
to review the following change.
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
soc/mediatek/mt8192: Add dramc 8 phase calibration
Signed-off-by: Huayang Duan huayang.duan@mediatek.com Change-Id: Ib4ccaa8d43b8382cbc64cf82de86ad1ac16cb89a --- M src/soc/mediatek/mt8192/dramc_pi_basic_api.c M src/soc/mediatek/mt8192/dramc_pi_calibration_api.c 2 files changed, 344 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/09/44709/1
diff --git a/src/soc/mediatek/mt8192/dramc_pi_basic_api.c b/src/soc/mediatek/mt8192/dramc_pi_basic_api.c index fb250ab..b5b262b 100644 --- a/src/soc/mediatek/mt8192/dramc_pi_basic_api.c +++ b/src/soc/mediatek/mt8192/dramc_pi_basic_api.c @@ -3790,6 +3790,7 @@ { dramc_setting(cali); dramc_reset_delay_chain_before_calibration(); + dramc_8_phase_cal(cali); }
static void dramc_before_calibration(const struct ddr_cali *cali) diff --git a/src/soc/mediatek/mt8192/dramc_pi_calibration_api.c b/src/soc/mediatek/mt8192/dramc_pi_calibration_api.c index 38a8048..22a2545 100644 --- a/src/soc/mediatek/mt8192/dramc_pi_calibration_api.c +++ b/src/soc/mediatek/mt8192/dramc_pi_calibration_api.c @@ -236,3 +236,346 @@ dramc_set_broadcast(bc_bak); }
+static void dramc_phy_reset(u8 chn) +{ + SET32_BITFIELDS(&ch[chn].ao.rx_set0, RX_SET0_RDATRST, 1); + SET32_BITFIELDS(&ch[chn].phy_ao.misc_ctrl1, MISC_CTRL1_R_DMPHYRST, 1); + SET32_BITFIELDS(&ch[chn].phy_ao.dvs_b[0].b0_dq9, + B0_DQ9_RG_RX_ARDQS0_STBEN_RESETB_B0, 0, + B0_DQ9_RG_RX_ARDQ_STBEN_RESETB_B0, 0); + SET32_BITFIELDS(&ch[chn].phy_ao.dvs_b[1].b0_dq9, + B1_DQ9_RG_RX_ARDQS0_STBEN_RESETB_B1, 0, + B1_DQ9_RG_RX_ARDQ_STBEN_RESETB_B1, 0); + udelay(1); + SET32_BITFIELDS(&ch[chn].phy_ao.dvs_b[1].b0_dq9, + B1_DQ9_RG_RX_ARDQS0_STBEN_RESETB_B1, 1, + B1_DQ9_RG_RX_ARDQ_STBEN_RESETB_B1, 1); + SET32_BITFIELDS(&ch[chn].phy_ao.dvs_b[0].b0_dq9, + B0_DQ9_RG_RX_ARDQS0_STBEN_RESETB_B0, 1, + B0_DQ9_RG_RX_ARDQ_STBEN_RESETB_B0, 1); + SET32_BITFIELDS(&ch[chn].phy_ao.misc_ctrl1, MISC_CTRL1_R_DMPHYRST, 0); + SET32_BITFIELDS(&ch[chn].ao.rx_set0, RX_SET0_RDATRST, 0); +} + +static int dramc_8_phase_cal_find_best_dly(u8 phase_sm, u8 ph_dly, u8 ph_dly_back, + u8 *dqs_level, u8 *ph_dly_final, u8 *ph_dly_loop_break) +{ + u8 early_break_cnt = 5; + static u8 loop_cnt = 0; + static u16 r0 = 0xffff, r180 = 0xffff, r_tmp = 0xffff, p_tmp = 0xffff; + static s16 err_code = 0x7fff, err_code_min = 0x7fff; + u16 dqs_dly = 0, jm_dly_start = 0, jm_dly_end = 512, jm_dly_step = 1; + u32 sample_cnt, ones_cnt[DQS_NUMBER]; + + dramc_dbg("8PH dly = %d\n", ph_dly); + SET32_BITFIELDS(&ch[0].phy_ao.byte[0].shu_b0_dq1, + SHU_B0_DQ1_RG_ARPI_MIDPI_8PH_DLY_B0, ph_dly); + SET32_BITFIELDS(&ch[0].phy_ao.byte[1].shu_b0_dq1, + SHU_B1_DQ1_RG_ARPI_MIDPI_8PH_DLY_B1, ph_dly); + SET32_BITFIELDS(&ch[0].phy_ao.shu_ca_cmd1, + SHU_CA_CMD1_RG_ARPI_MIDPI_8PH_DLY_CA, ph_dly); + + for (dqs_dly = jm_dly_start; dqs_dly < jm_dly_end; dqs_dly += jm_dly_step) { + /* Set DQS delay */ + SET32_BITFIELDS(&ch[0].phy_ao.dvs_b[0].b0_phy2, + B0_PHY2_RG_RX_ARDQS_JM_DLY_B0, dqs_dly); + SET32_BITFIELDS(&ch[0].phy_ao.dvs_b[1].b0_phy2, + B1_PHY2_RG_RX_ARDQS_JM_DLY_B1, dqs_dly); + dramc_phy_reset(0); + SET32_BITFIELDS(&ch[0].phy_ao.misc_dutyscan1, + MISC_DUTYSCAN1_REG_SW_RST, 1); + SET32_BITFIELDS(&ch[0].phy_ao.misc_dutyscan1, + MISC_DUTYSCAN1_REG_SW_RST, 0); + SET32_BITFIELDS(&ch[0].phy_ao.misc_dutyscan1, + MISC_DUTYSCAN1_RX_EYE_SCAN_EN, 1); + udelay(10); + SET32_BITFIELDS(&ch[0].phy_ao.misc_dutyscan1, + MISC_DUTYSCAN1_RX_EYE_SCAN_EN, 0); + sample_cnt = READ32_BITFIELD(&ch[0].phy_nao.misc_duty_toggle_cnt, + MISC_DUTY_TOGGLE_CNT_TOGGLE_CNT); + ones_cnt[0] = READ32_BITFIELD(&ch[0].phy_nao.misc_duty_dqs0_err_cnt, + MISC_DUTY_DQS0_ERR_CNT_DQS0_ERR_CNT); + + if (ones_cnt[0] < (sample_cnt / 2)) { + if (*dqs_level == 0xff) + dramc_dbg("[L] %d, %8d\n", dqs_dly, ones_cnt[0]); + *dqs_level = 0; + } else { + if (*dqs_level == 0) { + *dqs_level = 1; + dramc_dbg("[H] %d, %8d\n", dqs_dly, ones_cnt[0]); + + if (phase_sm == DQS_8PH_DEGREE_0) { + r0 = dqs_dly; + dramc_dbg("R0 = %d\n", r0); + break; + } else if (phase_sm == DQS_8PH_DEGREE_180) { + r180 = dqs_dly; + if (r180 > r0) { + r_tmp = r0 + ((r180 - r0) >> 2); + dramc_dbg("R = %d, R180 = %d\n", r_tmp, r180); + break; + } else { + *dqs_level = 0xff; + } + } else if (phase_sm == DQS_8PH_DEGREE_45) { + p_tmp = dqs_dly; + dramc_dbg("p_tmp =%d, R0 = %d\n", p_tmp, r0); + if (p_tmp > r0) { + if (r_tmp > p_tmp) + err_code = r_tmp - p_tmp; + else + err_code = p_tmp - r_tmp; + + if (err_code == 0) { + *ph_dly_final = ph_dly; + *ph_dly_loop_break = 1; + } else if (err_code < err_code_min) { + err_code_min = err_code; + *ph_dly_final = ph_dly; + loop_cnt = 0; + } else if (err_code >= err_code_min) { + loop_cnt++; + if (loop_cnt > early_break_cnt) + *ph_dly_loop_break = 1; + } + + dramc_dbg("diff (P-R) = %d, min = %d, break count = %d\n", + err_code, err_code_min, loop_cnt); + break; + } else { + *dqs_level = 0xff; + } + } else { + dramc_dbg("phase_sm err!\n"); + } + } + } + + } + + if ((*dqs_level == 0xff) || (*dqs_level == 0)) { + *ph_dly_final = ph_dly_back; + dramc_dbg("8-Phase SM_%d is fail (to Default)!\n", phase_sm); + return 0; + } else if (*ph_dly_loop_break == 1) + return -1; + + return -2; +} + +static void dramc_8_phase_cal_set_best_dly(const struct ddr_cali *cali, u8 ph_dly_back) +{ + u8 dqsien_pi = 0; + u8 phase_sm, ph_dly = 0, ph_start = 0, ph_end = 0, ph_dly_final = 0xff; + u8 ph_dly_loop_break = 0; + + for (phase_sm = DQS_8PH_DEGREE_0; phase_sm < DQS_8PH_DEGREE_MAX; phase_sm++) { + switch (phase_sm) { + case DQS_8PH_DEGREE_0: + dqsien_pi = 16; + ph_start = 0; + ph_end = 1; + break; + case DQS_8PH_DEGREE_180: + dqsien_pi = 48; + ph_start = 0; + ph_end = 1; + break; + case DQS_8PH_DEGREE_45: + dqsien_pi = 24; + ph_start = 0; + ph_end = 32; + break; + default: + dramc_dbg("phase_sm err!\n"); + break; + } + + dramc_dbg("8-Phase SM_%d, 8PH_dly (%d~%d), DQSIEN PI = %d, 8PH_Dly = %d\n", + phase_sm, ph_start, ph_end, dqsien_pi, ph_dly_back); + + for (u8 rk = RANK_0; rk < cali->support_ranks; rk++) + SET32_BITFIELDS(&ch[0].phy_ao.byte[0].rk[rk].shu_rk_b0_dqsien_pi_dly, + SHU_RK_B0_DQSIEN_PI_DLY_DQSIEN_PI_B0, dqsien_pi); + + for (ph_dly = ph_start; ph_dly < ph_end; ph_dly++) { + u8 dqs_level = 0xff; + int ret = dramc_8_phase_cal_find_best_dly(phase_sm, ph_dly, + ph_dly_back, &dqs_level, + &ph_dly_final, &ph_dly_loop_break); + if (ret == 0) + goto final_found; + if (ph_dly_loop_break == 1) + break; + } + } + +final_found: + dramc_dbg("8 phase calibration ph_dly_final = %d\n", ph_dly_final); + for (u8 chn = 0; chn < CHANNEL_MAX; chn++) { + SET32_BITFIELDS(&ch[chn].phy_ao.byte[0].shu_b0_dq1, + SHU_B0_DQ1_RG_ARPI_MIDPI_8PH_DLY_B0, ph_dly_final); + SET32_BITFIELDS(&ch[chn].phy_ao.byte[1].shu_b0_dq1, + SHU_B1_DQ1_RG_ARPI_MIDPI_8PH_DLY_B1, ph_dly_final); + SET32_BITFIELDS(&ch[chn].phy_ao.shu_ca_cmd1, + SHU_CA_CMD1_RG_ARPI_MIDPI_8PH_DLY_CA, ph_dly_final); + } +} + +void dramc_8_phase_cal(const struct ddr_cali *cali) +{ + u8 ph_dly_back = 0; + dram_freq_grp freq_group = cali->freq_group; + + if (freq_group < DDRFREQ_2133) { + dramc_dbg("Freq %d < 2133, do not need do 8-Phase\n", get_frequency(cali)); + return; + } + + struct reg_bak regs_bak[] = { + {&ch[0].phy_ao.misc_dutyscan1}, + {&ch[0].phy_ao.dvs_b[0].b0_dq6}, + {&ch[0].phy_ao.dvs_b[1].b0_dq6}, + {&ch[0].phy_ao.dvs_b[0].b0_dq5}, + {&ch[0].phy_ao.dvs_b[1].b0_dq5}, + {&ch[0].phy_ao.dvs_b[0].b0_dq3}, + {&ch[0].phy_ao.dvs_b[1].b0_dq3}, + {&ch[0].phy_ao.misc_ctrl1}, + {&ch[0].phy_ao.misc_ctrl4}, + {&ch[0].phy_ao.dvs_b[0].b0_phy2}, + {&ch[0].phy_ao.dvs_b[1].b0_phy2}, + {&ch[0].phy_ao.byte[0].shu_b0_dll_arpi2}, + {&ch[0].phy_ao.byte[1].shu_b0_dll_arpi2}, + {&ch[0].phy_ao.byte[0].shu_b0_dq11}, + {&ch[0].phy_ao.byte[1].shu_b0_dq11}, + {&ch[0].phy_ao.shu_ca_cmd11}, + {&ch[0].phy_ao.misc_stbcal}, + {&ch[0].phy_ao.byte[0].rk[0].shu_rk_b0_dqsien_pi_dly}, + {&ch[0].phy_ao.byte[0].rk[1].shu_rk_b0_dqsien_pi_dly}, + {&ch[0].phy_ao.misc_jmeter}, + {&ch[0].phy_ao.misc_shu_stbcal}, + {&ch[0].phy_ao.shu_ca_dll1}, + {&ch[0].phy_ao.byte[0].shu_b0_dll1}, + {&ch[0].phy_ao.byte[1].shu_b0_dll1}, + {&ch[0].phy_ao.dvs_b[0].b0_dq2}, + {&ch[0].phy_ao.dvs_b[1].b0_dq2}, + {&ch[0].phy_ao.ca_cmd2}, + {&ch[0].phy_ao.byte[0].shu_b0_dq13}, + {&ch[0].phy_ao.byte[1].shu_b0_dq13}, + {&ch[0].phy_ao.shu_ca_cmd13}, + {&ch[1].phy_ao.shu_ca_dll1}, + {&ch[1].phy_ao.byte[0].shu_b0_dll1}, + {&ch[1].phy_ao.byte[1].shu_b0_dll1}, + {&ch[1].phy_ao.dvs_b[0].b0_dq2}, + {&ch[1].phy_ao.dvs_b[1].b0_dq2}, + {&ch[1].phy_ao.ca_cmd2}, + {&ch[1].phy_ao.byte[0].shu_b0_dq13}, + {&ch[1].phy_ao.byte[1].shu_b0_dq13}, + {&ch[1].phy_ao.shu_ca_cmd13}, + }; + for (size_t i = 0; i < ARRAY_SIZE(regs_bak); i++) + regs_bak[i].value = read32(regs_bak[i].addr); + + for (u8 chn = 0; chn < CHANNEL_MAX; chn++) { + SET32_BITFIELDS(&ch[chn].phy_ao.dvs_b[0].b0_dq2, + B0_DQ2_RG_TX_ARDQS_OE_TIE_SEL_B0, 0, + B0_DQ2_RG_TX_ARDQS_OE_TIE_EN_B0, 1, + B0_DQ2_RG_TX_ARWCK_OE_TIE_SEL_B0, 0, + B0_DQ2_RG_TX_ARWCK_OE_TIE_EN_B0, 1, + B0_DQ2_RG_TX_ARWCKB_OE_TIE_SEL_B0, 0, + B0_DQ2_RG_TX_ARWCKB_OE_TIE_EN_B0, 1, + B0_DQ2_RG_TX_ARDQM_OE_TIE_SEL_B0, 0, + B0_DQ2_RG_TX_ARDQM_OE_TIE_EN_B0, 1, + B0_DQ2_RG_TX_ARDQ_OE_TIE_SEL_B0, 0, + B0_DQ2_RG_TX_ARDQ_OE_TIE_EN_B0, 0xff); + SET32_BITFIELDS(&ch[chn].phy_ao.dvs_b[1].b0_dq2, + B1_DQ2_RG_TX_ARDQS_OE_TIE_SEL_B1, 0, + B1_DQ2_RG_TX_ARDQS_OE_TIE_EN_B1, 1, + B1_DQ2_RG_TX_ARWCK_OE_TIE_SEL_B1, 0, + B1_DQ2_RG_TX_ARWCK_OE_TIE_EN_B1, 1, + B1_DQ2_RG_TX_ARWCKB_OE_TIE_SEL_B1, 0, + B1_DQ2_RG_TX_ARWCKB_OE_TIE_EN_B1, 1, + B1_DQ2_RG_TX_ARDQM_OE_TIE_SEL_B1, 0, + B1_DQ2_RG_TX_ARDQM_OE_TIE_EN_B1, 1, + B1_DQ2_RG_TX_ARDQ_OE_TIE_SEL_B1, 0, + B1_DQ2_RG_TX_ARDQ_OE_TIE_EN_B1, 0xff); + SET32_BITFIELDS(&ch[chn].phy_ao.ca_cmd2, + CA_CMD2_RG_TX_ARCLK_OE_TIE_SEL_CA, 0, + CA_CMD2_RG_TX_ARCLK_OE_TIE_EN_CA, 1, + CA_CMD2_RG_TX_ARCS_OE_TIE_SEL_CA, 0, + CA_CMD2_RG_TX_ARCS_OE_TIE_EN_CA, 1, + CA_CMD2_RG_TX_ARCA_OE_TIE_SEL_CA, 0, + CA_CMD2_RG_TX_ARCA_OE_TIE_EN_CA, 0xff); + SET32_BITFIELDS(&ch[chn].phy_ao.byte[0].shu_b0_dq13, + SHU_B0_DQ13_RG_TX_ARDQSB_OE_TIE_SEL_B0, 0, + SHU_B0_DQ13_RG_TX_ARDQSB_OE_TIE_EN_B0, 1); + SET32_BITFIELDS(&ch[chn].phy_ao.byte[1].shu_b0_dq13, + SHU_B1_DQ13_RG_TX_ARDQSB_OE_TIE_SEL_B1, 0, + SHU_B1_DQ13_RG_TX_ARDQSB_OE_TIE_EN_B1, 1); + SET32_BITFIELDS(&ch[chn].phy_ao.shu_ca_cmd13, + SHU_CA_CMD13_RG_TX_ARCLKB_OE_TIE_SEL_CA, 0, + SHU_CA_CMD13_RG_TX_ARCLKB_OE_TIE_EN_CA, 1); + } + + ph_dly_back = READ32_BITFIELD(&ch[0].phy_ao.byte[0].shu_b0_dq1, + SHU_B0_DQ1_RG_ARPI_MIDPI_8PH_DLY_B0); + SET32_BITFIELDS(&ch[0].phy_ao.misc_shu_stbcal, + MISC_SHU_STBCAL_STBCALEN, 0x0, + MISC_SHU_STBCAL_STB_SELPHCALEN, 0x0); + SET32_BITFIELDS(&ch[0].phy_ao.byte[0].shu_b0_dq11, + SHU_B0_DQ11_RG_RX_ARDQ_RANK_SEL_SER_EN_B0, 0); + SET32_BITFIELDS(&ch[0].phy_ao.byte[1].shu_b0_dq11, + SHU_B1_DQ11_RG_RX_ARDQ_RANK_SEL_SER_EN_B1, 0); + SET32_BITFIELDS(&ch[0].phy_ao.shu_ca_cmd11, + SHU_CA_CMD11_RG_RX_ARCA_RANK_SEL_SER_EN_CA, 0); + + for (u8 chn = 0; chn < CHANNEL_MAX; chn++) { + SET32_BITFIELDS(&ch[chn].phy_ao.shu_ca_dll1, + SHU_CA_DLL1_RG_ARDLL_PHDET_EN_CA, 0x0, + SHU_CA_DLL1_RG_ARDLL_PHDET_OUT_SEL_CA, 0x0); + SET32_BITFIELDS(&ch[chn].phy_ao.byte[0].shu_b0_dll1, + SHU_B0_DLL1_RG_ARDLL_PHDET_EN_B0, 0x0, + SHU_B0_DLL1_RG_ARDLL_PHDET_OUT_SEL_B0, 0x0); + SET32_BITFIELDS(&ch[chn].phy_ao.byte[1].shu_b0_dll1, + SHU_B1_DLL1_RG_ARDLL_PHDET_EN_B1, 0x0, + SHU_B1_DLL1_RG_ARDLL_PHDET_OUT_SEL_B1, 0x0); + } + SET32_BITFIELDS(&ch[0].phy_ao.misc_ctrl1, MISC_CTRL1_R_DMDQSIENCG_EN, 0); + SET32_BITFIELDS(&ch[0].phy_ao.byte[0].shu_b0_dll_arpi2, + SHU_B0_DLL_ARPI2_RG_ARPI_CG_DQSIEN_B0, 0); + SET32_BITFIELDS(&ch[0].phy_ao.byte[1].shu_b0_dll_arpi2, + SHU_B1_DLL_ARPI2_RG_ARPI_CG_DQSIEN_B1, 0); + SET32_BITFIELDS(&ch[0].phy_ao.misc_dutyscan1, + MISC_DUTYSCAN1_RX_EYE_SCAN_CG_EN, 1); + SET32_BITFIELDS(&ch[0].phy_ao.misc_ctrl4, MISC_CTRL4_R_OPT2_CG_DQSIEN, 0); + SET32_BITFIELDS(&ch[0].phy_ao.misc_stbcal, MISC_STBCAL_DQSIENCG_NORMAL_EN, 0); + SET32_BITFIELDS(&ch[0].phy_ao.dvs_b[0].b0_dq6, + B0_DQ6_RG_RX_ARDQ_EYE_DLY_DQS_BYPASS_B0, 1); + SET32_BITFIELDS(&ch[0].phy_ao.dvs_b[1].b0_dq6, + B1_DQ6_RG_RX_ARDQ_EYE_DLY_DQS_BYPASS_B1, 1); + SET32_BITFIELDS(&ch[0].phy_ao.misc_dutyscan1, MISC_DUTYSCAN1_RX_EYE_SCAN_EN, 1); + SET32_BITFIELDS(&ch[0].phy_ao.misc_dutyscan1, + MISC_DUTYSCAN1_EYESCAN_DQS_SYNC_EN, 0x1, + MISC_DUTYSCAN1_EYESCAN_NEW_DQ_SYNC_EN, 0x1, + MISC_DUTYSCAN1_EYESCAN_DQ_SYNC_EN, 0x1); + SET32_BITFIELDS(&ch[0].phy_ao.dvs_b[0].b0_dq5, B0_DQ5_RG_RX_ARDQ_EYE_EN_B0, 1); + SET32_BITFIELDS(&ch[0].phy_ao.dvs_b[1].b0_dq5, B1_DQ5_RG_RX_ARDQ_EYE_EN_B1, 1); + SET32_BITFIELDS(&ch[0].phy_ao.dvs_b[0].b0_dq5, B0_DQ5_RG_RX_ARDQ_VREF_EN_B0, 1); + SET32_BITFIELDS(&ch[0].phy_ao.dvs_b[1].b0_dq5, B1_DQ5_RG_RX_ARDQ_VREF_EN_B1, 1); + SET32_BITFIELDS(&ch[0].phy_ao.dvs_b[0].b0_dq3, B0_DQ3_RG_RX_ARDQ_SMT_EN_B0, 1); + SET32_BITFIELDS(&ch[0].phy_ao.dvs_b[1].b0_dq3, B1_DQ3_RG_RX_ARDQ_SMT_EN_B1, 1); + SET32_BITFIELDS(&ch[0].phy_ao.dvs_b[0].b0_phy2, B0_PHY2_RG_RX_ARDQS_JM_EN_B0, 1); + SET32_BITFIELDS(&ch[0].phy_ao.dvs_b[1].b0_phy2, B1_PHY2_RG_RX_ARDQS_JM_EN_B1, 1); + SET32_BITFIELDS(&ch[0].phy_ao.misc_jmeter, MISC_JMETER_JMTR_EN, 1); + SET32_BITFIELDS(&ch[0].phy_ao.dvs_b[0].b0_phy2, B0_PHY2_RG_RX_ARDQS_JM_SEL_B0, 1); + SET32_BITFIELDS(&ch[0].phy_ao.dvs_b[1].b0_phy2, B1_PHY2_RG_RX_ARDQS_JM_SEL_B1, 1); + SET32_BITFIELDS(&ch[0].phy_ao.misc_dutyscan1, MISC_DUTYSCAN1_RX_MIOCK_JIT_EN, 1); + SET32_BITFIELDS(&ch[0].phy_ao.misc_dutyscan1, MISC_DUTYSCAN1_RX_EYE_SCAN_EN, 0); + SET32_BITFIELDS(&ch[0].phy_ao.misc_dutyscan1, MISC_DUTYSCAN1_DQSERRCNT_DIS, 0); + + dramc_8_phase_cal_set_best_dly(cali, ph_dly_back); + + for (size_t i = 0; i < ARRAY_SIZE(regs_bak); i++) + write32(regs_bak[i].addr, regs_bak[i].value); +}
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 1:
(8 comments)
https://review.coreboot.org/c/coreboot/+/44709/1/src/soc/mediatek/mt8192/dra... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/1/src/soc/mediatek/mt8192/dra... PS1, Line 318: } else { else is not generally useful after a break or return
https://review.coreboot.org/c/coreboot/+/44709/1/src/soc/mediatek/mt8192/dra... PS1, Line 325: if (r_tmp > p_tmp) Too many leading tabs - consider code refactoring
https://review.coreboot.org/c/coreboot/+/44709/1/src/soc/mediatek/mt8192/dra... PS1, Line 327: else Too many leading tabs - consider code refactoring
https://review.coreboot.org/c/coreboot/+/44709/1/src/soc/mediatek/mt8192/dra... PS1, Line 330: if (err_code == 0) { Too many leading tabs - consider code refactoring
https://review.coreboot.org/c/coreboot/+/44709/1/src/soc/mediatek/mt8192/dra... PS1, Line 333: } else if (err_code < err_code_min) { Too many leading tabs - consider code refactoring
https://review.coreboot.org/c/coreboot/+/44709/1/src/soc/mediatek/mt8192/dra... PS1, Line 337: } else if (err_code >= err_code_min) { Too many leading tabs - consider code refactoring
https://review.coreboot.org/c/coreboot/+/44709/1/src/soc/mediatek/mt8192/dra... PS1, Line 339: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
https://review.coreboot.org/c/coreboot/+/44709/1/src/soc/mediatek/mt8192/dra... PS1, Line 346: } else { else is not generally useful after a break or return
Hello build bot (Jenkins), Julius Werner, Duan huayang,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/44709
to look at the new patch set (#2).
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
soc/mediatek/mt8192: Add dramc 8 phase calibration
Signed-off-by: Huayang Duan huayang.duan@mediatek.com Change-Id: Ib4ccaa8d43b8382cbc64cf82de86ad1ac16cb89a --- M src/soc/mediatek/mt8192/dramc_pi_basic_api.c M src/soc/mediatek/mt8192/dramc_pi_calibration_api.c 2 files changed, 344 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/09/44709/2
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 2:
(6 comments)
https://review.coreboot.org/c/coreboot/+/44709/2/src/soc/mediatek/mt8192/dra... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/2/src/soc/mediatek/mt8192/dra... PS2, Line 325: if (r_tmp > p_tmp) Too many leading tabs - consider code refactoring
https://review.coreboot.org/c/coreboot/+/44709/2/src/soc/mediatek/mt8192/dra... PS2, Line 327: else Too many leading tabs - consider code refactoring
https://review.coreboot.org/c/coreboot/+/44709/2/src/soc/mediatek/mt8192/dra... PS2, Line 330: if (err_code == 0) { Too many leading tabs - consider code refactoring
https://review.coreboot.org/c/coreboot/+/44709/2/src/soc/mediatek/mt8192/dra... PS2, Line 333: } else if (err_code < err_code_min) { Too many leading tabs - consider code refactoring
https://review.coreboot.org/c/coreboot/+/44709/2/src/soc/mediatek/mt8192/dra... PS2, Line 337: } else if (err_code >= err_code_min) { Too many leading tabs - consider code refactoring
https://review.coreboot.org/c/coreboot/+/44709/2/src/soc/mediatek/mt8192/dra... PS2, Line 339: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
Yidi Lin has uploaded a new patch set (#3) to the change originally created by CK HU. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
soc/mediatek/mt8192: Add dramc 8 phase calibration
Signed-off-by: Huayang Duan huayang.duan@mediatek.com Change-Id: Ib4ccaa8d43b8382cbc64cf82de86ad1ac16cb89a --- M src/soc/mediatek/mt8192/dramc_pi_basic_api.c M src/soc/mediatek/mt8192/dramc_pi_calibration_api.c 2 files changed, 341 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/09/44709/3
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/3/src/soc/mediatek/mt8192/dra... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/3/src/soc/mediatek/mt8192/dra... PS3, Line 331: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 4:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/4/src/soc/mediatek/mt8192/dra... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/4/src/soc/mediatek/mt8192/dra... PS4, Line 331: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 5:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/5/src/soc/mediatek/mt8192/dra... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/5/src/soc/mediatek/mt8192/dra... PS5, Line 331: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 6:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/6/src/soc/mediatek/mt8192/dra... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/6/src/soc/mediatek/mt8192/dra... PS6, Line 331: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 6:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/6//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/44709/6//COMMIT_MSG@8 PS6, Line 8: Please elaborate.
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 7:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/7/src/soc/mediatek/mt8192/dra... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/7/src/soc/mediatek/mt8192/dra... PS7, Line 331: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 8:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/8/src/soc/mediatek/mt8192/dra... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/8/src/soc/mediatek/mt8192/dra... PS8, Line 331: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 9:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/9/src/soc/mediatek/mt8192/dra... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/9/src/soc/mediatek/mt8192/dra... PS9, Line 331: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 10:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/10/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/10/src/soc/mediatek/mt8192/dr... PS10, Line 331: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 11:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/11/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/11/src/soc/mediatek/mt8192/dr... PS11, Line 331: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 12:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/12/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/12/src/soc/mediatek/mt8192/dr... PS12, Line 331: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 14:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/14/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/14/src/soc/mediatek/mt8192/dr... PS14, Line 331: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 15:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/15/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/15/src/soc/mediatek/mt8192/dr... PS15, Line 331: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 16:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/16/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/16/src/soc/mediatek/mt8192/dr... PS16, Line 331: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 17:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/17/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/17/src/soc/mediatek/mt8192/dr... PS17, Line 331: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 18:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/18/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/18/src/soc/mediatek/mt8192/dr... PS18, Line 331: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 19:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/19/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/19/src/soc/mediatek/mt8192/dr... PS19, Line 331: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 20:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/20/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/20/src/soc/mediatek/mt8192/dr... PS20, Line 331: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 21:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/21/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/21/src/soc/mediatek/mt8192/dr... PS21, Line 331: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 22:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/22/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/22/src/soc/mediatek/mt8192/dr... PS22, Line 331: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
Yidi Lin has uploaded a new patch set (#24) to the change originally created by CK HU. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
soc/mediatek/mt8192: Add dramc 8 phase calibration
Signed-off-by: Huayang Duan huayang.duan@mediatek.com Change-Id: Ib4ccaa8d43b8382cbc64cf82de86ad1ac16cb89a --- M src/soc/mediatek/mt8192/dramc_pi_basic_api.c M src/soc/mediatek/mt8192/dramc_pi_calibration_api.c 2 files changed, 341 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/09/44709/24
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 24:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/24/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/24/src/soc/mediatek/mt8192/dr... PS24, Line 331: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 27:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/27/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/27/src/soc/mediatek/mt8192/dr... PS27, Line 331: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 28:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/28/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/28/src/soc/mediatek/mt8192/dr... PS28, Line 331: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 30:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/30/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/30/src/soc/mediatek/mt8192/dr... PS30, Line 331: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 31:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/31/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/31/src/soc/mediatek/mt8192/dr... PS31, Line 331: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 32:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/32/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/32/src/soc/mediatek/mt8192/dr... PS32, Line 331: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
Yidi Lin has uploaded a new patch set (#34) to the change originally created by CK HU. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
soc/mediatek/mt8192: Add dramc 8 phase calibration
Signed-off-by: Huayang Duan huayang.duan@mediatek.com Change-Id: Ib4ccaa8d43b8382cbc64cf82de86ad1ac16cb89a --- M src/soc/mediatek/mt8192/dramc_pi_basic_api.c M src/soc/mediatek/mt8192/dramc_pi_calibration_api.c 2 files changed, 341 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/09/44709/34
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 34:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/34/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/34/src/soc/mediatek/mt8192/dr... PS34, Line 331: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
Yidi Lin has uploaded a new patch set (#36) to the change originally created by CK HU. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
soc/mediatek/mt8192: Add dramc 8 phase calibration
Signed-off-by: Huayang Duan huayang.duan@mediatek.com Change-Id: Ib4ccaa8d43b8382cbc64cf82de86ad1ac16cb89a --- M src/soc/mediatek/mt8192/dramc_pi_basic_api.c M src/soc/mediatek/mt8192/dramc_pi_calibration_api.c 2 files changed, 341 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/09/44709/36
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 36:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/36/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/36/src/soc/mediatek/mt8192/dr... PS36, Line 331: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 37:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/37/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/37/src/soc/mediatek/mt8192/dr... PS37, Line 331: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 38:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/38/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/38/src/soc/mediatek/mt8192/dr... PS38, Line 331: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 39:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/39/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/39/src/soc/mediatek/mt8192/dr... PS39, Line 329: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 39: Code-Review+1
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 40:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/40/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/40/src/soc/mediatek/mt8192/dr... PS40, Line 329: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
Yidi Lin has uploaded a new patch set (#42) to the change originally created by CK HU. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
soc/mediatek/mt8192: Add dramc 8 phase calibration
Signed-off-by: Huayang Duan huayang.duan@mediatek.com Change-Id: Ib4ccaa8d43b8382cbc64cf82de86ad1ac16cb89a --- M src/soc/mediatek/mt8192/dramc_pi_basic_api.c M src/soc/mediatek/mt8192/dramc_pi_calibration_api.c 2 files changed, 341 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/09/44709/42
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 42:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/42/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/42/src/soc/mediatek/mt8192/dr... PS42, Line 329: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 43:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 329: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 43:
(21 comments)
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 252: u8 *dqs_level Since the calculated value of dqs_level isn't used in dramc_8_phase_cal_set_best_dly(), we can declare this as a local variable inside this function:
u8 dqs_level = 0xff;
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 254: u8 early_break_cnt = 5; const
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 257: static s16 err_code = 0x7fff, err_code_min = 0x7fff; No need to make them static.
u16 err_code; const u16 err_code_min = 0x7fff;
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 258: u16 dqs_dly = 0, jm_dly_start = 0, jm_dly_end = 512, jm_dly_step = 1; No need to initialize dqs_dly. Add 'const' modifier for the other 3 variables.
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 259: ones_cnt[DQS_NUMBER] ones_cnt[1] is never used.
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 286: MISC_DUTY_TOGGLE_CNT_TOGGLE_CNT Please align with "&ch[0]". Same below.
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 290: ( No need for parentheses.
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 313: = One space after "="
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 315: if (r_tmp > p_tmp) : err_code = r_tmp - p_tmp; : else : err_code = p_tmp - r_tmp; err_code = ABS(p_tmp - r_tmp);
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 345: ( No need for parentheses.
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 347: is fail (to Default)! failed; falling back to default
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 349: ) Add {}
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 357: u8 dqsien_pi = 0; No need to initialize it.
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 358: ph_dly = 0, ph_start = 0, ph_end = 0 Also no need to initialize these.
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 358: = 0xff Since ph_dly_final is an output argument of dramc_8_phase_cal_find_best_dly(), there's no need for initialization.
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 359: = 0 Same. Since this is an output argument, no need to initialize it.
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 379: dramc_dbg("phase_sm err!\n"); Since this indicates a serious bug in this code block, I'd prefer
die("Invalid phase_sm: %u\n", phase_sm); return;
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 383: d u. Same for the others.
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 391: dqs_level Should we declare this *inside* the for loop of ph_dly or *outside*?
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 397: ph_dly_loop_break Since it's used as a boolean, declare it as 'int' or 'bool'. Then, we may write
if (ph_dly_loop_break)
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 403: d u
Xi Chen has uploaded a new patch set (#44) to the change originally created by CK HU. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
soc/mediatek/mt8192: Add dramc 8 phase calibration
Signed-off-by: Huayang Duan huayang.duan@mediatek.com Change-Id: Ib4ccaa8d43b8382cbc64cf82de86ad1ac16cb89a --- M src/soc/mediatek/mt8192/dramc_pi_basic_api.c M src/soc/mediatek/mt8192/dramc_pi_calibration_api.c 2 files changed, 341 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/09/44709/44
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 44:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/44/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/44/src/soc/mediatek/mt8192/dr... PS44, Line 328: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
Xi Chen has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 44:
(12 comments)
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 252: u8 *dqs_level
Since the calculated value of dqs_level isn't used in dramc_8_phase_cal_set_best_dly(), we can decla […]
Yes, you are very right! Use local variable instead of a pointer.
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 254: u8 early_break_cnt = 5;
const
Ack
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 257: static s16 err_code = 0x7fff, err_code_min = 0x7fff;
No need to make them static. […]
"err_code" remove static modifier, "err_code_min" is resued at line:323, so keep static modifier.
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 258: u16 dqs_dly = 0, jm_dly_start = 0, jm_dly_end = 512, jm_dly_step = 1;
No need to initialize dqs_dly. Add 'const' modifier for the other 3 variables.
Ack
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 259: ones_cnt[DQS_NUMBER]
ones_cnt[1] is never used.
Right! use int instead of int array.
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 286: MISC_DUTY_TOGGLE_CNT_TOGGLE_CNT
Please align with "&ch[0]". Same below.
Ack
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 290: (
No need for parentheses.
Ack
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 313: =
One space after "="
Ack
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 315: if (r_tmp > p_tmp) : err_code = r_tmp - p_tmp; : else : err_code = p_tmp - r_tmp;
err_code = ABS(p_tmp - r_tmp);
Ack
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 345: (
No need for parentheses.
Ack
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 347: is fail (to Default)!
failed; falling back to default
Ack
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 349: )
Add {}
Ack
Xi Chen has uploaded a new patch set (#45) to the change originally created by CK HU. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
soc/mediatek/mt8192: Add dramc 8 phase calibration
Signed-off-by: Huayang Duan huayang.duan@mediatek.com Change-Id: Ib4ccaa8d43b8382cbc64cf82de86ad1ac16cb89a --- M src/soc/mediatek/mt8192/dramc_pi_basic_api.c M src/soc/mediatek/mt8192/dramc_pi_calibration_api.c 2 files changed, 341 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/09/44709/45
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 45:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/45/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/45/src/soc/mediatek/mt8192/dr... PS45, Line 328: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
Xi Chen has uploaded a new patch set (#46) to the change originally created by CK HU. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
soc/mediatek/mt8192: Add dramc 8 phase calibration
Signed-off-by: Huayang Duan huayang.duan@mediatek.com Change-Id: Ib4ccaa8d43b8382cbc64cf82de86ad1ac16cb89a --- M src/soc/mediatek/mt8192/dramc_pi_basic_api.c M src/soc/mediatek/mt8192/dramc_pi_calibration_api.c 2 files changed, 350 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/09/44709/46
Xi Chen has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 46:
(9 comments)
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 357: u8 dqsien_pi = 0;
No need to initialize it.
Ack
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 358: ph_dly = 0, ph_start = 0, ph_end = 0
Also no need to initialize these.
Ack
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 358: = 0xff
Since ph_dly_final is an output argument of dramc_8_phase_cal_find_best_dly(), there's no need for i […]
If ph_dly_final isn't initialized, the compile will tip may-be-uninitialized if not call "dramc_8_phase_cal_find_best_dly", so keep the default value.
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 359: = 0
Same. Since this is an output argument, no need to initialize it.
Yes, it's an output argument, but dramc_8_phase_cal_find_best_dly(..., &ph_dly_loop_break) may not set it, so, the output argument may be undecided. Move the initialization code in dramc_8_phase_cal_find_best_dly?
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 379: dramc_dbg("phase_sm err!\n");
Since this indicates a serious bug in this code block, I'd prefer […]
Ack
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 383: d
u. Same for the others.
Ack
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 391: dqs_level
Should we declare this *inside* the for loop of ph_dly or *outside*?
move inside the function dramc_8_phase_cal_find_best_dly.
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 397: ph_dly_loop_break
Since it's used as a boolean, declare it as 'int' or 'bool'. Then, we may write […]
Ack
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 403: d
u
Ack
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 46:
(2 comments)
https://review.coreboot.org/c/coreboot/+/44709/46/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/46/src/soc/mediatek/mt8192/dr... PS46, Line 330: if (loop_cnt > early_break_cnt) Too many leading tabs - consider code refactoring
https://review.coreboot.org/c/coreboot/+/44709/46/src/soc/mediatek/mt8192/dr... PS46, Line 402: trailing whitespace
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 46:
(14 comments)
https://review.coreboot.org/c/coreboot/+/44709/6//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/44709/6//COMMIT_MSG@8 PS6, Line 8:
Please elaborate.
Moved to PS46.
https://review.coreboot.org/c/coreboot/+/44709/46//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/44709/46//COMMIT_MSG@8 PS46, Line 8: From Paul's comment: Please elaborate.
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 252: u8 *dqs_level
Yes, you are very right! Use local variable instead of a pointer.
Done
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 259: ones_cnt[DQS_NUMBER]
Right! use int instead of int array.
Done
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 358: = 0xff
If ph_dly_final isn't initialized, the compile will tip may-be-uninitialized if not call "dramc_8_ph […]
Similar to ph_dly_loop_break, I'd prefer doing initialization within dramc_8_phase_cal_find_best_dly(). I think the warning should disappear.
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 359: = 0
Yes, it's an output argument, but dramc_8_phase_cal_find_best_dly(... […]
Yes, that's what I mean.
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 391: dqs_level
move inside the function dramc_8_phase_cal_find_best_dly.
Ack
https://review.coreboot.org/c/coreboot/+/44709/46/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/46/src/soc/mediatek/mt8192/dr... PS46, Line 257: static static const
https://review.coreboot.org/c/coreboot/+/44709/46/src/soc/mediatek/mt8192/dr... PS46, Line 261: 0xff Since it's used multiple times, please define a macro for this. Maybe
#define DQS_LEVEL_UNKNOWN 0xff
https://review.coreboot.org/c/coreboot/+/44709/46/src/soc/mediatek/mt8192/dr... PS46, Line 263: d u
Same for *all* below.
https://review.coreboot.org/c/coreboot/+/44709/46/src/soc/mediatek/mt8192/dr... PS46, Line 328: else if (err_code >= err_code_min) Just "else"
https://review.coreboot.org/c/coreboot/+/44709/46/src/soc/mediatek/mt8192/dr... PS46, Line 331: 1 Does this mean success or failure?
https://review.coreboot.org/c/coreboot/+/44709/46/src/soc/mediatek/mt8192/dr... PS46, Line 341: dramc_dbg("phase_sm err!\n"); Since this is theoretically impossible to happen, how about
die("Invalid phase_sm: %u!\n", phase_sm);
https://review.coreboot.org/c/coreboot/+/44709/46/src/soc/mediatek/mt8192/dr... PS46, Line 402:
trailing whitespace
Please fix this.
Xi Chen has uploaded a new patch set (#47) to the change originally created by CK HU. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
soc/mediatek/mt8192: Add dramc 8 phase calibration
To get better PI linearity, 8 phase calibration do MCK 0/180/45 training, select the best PI settings.
Signed-off-by: Huayang Duan huayang.duan@mediatek.com Change-Id: Ib4ccaa8d43b8382cbc64cf82de86ad1ac16cb89a --- M src/soc/mediatek/mt8192/dramc_pi_basic_api.c M src/soc/mediatek/mt8192/dramc_pi_calibration_api.c M src/soc/mediatek/mt8192/include/soc/dramc_pi_api.h 3 files changed, 355 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/09/44709/47
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 47:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/47/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/47/src/soc/mediatek/mt8192/dr... PS47, Line 341: } else { else is not generally useful after a break or return
Xi Chen has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 47:
(9 comments)
https://review.coreboot.org/c/coreboot/+/44709/45/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/45/src/soc/mediatek/mt8192/dr... PS45, Line 328: if (loop_cnt > early_break_cnt)
Too many leading tabs - consider code refactoring
done
https://review.coreboot.org/c/coreboot/+/44709/46/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/46/src/soc/mediatek/mt8192/dr... PS46, Line 257: static
static const
err_code_min may be assigned to a new value, so only use static modifier.
https://review.coreboot.org/c/coreboot/+/44709/46/src/soc/mediatek/mt8192/dr... PS46, Line 261: 0xff
Since it's used multiple times, please define a macro for this. Maybe […]
Ack
https://review.coreboot.org/c/coreboot/+/44709/46/src/soc/mediatek/mt8192/dr... PS46, Line 263: d
u […]
Ack
https://review.coreboot.org/c/coreboot/+/44709/46/src/soc/mediatek/mt8192/dr... PS46, Line 328: else if (err_code >= err_code_min)
Just "else"
Ack
https://review.coreboot.org/c/coreboot/+/44709/46/src/soc/mediatek/mt8192/dr... PS46, Line 330: if (loop_cnt > early_break_cnt)
Too many leading tabs - consider code refactoring
done
https://review.coreboot.org/c/coreboot/+/44709/46/src/soc/mediatek/mt8192/dr... PS46, Line 331: 1
Does this mean success or failure?
Means exit the 8 phase detect loop or not.
https://review.coreboot.org/c/coreboot/+/44709/46/src/soc/mediatek/mt8192/dr... PS46, Line 341: dramc_dbg("phase_sm err!\n");
Since this is theoretically impossible to happen, how about […]
Ack
https://review.coreboot.org/c/coreboot/+/44709/46/src/soc/mediatek/mt8192/dr... PS46, Line 402:
trailing whitespace
Done
Xi Chen has uploaded a new patch set (#48) to the change originally created by CK HU. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
soc/mediatek/mt8192: Add dramc 8 phase calibration
To get better PI linearity, 8 phase calibration do MCK 0/180/45 training, select the best PI settings.
Signed-off-by: Huayang Duan huayang.duan@mediatek.com Change-Id: Ib4ccaa8d43b8382cbc64cf82de86ad1ac16cb89a --- M src/soc/mediatek/mt8192/dramc_pi_basic_api.c M src/soc/mediatek/mt8192/dramc_pi_calibration_api.c M src/soc/mediatek/mt8192/include/soc/dramc_pi_api.h 3 files changed, 355 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/09/44709/48
Xi Chen has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 48:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/47/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/47/src/soc/mediatek/mt8192/dr... PS47, Line 341: } else {
else is not generally useful after a break or return
i think we can ignore the tip?
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 48:
(5 comments)
Final 2 nits
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/43/src/soc/mediatek/mt8192/dr... PS43, Line 358: = 0xff
Similar to ph_dly_loop_break, I'd prefer doing initialization within dramc_8_phase_cal_find_best_dly […]
Done
https://review.coreboot.org/c/coreboot/+/44709/46/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/46/src/soc/mediatek/mt8192/dr... PS46, Line 257: static
err_code_min may be assigned to a new value, so only use static modifier.
Ack. Sorry, I must have missed that.
https://review.coreboot.org/c/coreboot/+/44709/46/src/soc/mediatek/mt8192/dr... PS46, Line 331: 1
Means exit the 8 phase detect loop or not.
Ack
https://review.coreboot.org/c/coreboot/+/44709/48/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/48/src/soc/mediatek/mt8192/dr... PS48, Line 349: d u
https://review.coreboot.org/c/coreboot/+/44709/48/src/soc/mediatek/mt8192/in... File src/soc/mediatek/mt8192/include/soc/dramc_pi_api.h:
https://review.coreboot.org/c/coreboot/+/44709/48/src/soc/mediatek/mt8192/in... PS48, Line 37: define One space (not tab) after "define"
Xi Chen has uploaded a new patch set (#49) to the change originally created by CK HU. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
soc/mediatek/mt8192: Add dramc 8 phase calibration
To get better PI linearity, 8 phase calibration do MCK 0/180/45 training, select the best PI settings.
Signed-off-by: Huayang Duan huayang.duan@mediatek.com Change-Id: Ib4ccaa8d43b8382cbc64cf82de86ad1ac16cb89a --- M src/soc/mediatek/mt8192/dramc_pi_basic_api.c M src/soc/mediatek/mt8192/dramc_pi_calibration_api.c M src/soc/mediatek/mt8192/include/soc/dramc_pi_api.h 3 files changed, 355 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/09/44709/49
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 49:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/49/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/49/src/soc/mediatek/mt8192/dr... PS49, Line 341: } else { else is not generally useful after a break or return
Xi Chen has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 49:
(2 comments)
https://review.coreboot.org/c/coreboot/+/44709/48/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/48/src/soc/mediatek/mt8192/dr... PS48, Line 349: d
u
Ack
https://review.coreboot.org/c/coreboot/+/44709/48/src/soc/mediatek/mt8192/in... File src/soc/mediatek/mt8192/include/soc/dramc_pi_api.h:
https://review.coreboot.org/c/coreboot/+/44709/48/src/soc/mediatek/mt8192/in... PS48, Line 37: define
One space (not tab) after "define"
Ack
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 49:
(3 comments)
https://review.coreboot.org/c/coreboot/+/44709/49//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/44709/49//COMMIT_MSG@9 PS49, Line 9: 8 phase calibration do MCK 0/180/45 : training, select the best PI settings Does the following make sense?
perform 8 phase calibration to do MCK 0/180/45 training and select the best PI settings.
https://review.coreboot.org/c/coreboot/+/44709/49/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/49/src/soc/mediatek/mt8192/dr... PS49, Line 308: if (r180 > r0) { : r_tmp = r0 + ((r180 - r0) >> 2); : dramc_dbg("R = %u, R180 = %u\n", r_tmp, r180); : break; : } How about we imitate the DQS_8PH_DEGREE_45 case:
if (r180 <= r0) { dqs_level = DQS_LEVEL_UNKNOWN; continue; }
r_tmp = r0 + ((r180 - r0) >> 2); dramc_dbg("R = %u, R180 = %u\n", r_tmp, r180);
and then we can move the 3 'break's outside the if-else block of phase_sm.
https://review.coreboot.org/c/coreboot/+/44709/49/src/soc/mediatek/mt8192/dr... PS49, Line 341: } else {
else is not generally useful after a break or return
Please see the above comment.
Xi Chen has uploaded a new patch set (#50) to the change originally created by CK HU. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
soc/mediatek/mt8192: Add dramc 8 phase calibration
To get better PI linearity, perform 8 phase calibration to do MCK 0/180/45 training and select the best PI settings.
Signed-off-by: Huayang Duan huayang.duan@mediatek.com Change-Id: Ib4ccaa8d43b8382cbc64cf82de86ad1ac16cb89a --- M src/soc/mediatek/mt8192/dramc_pi_basic_api.c M src/soc/mediatek/mt8192/dramc_pi_calibration_api.c M src/soc/mediatek/mt8192/include/soc/dramc_pi_api.h 3 files changed, 356 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/09/44709/50
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 50:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/50/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/50/src/soc/mediatek/mt8192/dr... PS50, Line 342: } else { else is not generally useful after a break or return
Xi Chen has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 50:
(3 comments)
https://review.coreboot.org/c/coreboot/+/44709/49//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/44709/49//COMMIT_MSG@9 PS49, Line 9: 8 phase calibration do MCK 0/180/45 : training, select the best PI settings
Does the following make sense? […]
Ack
https://review.coreboot.org/c/coreboot/+/44709/49/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/49/src/soc/mediatek/mt8192/dr... PS49, Line 308: if (r180 > r0) { : r_tmp = r0 + ((r180 - r0) >> 2); : dramc_dbg("R = %u, R180 = %u\n", r_tmp, r180); : break; : }
How about we imitate the DQS_8PH_DEGREE_45 case: […]
Done
https://review.coreboot.org/c/coreboot/+/44709/49/src/soc/mediatek/mt8192/dr... PS49, Line 341: } else {
Please see the above comment.
"break" will follow by a "else"?
Xi Chen has uploaded a new patch set (#51) to the change originally created by CK HU. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
soc/mediatek/mt8192: Add dramc 8 phase calibration
To get better PI linearity, perform 8 phase calibration to do MCK 0/180/45 training and select the best PI settings.
Signed-off-by: Huayang Duan huayang.duan@mediatek.com Change-Id: Ib4ccaa8d43b8382cbc64cf82de86ad1ac16cb89a --- M src/soc/mediatek/mt8192/dramc_pi_basic_api.c M src/soc/mediatek/mt8192/dramc_pi_calibration_api.c M src/soc/mediatek/mt8192/include/soc/dramc_pi_api.h 3 files changed, 356 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/09/44709/51
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 51:
(2 comments)
https://review.coreboot.org/c/coreboot/+/44709/49/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/49/src/soc/mediatek/mt8192/dr... PS49, Line 308: if (r180 > r0) { : r_tmp = r0 + ((r180 - r0) >> 2); : dramc_dbg("R = %u, R180 = %u\n", r_tmp, r180); : break; : }
Done
Ack
https://review.coreboot.org/c/coreboot/+/44709/49/src/soc/mediatek/mt8192/dr... PS49, Line 341: } else {
"break" will follow by a "else"?
Yes.
if (phase_sm == DQS_8PH_DEGREE_0) { // No break here } else if (...) { // No break here } else { die(...); } break;
Xi Chen has uploaded a new patch set (#52) to the change originally created by CK HU. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
soc/mediatek/mt8192: Add dramc 8 phase calibration
To get better PI linearity, perform 8 phase calibration to do MCK 0/180/45 training and select the best PI settings.
Signed-off-by: Huayang Duan huayang.duan@mediatek.com Change-Id: Ib4ccaa8d43b8382cbc64cf82de86ad1ac16cb89a --- M src/soc/mediatek/mt8192/dramc_pi_basic_api.c M src/soc/mediatek/mt8192/dramc_pi_calibration_api.c M src/soc/mediatek/mt8192/include/soc/dramc_pi_api.h 3 files changed, 355 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/09/44709/52
Xi Chen has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 52:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/49/src/soc/mediatek/mt8192/dr... File src/soc/mediatek/mt8192/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/44709/49/src/soc/mediatek/mt8192/dr... PS49, Line 341: } else {
Yes. […]
Ack
Xi Chen has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 52:
(1 comment)
https://review.coreboot.org/c/coreboot/+/44709/46//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/44709/46//COMMIT_MSG@8 PS46, Line 8:
From Paul's comment: Please elaborate.
Done
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
Patch Set 52: Code-Review+2
Hung-Te Lin has submitted this change. ( https://review.coreboot.org/c/coreboot/+/44709 )
Change subject: soc/mediatek/mt8192: Add dramc 8 phase calibration ......................................................................
soc/mediatek/mt8192: Add dramc 8 phase calibration
To get better PI linearity, perform 8 phase calibration to do MCK 0/180/45 training and select the best PI settings.
Signed-off-by: Huayang Duan huayang.duan@mediatek.com Change-Id: Ib4ccaa8d43b8382cbc64cf82de86ad1ac16cb89a Reviewed-on: https://review.coreboot.org/c/coreboot/+/44709 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Yu-Ping Wu yupingso@google.com --- M src/soc/mediatek/mt8192/dramc_pi_basic_api.c M src/soc/mediatek/mt8192/dramc_pi_calibration_api.c M src/soc/mediatek/mt8192/include/soc/dramc_pi_api.h 3 files changed, 355 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Yu-Ping Wu: Looks good to me, approved
diff --git a/src/soc/mediatek/mt8192/dramc_pi_basic_api.c b/src/soc/mediatek/mt8192/dramc_pi_basic_api.c index 37aa055..24f9620 100644 --- a/src/soc/mediatek/mt8192/dramc_pi_basic_api.c +++ b/src/soc/mediatek/mt8192/dramc_pi_basic_api.c @@ -3790,6 +3790,7 @@ { dramc_setting(cali); dramc_reset_delay_chain_before_calibration(); + dramc_8_phase_cal(cali); }
static void dramc_before_calibration(const struct ddr_cali *cali) diff --git a/src/soc/mediatek/mt8192/dramc_pi_calibration_api.c b/src/soc/mediatek/mt8192/dramc_pi_calibration_api.c index c633224..19a964a 100644 --- a/src/soc/mediatek/mt8192/dramc_pi_calibration_api.c +++ b/src/soc/mediatek/mt8192/dramc_pi_calibration_api.c @@ -225,3 +225,355 @@
dramc_set_broadcast(bc_bak); } + +static void dramc_phy_reset(u8 chn) +{ + SET32_BITFIELDS(&ch[chn].ao.rx_set0, RX_SET0_RDATRST, 1); + SET32_BITFIELDS(&ch[chn].phy_ao.misc_ctrl1, MISC_CTRL1_R_DMPHYRST, 1); + SET32_BITFIELDS(&ch[chn].phy_ao.dvs_b[0].b0_dq9, + B0_DQ9_RG_RX_ARDQS0_STBEN_RESETB_B0, 0, + B0_DQ9_RG_RX_ARDQ_STBEN_RESETB_B0, 0); + SET32_BITFIELDS(&ch[chn].phy_ao.dvs_b[1].b0_dq9, + B1_DQ9_RG_RX_ARDQS0_STBEN_RESETB_B1, 0, + B1_DQ9_RG_RX_ARDQ_STBEN_RESETB_B1, 0); + udelay(1); + SET32_BITFIELDS(&ch[chn].phy_ao.dvs_b[1].b0_dq9, + B1_DQ9_RG_RX_ARDQS0_STBEN_RESETB_B1, 1, + B1_DQ9_RG_RX_ARDQ_STBEN_RESETB_B1, 1); + SET32_BITFIELDS(&ch[chn].phy_ao.dvs_b[0].b0_dq9, + B0_DQ9_RG_RX_ARDQS0_STBEN_RESETB_B0, 1, + B0_DQ9_RG_RX_ARDQ_STBEN_RESETB_B0, 1); + SET32_BITFIELDS(&ch[chn].phy_ao.misc_ctrl1, MISC_CTRL1_R_DMPHYRST, 0); + SET32_BITFIELDS(&ch[chn].ao.rx_set0, RX_SET0_RDATRST, 0); +} + +static int dramc_8_phase_cal_find_best_dly(u8 phase_sm, u8 ph_dly, u8 ph_dly_back, + int *ph_dly_final, int *ph_dly_loop_break) +{ + const u8 early_break_cnt = 5; + static u8 loop_cnt = 0; + static u16 r0 = 0xffff, r180 = 0xffff, r_tmp = 0xffff, p_tmp = 0xffff; + s16 err_code; + static s16 err_code_min = 0x7fff; + u16 dqs_dly; + const u16 jm_dly_start = 0, jm_dly_end = 512, jm_dly_step = 1; + u32 sample_cnt, ones_cnt; + u8 dqs_level = DQS_LEVEL_UNKNOWN; + + dramc_dbg("8PH dly = %u\n", ph_dly); + *ph_dly_loop_break = 0; + + SET32_BITFIELDS(&ch[0].phy_ao.byte[0].shu_b0_dq1, + SHU_B0_DQ1_RG_ARPI_MIDPI_8PH_DLY_B0, ph_dly); + SET32_BITFIELDS(&ch[0].phy_ao.byte[1].shu_b0_dq1, + SHU_B1_DQ1_RG_ARPI_MIDPI_8PH_DLY_B1, ph_dly); + SET32_BITFIELDS(&ch[0].phy_ao.shu_ca_cmd1, + SHU_CA_CMD1_RG_ARPI_MIDPI_8PH_DLY_CA, ph_dly); + + for (dqs_dly = jm_dly_start; dqs_dly < jm_dly_end; dqs_dly += jm_dly_step) { + /* Set DQS delay */ + SET32_BITFIELDS(&ch[0].phy_ao.dvs_b[0].b0_phy2, + B0_PHY2_RG_RX_ARDQS_JM_DLY_B0, dqs_dly); + SET32_BITFIELDS(&ch[0].phy_ao.dvs_b[1].b0_phy2, + B1_PHY2_RG_RX_ARDQS_JM_DLY_B1, dqs_dly); + dramc_phy_reset(0); + SET32_BITFIELDS(&ch[0].phy_ao.misc_dutyscan1, + MISC_DUTYSCAN1_REG_SW_RST, 1); + SET32_BITFIELDS(&ch[0].phy_ao.misc_dutyscan1, + MISC_DUTYSCAN1_REG_SW_RST, 0); + SET32_BITFIELDS(&ch[0].phy_ao.misc_dutyscan1, + MISC_DUTYSCAN1_RX_EYE_SCAN_EN, 1); + udelay(10); + SET32_BITFIELDS(&ch[0].phy_ao.misc_dutyscan1, + MISC_DUTYSCAN1_RX_EYE_SCAN_EN, 0); + sample_cnt = READ32_BITFIELD(&ch[0].phy_nao.misc_duty_toggle_cnt, + MISC_DUTY_TOGGLE_CNT_TOGGLE_CNT); + ones_cnt = READ32_BITFIELD(&ch[0].phy_nao.misc_duty_dqs0_err_cnt, + MISC_DUTY_DQS0_ERR_CNT_DQS0_ERR_CNT); + + if (ones_cnt < sample_cnt / 2) { + if (dqs_level == DQS_LEVEL_UNKNOWN) + dramc_dbg("[L] %u, %8u\n", dqs_dly, ones_cnt); + dqs_level = 0; + } else if (dqs_level == 0) { + dqs_level = 1; + dramc_dbg("[H] %u, %8u\n", dqs_dly, ones_cnt); + + if (phase_sm == DQS_8PH_DEGREE_0) { + r0 = dqs_dly; + dramc_dbg("R0 = %u\n", r0); + } else if (phase_sm == DQS_8PH_DEGREE_180) { + r180 = dqs_dly; + if (r180 <= r0) { + dqs_level = DQS_LEVEL_UNKNOWN; + continue; + } + + r_tmp = r0 + ((r180 - r0) >> 2); + dramc_dbg("R = %u, R180 = %u\n", r_tmp, r180); + } else if (phase_sm == DQS_8PH_DEGREE_45) { + p_tmp = dqs_dly; + dramc_dbg("p_tmp = %u, R0 = %u\n", p_tmp, r0); + if (p_tmp <= r0) { + dqs_level = DQS_LEVEL_UNKNOWN; + continue; + } + + err_code = ABS(p_tmp - r_tmp); + + if (err_code == 0) { + *ph_dly_final = ph_dly; + *ph_dly_loop_break = 1; + } else if (err_code < err_code_min) { + err_code_min = err_code; + *ph_dly_final = ph_dly; + loop_cnt = 0; + } else { + loop_cnt++; + if (loop_cnt > early_break_cnt) + *ph_dly_loop_break = 1; + } + + dramc_dbg("diff (P-R) = %d, min = %d, break count = %u\n", + err_code, err_code_min, loop_cnt); + } else { + die("Invalid phase_sm: %u!\n", phase_sm); + } + + break; + } + } + + if (dqs_level == DQS_LEVEL_UNKNOWN || dqs_level == 0) { + *ph_dly_final = ph_dly_back; + dramc_err("8-Phase SM_%u failed, falling back to default\n", phase_sm); + return 0; + } else if (*ph_dly_loop_break) { + return -1; + } + + return -2; +} + +static void dramc_8_phase_cal_set_best_dly(const struct ddr_cali *cali, u8 ph_dly_back) +{ + u8 dqsien_pi; + u8 phase_sm, ph_dly, ph_start, ph_end; + int ph_dly_loop_break; + int ph_dly_final = 0xff; /* default delay: 0xff */ + + for (phase_sm = DQS_8PH_DEGREE_0; phase_sm < DQS_8PH_DEGREE_MAX; phase_sm++) { + switch (phase_sm) { + case DQS_8PH_DEGREE_0: + dqsien_pi = 16; + ph_start = 0; + ph_end = 1; + break; + case DQS_8PH_DEGREE_180: + dqsien_pi = 48; + ph_start = 0; + ph_end = 1; + break; + case DQS_8PH_DEGREE_45: + dqsien_pi = 24; + ph_start = 0; + ph_end = 32; + break; + default: + die("Invalid phase_sm: %u!\n", phase_sm); + return; + } + + dramc_dbg("8-Phase SM_%u, 8PH_dly (%u~%u), DQSIEN PI = %u, 8PH_Dly = %u\n", + phase_sm, ph_start, ph_end, dqsien_pi, ph_dly_back); + + for (u8 rk = RANK_0; rk < cali->support_ranks; rk++) + SET32_BITFIELDS(&ch[0].phy_ao.byte[0].rk[rk].shu_rk_b0_dqsien_pi_dly, + SHU_RK_B0_DQSIEN_PI_DLY_DQSIEN_PI_B0, dqsien_pi); + + for (ph_dly = ph_start; ph_dly < ph_end; ph_dly++) { + int ret = dramc_8_phase_cal_find_best_dly(phase_sm, ph_dly, + ph_dly_back, &ph_dly_final, &ph_dly_loop_break); + if (ret == 0) + goto final_found; + if (ph_dly_loop_break) + break; + } + } + +final_found: + dramc_dbg("8 phase calibration ph_dly_final = %u\n", ph_dly_final); + for (u8 chn = 0; chn < CHANNEL_MAX; chn++) { + SET32_BITFIELDS(&ch[chn].phy_ao.byte[0].shu_b0_dq1, + SHU_B0_DQ1_RG_ARPI_MIDPI_8PH_DLY_B0, ph_dly_final); + SET32_BITFIELDS(&ch[chn].phy_ao.byte[1].shu_b0_dq1, + SHU_B1_DQ1_RG_ARPI_MIDPI_8PH_DLY_B1, ph_dly_final); + SET32_BITFIELDS(&ch[chn].phy_ao.shu_ca_cmd1, + SHU_CA_CMD1_RG_ARPI_MIDPI_8PH_DLY_CA, ph_dly_final); + } +} + +void dramc_8_phase_cal(const struct ddr_cali *cali) +{ + u8 ph_dly_back = 0; + dram_freq_grp freq_group = cali->freq_group; + /* ch0 and ch1 of phy_ao */ + struct ddrphy_ao_regs *phy_ao = &ch[0].phy_ao; + struct ddrphy_ao_regs *phy_ao_ch1 = &ch[1].phy_ao; + + if (freq_group < DDRFREQ_2133) { + dramc_info("Freq %u < 2133, do not need do 8-Phase\n", get_frequency(cali)); + return; + } + + struct reg_bak regs_bak[] = { + {&phy_ao->misc_dutyscan1}, + {&phy_ao->dvs_b[0].b0_dq6}, + {&phy_ao->dvs_b[1].b0_dq6}, + {&phy_ao->dvs_b[0].b0_dq5}, + {&phy_ao->dvs_b[1].b0_dq5}, + {&phy_ao->dvs_b[0].b0_dq3}, + {&phy_ao->dvs_b[1].b0_dq3}, + {&phy_ao->misc_ctrl1}, + {&phy_ao->misc_ctrl4}, + {&phy_ao->dvs_b[0].b0_phy2}, + {&phy_ao->dvs_b[1].b0_phy2}, + {&phy_ao->byte[0].shu_b0_dll_arpi2}, + {&phy_ao->byte[1].shu_b0_dll_arpi2}, + {&phy_ao->byte[0].shu_b0_dq11}, + {&phy_ao->byte[1].shu_b0_dq11}, + {&phy_ao->shu_ca_cmd11}, + {&phy_ao->misc_stbcal}, + {&phy_ao->byte[0].rk[0].shu_rk_b0_dqsien_pi_dly}, + {&phy_ao->byte[0].rk[1].shu_rk_b0_dqsien_pi_dly}, + {&phy_ao->misc_jmeter}, + {&phy_ao->misc_shu_stbcal}, + {&phy_ao->shu_ca_dll1}, + {&phy_ao->byte[0].shu_b0_dll1}, + {&phy_ao->byte[1].shu_b0_dll1}, + {&phy_ao->dvs_b[0].b0_dq2}, + {&phy_ao->dvs_b[1].b0_dq2}, + {&phy_ao->ca_cmd2}, + {&phy_ao->byte[0].shu_b0_dq13}, + {&phy_ao->byte[1].shu_b0_dq13}, + {&phy_ao->shu_ca_cmd13}, + {&phy_ao_ch1->shu_ca_dll1}, + {&phy_ao_ch1->byte[0].shu_b0_dll1}, + {&phy_ao_ch1->byte[1].shu_b0_dll1}, + {&phy_ao_ch1->dvs_b[0].b0_dq2}, + {&phy_ao_ch1->dvs_b[1].b0_dq2}, + {&phy_ao_ch1->ca_cmd2}, + {&phy_ao_ch1->byte[0].shu_b0_dq13}, + {&phy_ao_ch1->byte[1].shu_b0_dq13}, + {&phy_ao_ch1->shu_ca_cmd13}, + }; + for (size_t i = 0; i < ARRAY_SIZE(regs_bak); i++) + regs_bak[i].value = read32(regs_bak[i].addr); + + for (u8 chn = 0; chn < CHANNEL_MAX; chn++) { + phy_ao = &ch[chn].phy_ao; + SET32_BITFIELDS(&phy_ao->dvs_b[0].b0_dq2, + B0_DQ2_RG_TX_ARDQS_OE_TIE_SEL_B0, 0, + B0_DQ2_RG_TX_ARDQS_OE_TIE_EN_B0, 1, + B0_DQ2_RG_TX_ARWCK_OE_TIE_SEL_B0, 0, + B0_DQ2_RG_TX_ARWCK_OE_TIE_EN_B0, 1, + B0_DQ2_RG_TX_ARWCKB_OE_TIE_SEL_B0, 0, + B0_DQ2_RG_TX_ARWCKB_OE_TIE_EN_B0, 1, + B0_DQ2_RG_TX_ARDQM_OE_TIE_SEL_B0, 0, + B0_DQ2_RG_TX_ARDQM_OE_TIE_EN_B0, 1, + B0_DQ2_RG_TX_ARDQ_OE_TIE_SEL_B0, 0, + B0_DQ2_RG_TX_ARDQ_OE_TIE_EN_B0, 0xff); + SET32_BITFIELDS(&phy_ao->dvs_b[1].b0_dq2, + B1_DQ2_RG_TX_ARDQS_OE_TIE_SEL_B1, 0, + B1_DQ2_RG_TX_ARDQS_OE_TIE_EN_B1, 1, + B1_DQ2_RG_TX_ARWCK_OE_TIE_SEL_B1, 0, + B1_DQ2_RG_TX_ARWCK_OE_TIE_EN_B1, 1, + B1_DQ2_RG_TX_ARWCKB_OE_TIE_SEL_B1, 0, + B1_DQ2_RG_TX_ARWCKB_OE_TIE_EN_B1, 1, + B1_DQ2_RG_TX_ARDQM_OE_TIE_SEL_B1, 0, + B1_DQ2_RG_TX_ARDQM_OE_TIE_EN_B1, 1, + B1_DQ2_RG_TX_ARDQ_OE_TIE_SEL_B1, 0, + B1_DQ2_RG_TX_ARDQ_OE_TIE_EN_B1, 0xff); + SET32_BITFIELDS(&phy_ao->ca_cmd2, + CA_CMD2_RG_TX_ARCLK_OE_TIE_SEL_CA, 0, + CA_CMD2_RG_TX_ARCLK_OE_TIE_EN_CA, 1, + CA_CMD2_RG_TX_ARCS_OE_TIE_SEL_CA, 0, + CA_CMD2_RG_TX_ARCS_OE_TIE_EN_CA, 1, + CA_CMD2_RG_TX_ARCA_OE_TIE_SEL_CA, 0, + CA_CMD2_RG_TX_ARCA_OE_TIE_EN_CA, 0xff); + SET32_BITFIELDS(&phy_ao->byte[0].shu_b0_dq13, + SHU_B0_DQ13_RG_TX_ARDQSB_OE_TIE_SEL_B0, 0, + SHU_B0_DQ13_RG_TX_ARDQSB_OE_TIE_EN_B0, 1); + SET32_BITFIELDS(&phy_ao->byte[1].shu_b0_dq13, + SHU_B1_DQ13_RG_TX_ARDQSB_OE_TIE_SEL_B1, 0, + SHU_B1_DQ13_RG_TX_ARDQSB_OE_TIE_EN_B1, 1); + SET32_BITFIELDS(&phy_ao->shu_ca_cmd13, + SHU_CA_CMD13_RG_TX_ARCLKB_OE_TIE_SEL_CA, 0, + SHU_CA_CMD13_RG_TX_ARCLKB_OE_TIE_EN_CA, 1); + } + + phy_ao = &ch[0].phy_ao; + ph_dly_back = READ32_BITFIELD(&phy_ao->byte[0].shu_b0_dq1, + SHU_B0_DQ1_RG_ARPI_MIDPI_8PH_DLY_B0); + SET32_BITFIELDS(&phy_ao->misc_shu_stbcal, + MISC_SHU_STBCAL_STBCALEN, 0x0, + MISC_SHU_STBCAL_STB_SELPHCALEN, 0x0); + SET32_BITFIELDS(&phy_ao->byte[0].shu_b0_dq11, + SHU_B0_DQ11_RG_RX_ARDQ_RANK_SEL_SER_EN_B0, 0); + SET32_BITFIELDS(&phy_ao->byte[1].shu_b0_dq11, + SHU_B1_DQ11_RG_RX_ARDQ_RANK_SEL_SER_EN_B1, 0); + SET32_BITFIELDS(&phy_ao->shu_ca_cmd11, + SHU_CA_CMD11_RG_RX_ARCA_RANK_SEL_SER_EN_CA, 0); + + for (u8 chn = 0; chn < CHANNEL_MAX; chn++) { + phy_ao = &ch[chn].phy_ao; + SET32_BITFIELDS(&phy_ao->shu_ca_dll1, + SHU_CA_DLL1_RG_ARDLL_PHDET_EN_CA, 0x0, + SHU_CA_DLL1_RG_ARDLL_PHDET_OUT_SEL_CA, 0x0); + SET32_BITFIELDS(&phy_ao->byte[0].shu_b0_dll1, + SHU_B0_DLL1_RG_ARDLL_PHDET_EN_B0, 0x0, + SHU_B0_DLL1_RG_ARDLL_PHDET_OUT_SEL_B0, 0x0); + SET32_BITFIELDS(&phy_ao->byte[1].shu_b0_dll1, + SHU_B1_DLL1_RG_ARDLL_PHDET_EN_B1, 0x0, + SHU_B1_DLL1_RG_ARDLL_PHDET_OUT_SEL_B1, 0x0); + } + + phy_ao = &ch[0].phy_ao; + SET32_BITFIELDS(&phy_ao->misc_ctrl1, MISC_CTRL1_R_DMDQSIENCG_EN, 0); + SET32_BITFIELDS(&phy_ao->byte[0].shu_b0_dll_arpi2, + SHU_B0_DLL_ARPI2_RG_ARPI_CG_DQSIEN_B0, 0); + SET32_BITFIELDS(&phy_ao->byte[1].shu_b0_dll_arpi2, + SHU_B1_DLL_ARPI2_RG_ARPI_CG_DQSIEN_B1, 0); + SET32_BITFIELDS(&phy_ao->misc_dutyscan1, + MISC_DUTYSCAN1_RX_EYE_SCAN_CG_EN, 1); + SET32_BITFIELDS(&phy_ao->misc_ctrl4, MISC_CTRL4_R_OPT2_CG_DQSIEN, 0); + SET32_BITFIELDS(&phy_ao->misc_stbcal, MISC_STBCAL_DQSIENCG_NORMAL_EN, 0); + SET32_BITFIELDS(&phy_ao->dvs_b[0].b0_dq6, + B0_DQ6_RG_RX_ARDQ_EYE_DLY_DQS_BYPASS_B0, 1); + SET32_BITFIELDS(&phy_ao->dvs_b[1].b0_dq6, + B1_DQ6_RG_RX_ARDQ_EYE_DLY_DQS_BYPASS_B1, 1); + SET32_BITFIELDS(&phy_ao->misc_dutyscan1, MISC_DUTYSCAN1_RX_EYE_SCAN_EN, 1); + SET32_BITFIELDS(&phy_ao->misc_dutyscan1, + MISC_DUTYSCAN1_EYESCAN_DQS_SYNC_EN, 0x1, + MISC_DUTYSCAN1_EYESCAN_NEW_DQ_SYNC_EN, 0x1, + MISC_DUTYSCAN1_EYESCAN_DQ_SYNC_EN, 0x1); + SET32_BITFIELDS(&phy_ao->dvs_b[0].b0_dq5, B0_DQ5_RG_RX_ARDQ_EYE_EN_B0, 1); + SET32_BITFIELDS(&phy_ao->dvs_b[1].b0_dq5, B1_DQ5_RG_RX_ARDQ_EYE_EN_B1, 1); + SET32_BITFIELDS(&phy_ao->dvs_b[0].b0_dq5, B0_DQ5_RG_RX_ARDQ_VREF_EN_B0, 1); + SET32_BITFIELDS(&phy_ao->dvs_b[1].b0_dq5, B1_DQ5_RG_RX_ARDQ_VREF_EN_B1, 1); + SET32_BITFIELDS(&phy_ao->dvs_b[0].b0_dq3, B0_DQ3_RG_RX_ARDQ_SMT_EN_B0, 1); + SET32_BITFIELDS(&phy_ao->dvs_b[1].b0_dq3, B1_DQ3_RG_RX_ARDQ_SMT_EN_B1, 1); + SET32_BITFIELDS(&phy_ao->dvs_b[0].b0_phy2, B0_PHY2_RG_RX_ARDQS_JM_EN_B0, 1); + SET32_BITFIELDS(&phy_ao->dvs_b[1].b0_phy2, B1_PHY2_RG_RX_ARDQS_JM_EN_B1, 1); + SET32_BITFIELDS(&phy_ao->misc_jmeter, MISC_JMETER_JMTR_EN, 1); + SET32_BITFIELDS(&phy_ao->dvs_b[0].b0_phy2, B0_PHY2_RG_RX_ARDQS_JM_SEL_B0, 1); + SET32_BITFIELDS(&phy_ao->dvs_b[1].b0_phy2, B1_PHY2_RG_RX_ARDQS_JM_SEL_B1, 1); + SET32_BITFIELDS(&phy_ao->misc_dutyscan1, MISC_DUTYSCAN1_RX_MIOCK_JIT_EN, 1); + SET32_BITFIELDS(&phy_ao->misc_dutyscan1, MISC_DUTYSCAN1_RX_EYE_SCAN_EN, 0); + SET32_BITFIELDS(&phy_ao->misc_dutyscan1, MISC_DUTYSCAN1_DQSERRCNT_DIS, 0); + + dramc_8_phase_cal_set_best_dly(cali, ph_dly_back); + + for (size_t i = 0; i < ARRAY_SIZE(regs_bak); i++) + write32(regs_bak[i].addr, regs_bak[i].value); +} diff --git a/src/soc/mediatek/mt8192/include/soc/dramc_pi_api.h b/src/soc/mediatek/mt8192/include/soc/dramc_pi_api.h index 5a2583c..2dee044 100644 --- a/src/soc/mediatek/mt8192/include/soc/dramc_pi_api.h +++ b/src/soc/mediatek/mt8192/include/soc/dramc_pi_api.h @@ -34,6 +34,8 @@ #define REG_SHU_OFFSET_WIDTH 0x700 #define SHU_OFFSET (REG_SHU_OFFSET_WIDTH / 4)
+#define DQS_LEVEL_UNKNOWN 0xff + typedef enum { DDRFREQ_400, DDRFREQ_600,