huayang duan has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use calibration result do fast calibration ......................................................................
mediatek/mt8183: Use calibration result do fast calibration
Load calibration result from flash, if result was correct, use this calibration result do fast calibration to reduce the bootup time.
BUG=b:80501386 BRANCH=none TEST=Boots correctly on Kukui.
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/memory.c 5 files changed, 366 insertions(+), 254 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35164/1
diff --git a/src/soc/mediatek/mt8183/dramc_init_setting.c b/src/soc/mediatek/mt8183/dramc_init_setting.c index 9103c2d..232b4cf 100644 --- a/src/soc/mediatek/mt8183/dramc_init_setting.c +++ b/src/soc/mediatek/mt8183/dramc_init_setting.c @@ -601,45 +601,54 @@
static void dramc_duty_calibration(const struct sdram_params *params, u8 freq_group) { - s8 clkDelay[CHANNEL_MAX] = {0x0}; - s8 dqsDelay[CHANNEL_MAX][DQS_NUMBER] = {0x0}; + if (params->have_full_k_params) { + dramc_dbg("bypass duty calibration\n");
- switch (freq_group) { - case LP4X_DDR1600: - clkDelay[CHANNEL_A] = 2; - clkDelay[CHANNEL_B] = 1; - dqsDelay[CHANNEL_A][0] = 0; - dqsDelay[CHANNEL_A][1] = 0; - dqsDelay[CHANNEL_B][0] = -1; - dqsDelay[CHANNEL_B][1] = 0; - break; - case LP4X_DDR2400: - clkDelay[CHANNEL_A] = clkDelay[CHANNEL_B] = 0; - dqsDelay[CHANNEL_A][0] = 0; - dqsDelay[CHANNEL_A][1] = -2; - dqsDelay[CHANNEL_B][0] = 0; - dqsDelay[CHANNEL_B][1] = -2; - break; - case LP4X_DDR3200: - clkDelay[CHANNEL_A] = clkDelay[CHANNEL_B] = 1; - dqsDelay[CHANNEL_A][0] = 1; - dqsDelay[CHANNEL_A][1] = -2; - dqsDelay[CHANNEL_B][0] = 1; - dqsDelay[CHANNEL_B][1] = -2; - break; - case LP4X_DDR3600: - clkDelay[CHANNEL_A] = 2; - clkDelay[CHANNEL_B] = 1; - dqsDelay[CHANNEL_A][0] = 0; - dqsDelay[CHANNEL_A][1] = 0; - dqsDelay[CHANNEL_B][0] = -1; - dqsDelay[CHANNEL_B][1] = 0; - break; - } + for (u8 chn = 0; chn < CHANNEL_MAX; chn++) { + dramc_duty_set_clk_delay(chn, params->duty_clk_delay[chn]); + dramc_duty_set_dqs_delay(chn, params->duty_dqs_delay[chn]); + } + } else { + s8 clkDelay[CHANNEL_MAX] = {0x0}; + s8 dqsDelay[CHANNEL_MAX][DQS_NUMBER] = {0x0};
- for (u8 chn = 0; chn < CHANNEL_MAX; chn++) { - dramc_duty_set_clk_delay(chn, clkDelay[chn]); - dramc_duty_set_dqs_delay(chn, dqsDelay[chn]); + switch (freq_group) { + case LP4X_DDR1600: + clkDelay[CHANNEL_A] = 2; + clkDelay[CHANNEL_B] = 1; + dqsDelay[CHANNEL_A][0] = 0; + dqsDelay[CHANNEL_A][1] = 0; + dqsDelay[CHANNEL_B][0] = -1; + dqsDelay[CHANNEL_B][1] = 0; + break; + case LP4X_DDR2400: + clkDelay[CHANNEL_A] = clkDelay[CHANNEL_B] = 0; + dqsDelay[CHANNEL_A][0] = 0; + dqsDelay[CHANNEL_A][1] = -2; + dqsDelay[CHANNEL_B][0] = 0; + dqsDelay[CHANNEL_B][1] = -2; + break; + case LP4X_DDR3200: + clkDelay[CHANNEL_A] = clkDelay[CHANNEL_B] = 1; + dqsDelay[CHANNEL_A][0] = 1; + dqsDelay[CHANNEL_A][1] = -2; + dqsDelay[CHANNEL_B][0] = 1; + dqsDelay[CHANNEL_B][1] = -2; + break; + case LP4X_DDR3600: + clkDelay[CHANNEL_A] = 2; + clkDelay[CHANNEL_B] = 1; + dqsDelay[CHANNEL_A][0] = 0; + dqsDelay[CHANNEL_A][1] = 0; + dqsDelay[CHANNEL_B][0] = -1; + dqsDelay[CHANNEL_B][1] = 0; + break; + } + + for (u8 chn = 0; chn < CHANNEL_MAX; chn++) { + dramc_duty_set_clk_delay(chn, clkDelay[chn]); + dramc_duty_set_dqs_delay(chn, dqsDelay[chn]); + } } }
diff --git a/src/soc/mediatek/mt8183/dramc_pi_calibration_api.c b/src/soc/mediatek/mt8183/dramc_pi_calibration_api.c index 39ea0b3..220a319 100644 --- a/src/soc/mediatek/mt8183/dramc_pi_calibration_api.c +++ b/src/soc/mediatek/mt8183/dramc_pi_calibration_api.c @@ -244,17 +244,25 @@ static void dramc_cmd_bus_training(u8 chn, u8 rank, u8 freq_group, const struct sdram_params *params) { - u32 cbt_cs, mr12_value; + u32 final_vref, clk_dly, cmd_dly, cs_dly;
- cbt_cs = params->cbt_cs[chn][rank]; - mr12_value = params->cbt_mr12[chn][rank]; + clk_dly = params->cbt_clk_dly[chn][rank]; + cmd_dly = params->cbt_cmd_dly[chn][rank]; + cs_dly = params->cbt_cs_dly[chn][rank]; + final_vref = params->cbt_final_vref[chn][rank];
- /* CBT adjust cs */ - clrsetbits_le32(&ch[chn].phy.shu[0].rk[rank].ca_cmd[9], - SHU1_CA_CMD9_RG_RK_ARFINE_TUNE_CS_MASK, cbt_cs << 0); + if (params->have_full_k_params) { + /* Set CLK and CA delay */ + clrsetbits_le32(&ch[chn].phy.shu[0].rk[rank].ca_cmd[9], + (0x3f << 8) | (0x3f << 24), (cmd_dly << 8) | (clk_dly << 24)); + udelay(1); + } + + /* Set CLK and CS delay */ + clrsetbits_le32(&ch[chn].phy.shu[0].rk[rank].ca_cmd[9], 0x3f, cs_dly << 0);
/* CBT set vref */ - dramc_mode_reg_write_by_rank(chn, rank, 12, mr12_value); + dramc_mode_reg_write_by_rank(chn, rank, 12, final_vref); }
static void dramc_read_dbi_onoff(bool on) @@ -885,112 +893,124 @@
coarse_end = coarse_start + 12; dramc_dbg("[Gating]\n"); - for (u32 coarse_tune = coarse_start; coarse_tune < coarse_end; coarse_tune++) { - u32 dly_coarse_large_rodt = 0, dly_coarse_0p5t_rodt = 0; - u32 dly_coarse_large_rodt_p1 = 4, dly_coarse_0p5t_rodt_p1 = 4;
- u8 dly_coarse_large = coarse_tune / RX_DQS_CTL_LOOP; - u8 dly_coarse_0p5t = coarse_tune % RX_DQS_CTL_LOOP; - u32 dly_coarse_large_p1 = (coarse_tune + freqDiv) / RX_DQS_CTL_LOOP; - u32 dly_coarse_0p5t_p1 = (coarse_tune + freqDiv) % RX_DQS_CTL_LOOP; - u32 value = (dly_coarse_large << 3) + dly_coarse_0p5t; + if (params->have_full_k_params) { + dramc_dbg("[bypass Gating]\n"); + } else { + for (u32 coarse_tune = coarse_start; coarse_tune < coarse_end; coarse_tune++) { + u32 dly_coarse_large_rodt = 0, dly_coarse_0p5t_rodt = 0; + u32 dly_coarse_large_rodt_p1 = 4, dly_coarse_0p5t_rodt_p1 = 4;
- if (value >= 11) { - value -= 11; - dly_coarse_large_rodt = value >> 3; + u8 dly_coarse_large = coarse_tune / RX_DQS_CTL_LOOP; + u8 dly_coarse_0p5t = coarse_tune % RX_DQS_CTL_LOOP; + u32 dly_coarse_large_p1 = (coarse_tune + freqDiv) / RX_DQS_CTL_LOOP; + u32 dly_coarse_0p5t_p1 = (coarse_tune + freqDiv) % RX_DQS_CTL_LOOP; + u32 value = (dly_coarse_large << 3) + dly_coarse_0p5t; + + if (value >= 11) { + value -= 11; + dly_coarse_large_rodt = value >> 3; dly_coarse_0p5t_rodt = value - (dly_coarse_large_rodt << 3);
- value = (dly_coarse_large << 3) + dly_coarse_0p5t - 11; - dly_coarse_large_rodt_p1 = value >> 3; + value = (dly_coarse_large << 3) + dly_coarse_0p5t - 11; + dly_coarse_large_rodt_p1 = value >> 3; dly_coarse_0p5t_rodt_p1 = value - (dly_coarse_large_rodt_p1 << 3); - } + }
- clrsetbits_le32(&ch[chn].ao.shu[0].rk[rank].selph_dqsg0, - 0x77777777, - (dly_coarse_large << 0) | (dly_coarse_large << 8) | - (dly_coarse_large << 16) | (dly_coarse_large << 24) | - (dly_coarse_large_p1 << 4) | (dly_coarse_large_p1 << 12) | - (dly_coarse_large_p1 << 20) | (dly_coarse_large_p1 << 28)); - clrsetbits_le32(&ch[chn].ao.shu[0].rk[rank].selph_dqsg1, - 0x77777777, - (dly_coarse_0p5t << 0) | (dly_coarse_0p5t << 8) | - (dly_coarse_0p5t << 16) | (dly_coarse_0p5t << 24) | - (dly_coarse_0p5t_p1 << 4) | (dly_coarse_0p5t_p1 << 12) | - (dly_coarse_0p5t_p1 << 20) | (dly_coarse_0p5t_p1 << 28)); - clrsetbits_le32(&ch[chn].ao.shu[0].rk[rank].selph_odten0, - 0x77777777, - (dly_coarse_large_rodt << 0) | (dly_coarse_large_rodt << 8) | - (dly_coarse_large_rodt << 16) | (dly_coarse_large_rodt << 24) | - (dly_coarse_large_rodt_p1 << 4) | (dly_coarse_large_rodt_p1 << 12) | - (dly_coarse_large_rodt_p1 << 20) | (dly_coarse_large_rodt_p1 << 28)); - clrsetbits_le32(&ch[chn].ao.shu[0].rk[rank].selph_odten1, - 0x77777777, - (dly_coarse_0p5t_rodt << 0) | (dly_coarse_0p5t_rodt << 8) | - (dly_coarse_0p5t_rodt << 16) | (dly_coarse_0p5t_rodt << 24) | - (dly_coarse_0p5t_rodt_p1 << 4) | (dly_coarse_0p5t_rodt_p1 << 12) | - (dly_coarse_0p5t_rodt_p1 << 20) | (dly_coarse_0p5t_rodt_p1 << 28)); + clrsetbits_le32(&ch[chn].ao.shu[0].rk[rank].selph_dqsg0, + 0x77777777, + (dly_coarse_large << 0) | (dly_coarse_large << 8) | + (dly_coarse_large << 16) | (dly_coarse_large << 24) | + (dly_coarse_large_p1 << 4) | (dly_coarse_large_p1 << 12) | + (dly_coarse_large_p1 << 20) | (dly_coarse_large_p1 << 28)); + clrsetbits_le32(&ch[chn].ao.shu[0].rk[rank].selph_dqsg1, + 0x77777777, + (dly_coarse_0p5t << 0) | (dly_coarse_0p5t << 8) | + (dly_coarse_0p5t << 16) | (dly_coarse_0p5t << 24) | + (dly_coarse_0p5t_p1 << 4) | (dly_coarse_0p5t_p1 << 12) | + (dly_coarse_0p5t_p1 << 20) | (dly_coarse_0p5t_p1 << 28)); + clrsetbits_le32(&ch[chn].ao.shu[0].rk[rank].selph_odten0, + 0x77777777, + (dly_coarse_large_rodt << 0) | (dly_coarse_large_rodt << 8) | + (dly_coarse_large_rodt << 16) | (dly_coarse_large_rodt << 24) | + (dly_coarse_large_rodt_p1 << 4) | (dly_coarse_large_rodt_p1 << 12) | + (dly_coarse_large_rodt_p1 << 20) | (dly_coarse_large_rodt_p1 << 28)); + clrsetbits_le32(&ch[chn].ao.shu[0].rk[rank].selph_odten1, + 0x77777777, + (dly_coarse_0p5t_rodt << 0) | (dly_coarse_0p5t_rodt << 8) | + (dly_coarse_0p5t_rodt << 16) | (dly_coarse_0p5t_rodt << 24) | + (dly_coarse_0p5t_rodt_p1 << 4) | (dly_coarse_0p5t_rodt_p1 << 12) | + (dly_coarse_0p5t_rodt_p1 << 20) | (dly_coarse_0p5t_rodt_p1 << 28));
- for (u8 dly_fine_xt = 0; dly_fine_xt < DQS_GW_FINE_END; dly_fine_xt += 4) { - dramc_set_gating_mode(chn, 0); - write32(&ch[chn].ao.shu[0].rk[rank].dqsien, - dly_fine_xt | (dly_fine_xt << 8)); + for (u8 dly_fine_xt = 0; dly_fine_xt < DQS_GW_FINE_END; dly_fine_xt += 4) { + dramc_set_gating_mode(chn, 0); + write32(&ch[chn].ao.shu[0].rk[rank].dqsien, + dly_fine_xt | (dly_fine_xt << 8));
- dram_phy_reset(chn); + dram_phy_reset(chn); setbits_le32(&ch[chn].ao.spcmd, 1 << SPCMD_DQSGCNTRST_SHIFT); udelay(1); clrbits_le32(&ch[chn].ao.spcmd, 1 << SPCMD_DQSGCNTRST_SHIFT);
- dramc_engine2_run(chn, TE_OP_READ_CHECK); + dramc_engine2_run(chn, TE_OP_READ_CHECK);
- u32 result_r = read32(&ch[chn].phy.misc_stberr_rk0_r) & - MISC_STBERR_RK_R_STBERR_RK_R_MASK; - u32 result_f = read32(&ch[chn].phy.misc_stberr_rk0_f) & - MISC_STBERR_RK_F_STBERR_RK_F_MASK; - debug_cnt[0] = read32(&ch[chn].nao.dqsgnwcnt[0]); - debug_cnt[1] = (debug_cnt[0] >> 16) & 0xffff; - debug_cnt[0] &= 0xffff; + u32 result_r = read32(&ch[chn].phy.misc_stberr_rk0_r) & + MISC_STBERR_RK_R_STBERR_RK_R_MASK; + u32 result_f = read32(&ch[chn].phy.misc_stberr_rk0_f) & + MISC_STBERR_RK_F_STBERR_RK_F_MASK; + debug_cnt[0] = read32(&ch[chn].nao.dqsgnwcnt[0]); + debug_cnt[1] = (debug_cnt[0] >> 16) & 0xffff; + debug_cnt[0] &= 0xffff;
- dramc_set_gating_mode(chn, 1); - dramc_engine2_run(chn, TE_OP_READ_CHECK); + dramc_set_gating_mode(chn, 1); + dramc_engine2_run(chn, TE_OP_READ_CHECK);
- dramc_find_dly_tune(chn, dly_coarse_large, - dly_coarse_0p5t, dly_fine_xt, dqs_high, - dly_coarse_large_cnt, dly_coarse_0p5t_cnt, - dly_fine_tune_cnt, dqs_transition, dqs_done); + dramc_find_dly_tune(chn, dly_coarse_large, + dly_coarse_0p5t, dly_fine_xt, dqs_high, + dly_coarse_large_cnt, dly_coarse_0p5t_cnt, + dly_fine_tune_cnt, dqs_transition, dqs_done);
- dramc_dbg("%d %d %d |", dly_coarse_large, - dly_coarse_0p5t, dly_fine_xt); - for (dqs = 0; dqs < DQS_NUMBER; dqs++) - dramc_dbg("%X ", debug_cnt[dqs]); + dramc_dbg("%d %d %d |", dly_coarse_large, + dly_coarse_0p5t, dly_fine_xt); + for (dqs = 0; dqs < DQS_NUMBER; dqs++) + dramc_dbg("%X ", debug_cnt[dqs]);
- dramc_dbg(" |"); - for (dqs = 0; dqs < DQS_NUMBER; dqs++) { - dramc_dbg("(%X %X)", - (result_f >> (DQS_BIT_NUMBER * dqs)) & 0xff, - (result_r >> (DQS_BIT_NUMBER * dqs)) & 0xff); + dramc_dbg(" |"); + for (dqs = 0; dqs < DQS_NUMBER; dqs++) { + dramc_dbg("(%X %X)", + (result_f >> (DQS_BIT_NUMBER * dqs)) & 0xff, + (result_r >> (DQS_BIT_NUMBER * dqs)) & 0xff); + } + + dramc_dbg("\n"); + if (dramc_find_gating_window(result_r, result_f, debug_cnt, + dly_coarse_large, dly_coarse_0p5t, pass_begin, pass_count, + pass_count_1, &dly_fine_xt, dqs_high, dqs_done)) + coarse_tune = coarse_end; } - - dramc_dbg("\n"); - if (dramc_find_gating_window(result_r, result_f, debug_cnt, - dly_coarse_large, dly_coarse_0p5t, pass_begin, pass_count, - pass_count_1, &dly_fine_xt, dqs_high, dqs_done)) - coarse_tune = coarse_end; } + + dramc_engine2_end(chn); + write32(&ch[chn].ao.dummy_rd, dummy_rd_backup); }
- dramc_engine2_end(chn); - write32(&ch[chn].ao.dummy_rd, dummy_rd_backup); - for (dqs = 0; dqs < DQS_NUMBER; dqs++) { - pass_count[dqs] = dqs_transition[dqs]; - min_fine_tune[dqs] = dly_fine_tune_cnt[dqs]; - min_coarse_tune0p5t[dqs] = dly_coarse_0p5t_cnt[dqs]; - min_coarse_tune2t[dqs] = dly_coarse_large_cnt[dqs]; - + if (params->have_full_k_params) { + dramc_dbg("[bypass Gating params] dqs:%d\n", dqs); + pass_count[dqs] = params->gating_pass_count[chn][rank][dqs]; + min_fine_tune[dqs] = params->gating_fine_tune[chn][rank][dqs]; + min_coarse_tune0p5t[dqs] = params->gating05T[chn][rank][dqs]; + min_coarse_tune2t[dqs] = params->gating2T[chn][rank][dqs]; + } else { + pass_count[dqs] = dqs_transition[dqs]; + min_fine_tune[dqs] = dly_fine_tune_cnt[dqs]; + min_coarse_tune0p5t[dqs] = dly_coarse_0p5t_cnt[dqs]; + min_coarse_tune2t[dqs] = dly_coarse_large_cnt[dqs]; + } u8 tmp_offset = pass_count[dqs] * DQS_GW_FINE_STEP / 2; u8 tmp_value = min_fine_tune[dqs] + tmp_offset; best_fine_tune[dqs] = tmp_value % RX_DLY_DQSIENSTB_LOOP; @@ -1551,20 +1571,34 @@ else use_delay_cell = 0;
- for (u8 byte = 0; byte < DQS_NUMBER; byte++) { - center_dly[byte].min_center = 0xffff; - center_dly[byte].max_center = 0; - - for (u8 bit = 0; bit < DQS_BIT_NUMBER; bit++) { - index = bit + 8 * byte; - if (vref_dly[index].win_center < center_dly[byte].min_center) - center_dly[byte].min_center = vref_dly[index].win_center; - if (vref_dly[index].win_center > center_dly[byte].max_center) - center_dly[byte].max_center = vref_dly[index].win_center; + if (params->have_full_k_params && (bypass_tx)) { + dramc_dbg("bypass TX\n"); + for (u8 byte = 0; byte < DQS_NUMBER; byte++) { + center_dly[byte].min_center = params->tx_center_min[chn][rank][byte]; + center_dly[byte].max_center = params->tx_center_max[chn][rank][byte]; + for (u8 bit = 0; bit < DQS_BIT_NUMBER; bit++) { + index = bit + 8 * byte; + vref_dly[index].win_center = params->tx_win_center[chn][rank][index]; + vref_dly[index].best_first = params->tx_first_pass[chn][rank][index]; + vref_dly[index].best_last = params->tx_last_pass[chn][rank][index]; + } } - dramc_dbg("[channel %d] [rank %d] byte:%d, center_dly[byte].min_center:%d, center_dly[byte].max_center:%d\n", - chn, rank, byte, center_dly[byte].min_center, - center_dly[byte].max_center); + } else { + for (u8 byte = 0; byte < DQS_NUMBER; byte++) { + center_dly[byte].min_center = 0xffff; + center_dly[byte].max_center = 0; + + for (u8 bit = 0; bit < DQS_BIT_NUMBER; bit++) { + index = bit + 8 * byte; + if (vref_dly[index].win_center < center_dly[byte].min_center) + center_dly[byte].min_center = vref_dly[index].win_center; + if (vref_dly[index].win_center > center_dly[byte].max_center) + center_dly[byte].max_center = vref_dly[index].win_center; + } + dramc_dbg("[channel %d] [rank %d] byte:%d, center_dly[byte].min_center:%d, center_dly[byte].max_center:%d\n", + chn, rank, byte, center_dly[byte].min_center, + center_dly[byte].max_center); + } }
for (u8 byte = 0; byte < DQS_NUMBER; byte++) { @@ -1681,12 +1715,26 @@
u8 fsp = get_freq_fsq(freq_group); u8 vref_range = !fsp; + bool bypass_tx = !fsp;
dramc_get_vref_prop(rank, type, fsp, &vref_scan_enable, &vref_begin, &vref_end); dramc_get_dly_range(chn, rank, type, freq_group, dq_precal_result, &dly_begin, &dly_end, params);
+ if (params->have_full_k_params) { + if (type == RX_WIN_TEST_ENG && vref_scan_enable == 1) { + vref_begin = params->rx_vref[chn]; + vref_end = vref_begin + 1; + dramc_dbg("bypass RX vref:%d\n", vref_begin); + } else if (type == TX_WIN_DQ_ONLY) { + vref_begin = params->tx_vref[chn][rank]; + vref_end = vref_begin + 1; + dramc_dbg("bypass TX vref:%d\n", vref_begin); + } + vref_dly.best_vref = vref_begin; + } + if ((type == RX_WIN_RD_DQC || type == RX_WIN_TEST_ENG) && fsp == FSP_0) dly_step = 2;
@@ -1705,98 +1753,112 @@ vref_step = 2; }
- if (type == RX_WIN_RD_DQC) { - dramc_rx_rd_dqc_init(chn, rank); - } else { - if (type == RX_WIN_TEST_ENG) - dramc_rx_vref_pre_setting(chn); - dummy_rd_bak_engine2 = read32(&ch[chn].ao.dummy_rd); - dramc_engine2_init(chn, rank, TEST2_1_CAL, TEST2_2_CAL, false); - } - - vref_dly.max_win_sum = 0; - for (vref = vref_begin; vref < vref_end; vref += vref_step) { - small_reg_value = 0xff; - finish_bit = 0; - if (type == TX_WIN_DQ_ONLY) - vref_use = vref | (vref_range << 6); - else - vref_use = vref; - - for (size_t bit = 0; bit < DQ_DATA_WIDTH; bit++) { - win_perbit[bit].first_pass = PASS_RANGE_NA; - win_perbit[bit].last_pass = PASS_RANGE_NA; - win_perbit[bit].best_first = PASS_RANGE_NA; - win_perbit[bit].best_last = PASS_RANGE_NA; + if (params->have_full_k_params && bypass_tx && + (type == TX_WIN_DQ_ONLY || type == TX_WIN_DQ_DQM)) { + dramc_set_tx_best_dly(chn, rank, bypass_tx,vref_dly.perbit_dly, type, + freq_group, dq_precal_result, dly_cell_unit, params); + } else { + if (type == RX_WIN_RD_DQC) { + dramc_rx_rd_dqc_init(chn, rank); + } else { + if (type == RX_WIN_TEST_ENG) + dramc_rx_vref_pre_setting(chn); + dummy_rd_bak_engine2 = read32(&ch[chn].ao.dummy_rd); + dramc_engine2_init(chn, rank, TEST2_1_CAL, TEST2_2_CAL, false); }
- if (vref_scan_enable) - dramc_set_vref(chn, rank, type, vref_use); - - if (type == RX_WIN_RD_DQC || type == RX_WIN_TEST_ENG) { - dramc_set_rx_dly_factor(chn, rank, - RX_DQM, FIRST_DQ_DELAY); - dramc_set_rx_dly_factor(chn, rank, - RX_DQ, FIRST_DQ_DELAY); - } - - for (dly = dly_begin; dly < dly_end; dly += dly_step) { - dramc_set_dqdqs_dly(chn, rank, type, &small_reg_value, dly); - - err_value = dram_k_perbit(chn, type); - if (!vref_scan_enable) - dramc_dbg("%d ", dly); + vref_dly.max_win_sum = 0; + for (vref = vref_begin; vref < vref_end; vref += vref_step) { + small_reg_value = 0xff; + finish_bit = 0; + if (type == TX_WIN_DQ_ONLY) + vref_use = vref | (vref_range << 6); + else + vref_use = vref;
for (size_t bit = 0; bit < DQ_DATA_WIDTH; bit++) { - bool bit_fail = (err_value & ((u32) 1 << bit)) != 0; - - /* pass window bigger than 7, consider as real pass window */ - if (dramc_check_dqdqs_win(&(win_perbit[bit]), - dly, dly_end, bit_fail) > 7) - finish_bit |= (1 << bit); - - if (vref_scan_enable) - continue; - dramc_dbg("%s", bit_fail ? "x" : "o"); - if (bit % DQS_BIT_NUMBER == 7) - dramc_dbg(" "); + win_perbit[bit].first_pass = PASS_RANGE_NA; + win_perbit[bit].last_pass = PASS_RANGE_NA; + win_perbit[bit].best_first = PASS_RANGE_NA; + win_perbit[bit].best_last = PASS_RANGE_NA; }
- if (!vref_scan_enable) - dramc_dbg(" [MSB]\n"); + if (vref_scan_enable) + dramc_set_vref(chn, rank, type, vref_use);
- if (finish_bit == 0xffff && (err_value & 0xffff) == 0xffff) { - dramc_dbg("all bits window found, early break! delay=0x%x\n", - dly); - break; + if (type == RX_WIN_RD_DQC || type == RX_WIN_TEST_ENG) { + dramc_set_rx_dly_factor(chn, rank, + RX_DQM, FIRST_DQ_DELAY); + dramc_set_rx_dly_factor(chn, rank, + RX_DQ, FIRST_DQ_DELAY); + } + + if (params->have_full_k_params && (type == RX_WIN_RD_DQC ||type == RX_WIN_TEST_ENG)) { + dramc_dbg("bypass RX params\n"); + for (size_t bit = 0; bit < DQ_DATA_WIDTH; bit++) { + win_perbit[bit].best_first = params->rx_firspass[chn][rank][bit]; + win_perbit[bit].best_last = params->rx_lastpass[chn][rank][bit]; + } + } else { + for (dly = dly_begin; dly < dly_end; dly += dly_step) { + dramc_set_dqdqs_dly(chn, rank, type, &small_reg_value, dly); + + err_value = dram_k_perbit(chn, type); + if (!vref_scan_enable) + dramc_dbg("%d ", dly); + + for (size_t bit = 0; bit < DQ_DATA_WIDTH; bit++) { + bool bit_fail = (err_value & ((u32) 1 << bit)) != 0; + + /* pass window bigger than 7, consider as real pass window */ + if (dramc_check_dqdqs_win(&(win_perbit[bit]), + dly, dly_end, bit_fail) > 7) + finish_bit |= (1 << bit); + + if (vref_scan_enable) + continue; + dramc_dbg("%s", bit_fail ? "x" : "o"); + if (bit % DQS_BIT_NUMBER == 7) + dramc_dbg(" "); + } + + if (!vref_scan_enable) + dramc_dbg(" [MSB]\n"); + + if (finish_bit == 0xffff && (err_value & 0xffff) == 0xffff) { + dramc_dbg("all bits window found, early break! delay=0x%x\n", + dly); + break; + } } }
- for (size_t bit = 0; bit < DQ_DATA_WIDTH; bit++) - dramc_dbg("Dq[%zd] win width (%d ~ %d) %d\n", bit, - win_perbit[bit].best_first, win_perbit[bit].best_last, - win_perbit[bit].best_last - win_perbit[bit].best_first); + for (size_t bit = 0; bit < DQ_DATA_WIDTH; bit++) + dramc_dbg("Dq[%zd] win width (%d ~ %d) %d\n", bit, + win_perbit[bit].best_first, win_perbit[bit].best_last, + win_perbit[bit].best_last - win_perbit[bit].best_first);
- if (dramk_calc_best_vref(type, vref_use, &vref_dly, win_perbit, &win_min_max)) - break; + if (dramk_calc_best_vref(type, vref_use, &vref_dly, win_perbit, &win_min_max)) + break; + } + + if (type == RX_WIN_RD_DQC) { + dramc_rx_rd_dqc_end(chn); + } else { + dramc_engine2_end(chn); + write32(&ch[chn].ao.dummy_rd, dummy_rd_bak_engine2); + } + + if (vref_scan_enable && type == RX_WIN_TEST_ENG) + dramc_set_vref(chn, rank, type, vref_dly.best_vref); + + if (type == RX_WIN_RD_DQC || type == RX_WIN_TEST_ENG) + dramc_set_rx_best_dly(chn, rank, vref_dly.perbit_dly); + else + dramc_set_tx_best_dly(chn, rank, false, vref_dly.perbit_dly, type, + freq_group, dq_precal_result, dly_cell_unit, params); }
- if (type == RX_WIN_RD_DQC) { - dramc_rx_rd_dqc_end(chn); - } else { - dramc_engine2_end(chn); - write32(&ch[chn].ao.dummy_rd, dummy_rd_bak_engine2); - } - - if (vref_scan_enable && type == RX_WIN_TEST_ENG) - dramc_set_vref(chn, rank, type, vref_dly.best_vref); - - if (type == RX_WIN_RD_DQC || type == RX_WIN_TEST_ENG) - dramc_set_rx_best_dly(chn, rank, vref_dly.perbit_dly); - else - dramc_set_tx_best_dly(chn, rank, false, vref_dly.perbit_dly, type, - freq_group, dq_precal_result, dly_cell_unit, params); - if (vref_scan_enable && type == TX_WIN_DQ_ONLY) dramc_set_vref(chn, rank, type, vref_dly.best_vref);
@@ -1843,40 +1905,45 @@ u32 dummy_rd_backup = read32(&ch[chn].ao.dummy_rd); dramc_engine2_init(chn, rank, TEST2_1_CAL, TEST2_2_CAL, false);
- for (datlat = datlat_start; datlat < DATLAT_TAP_NUMBER; datlat++) { - dramc_dle_factor_handler(chn, datlat, freq_group); + if (params->have_full_k_params) { + best_step = params->rx_datlat[chn][rank]; + dramc_dbg("bypass DATLAT, best_step:%d\n", best_step); + } else { + for (datlat = datlat_start; datlat < DATLAT_TAP_NUMBER; datlat++) { + dramc_dle_factor_handler(chn, datlat, freq_group);
- u32 err = dramc_engine2_run(chn, TE_OP_WRITE_READ_CHECK); - if (err == 0) { - if (begin == 0) { - first = datlat; - begin = 1; + u32 err = dramc_engine2_run(chn, TE_OP_WRITE_READ_CHECK); + if (err == 0) { + if (begin == 0) { + first = datlat; + begin = 1; + } + if (begin == 1) { + sum++; + if (sum > 4) + break; + } + } else { + if (begin == 1) + begin = 0xff; } - if (begin == 1) { - sum++; - if (sum > 4) - break; - } - } else { - if (begin == 1) - begin = 0xff; + + dramc_dbg("Datlat=%2d, err_value=0x%4x, sum=%d\n", datlat, err, sum); }
- dramc_dbg("Datlat=%2d, err_value=0x%4x, sum=%d\n", datlat, err, sum); + dramc_engine2_end(chn); + write32(&ch[chn].ao.dummy_rd, dummy_rd_backup); + + assert(sum != 0); + + if (sum <= 3) + best_step = first + (sum >> 1); + else + best_step = first + 2; + dramc_dbg("First_step=%d, total pass=%d, best_step=%d\n", + begin, sum, best_step); }
- dramc_engine2_end(chn); - write32(&ch[chn].ao.dummy_rd, dummy_rd_backup); - - assert(sum != 0); - - if (sum <= 3) - best_step = first + (sum >> 1); - else - best_step = first + 2; - dramc_dbg("First_step=%d, total pass=%d, best_step=%d\n", - begin, sum, best_step); - dramc_dle_factor_handler(chn, best_step, freq_group);
clrsetbits_le32(&ch[chn].ao.padctrl, 0x3 | (0x1 << 3), diff --git a/src/soc/mediatek/mt8183/emi.c b/src/soc/mediatek/mt8183/emi.c index 818458c..f51428b 100644 --- a/src/soc/mediatek/mt8183/emi.c +++ b/src/soc/mediatek/mt8183/emi.c @@ -383,17 +383,19 @@ pmic_set_vdram2_vol(vddq); }
-void mt_set_emi(const struct sdram_params *params) +void mt_set_emi(const struct sdram_params *freq_params) { - u32 current_freq = LP4X_HIGH_FREQ; + u8 current_freq = LP4X_HIGH_FREQ; + const struct sdram_params *params = NULL;
#if DUAL_FREQ_K - u32 low_freq, middle_freq, high_freq; + u8 low_freq, middle_freq, high_freq;
low_freq = LP4X_LOW_FREQ; middle_freq = LP4X_MIDDLE_FREQ; high_freq = LP4X_HIGH_FREQ; current_freq = low_freq; + params = &freq_params[current_freq]; #endif
set_dram_voltage_by_freq(current_freq); @@ -402,11 +404,13 @@
#if DUAL_FREQ_K current_freq = middle_freq; + params = &freq_params[current_freq]; set_dram_voltage_by_freq(current_freq); dfs_init_for_calibration(params, current_freq); do_calib(params, current_freq);
current_freq = high_freq; + params = &freq_params[current_freq]; set_dram_voltage_by_freq(current_freq); dfs_init_for_calibration(params, current_freq); do_calib(params, current_freq); diff --git a/src/soc/mediatek/mt8183/include/soc/emi.h b/src/soc/mediatek/mt8183/include/soc/emi.h index 264d918..07c4827 100644 --- a/src/soc/mediatek/mt8183/include/soc/emi.h +++ b/src/soc/mediatek/mt8183/include/soc/emi.h @@ -21,10 +21,42 @@ #include <soc/dramc_common_mt8183.h>
struct sdram_params { - u32 impedance[2][4]; + bool have_full_k_params; + u16 frequency; u8 wr_level[CHANNEL_MAX][RANK_MAX][DQS_NUMBER]; - u8 cbt_cs[CHANNEL_MAX][RANK_MAX]; - u8 cbt_mr12[CHANNEL_MAX][RANK_MAX]; + + /* DUTY */ + s8 duty_clk_delay[CHANNEL_MAX]; + s8 duty_dqs_delay[CHANNEL_MAX][DQS_NUMBER]; + + /* CBT */ + u8 cbt_final_vref[CHANNEL_MAX][RANK_MAX]; + u8 cbt_clk_dly[CHANNEL_MAX][RANK_MAX]; + u8 cbt_cmd_dly[CHANNEL_MAX][RANK_MAX]; + u8 cbt_cs_dly[CHANNEL_MAX][RANK_MAX]; + + /* Gating */ + u8 gating2T[CHANNEL_MAX][RANK_MAX][DQS_NUMBER]; + u8 gating05T[CHANNEL_MAX][RANK_MAX][DQS_NUMBER]; + u8 gating_fine_tune[CHANNEL_MAX][RANK_MAX][DQS_NUMBER]; + u8 gating_pass_count[CHANNEL_MAX][RANK_MAX][DQS_NUMBER]; + + /* TX perbit */ + u8 tx_vref[CHANNEL_MAX][RANK_MAX]; + u16 tx_center_min[CHANNEL_MAX][RANK_MAX][DQS_NUMBER]; + u16 tx_center_max[CHANNEL_MAX][RANK_MAX][DQS_NUMBER]; + u16 tx_win_center[CHANNEL_MAX][RANK_MAX][DQ_DATA_WIDTH]; + u16 tx_first_pass[CHANNEL_MAX][RANK_MAX][DQ_DATA_WIDTH]; + u16 tx_last_pass[CHANNEL_MAX][RANK_MAX][DQ_DATA_WIDTH]; + + /* datlat */ + u8 rx_datlat[CHANNEL_MAX][RANK_MAX]; + + /* RX perbit */ + u8 rx_vref[CHANNEL_MAX]; + s16 rx_firspass[CHANNEL_MAX][RANK_MAX][DQ_DATA_WIDTH]; + u8 rx_lastpass[CHANNEL_MAX][RANK_MAX][DQ_DATA_WIDTH]; + u32 emi_cona_val; u32 emi_conh_val; u32 emi_conf_val; @@ -47,7 +79,7 @@ size_t sdram_size(void); const struct sdram_params *get_sdram_config(void); void enable_emi_dcm(void); -void mt_set_emi(const struct sdram_params *params); -void mt_mem_init(const struct sdram_params *params); +void mt_set_emi(const struct sdram_params *freq_params); +void mt_mem_init(const struct sdram_params *freq_params);
#endif /* SOC_MEDIATEK_MT8183_EMI_H */ diff --git a/src/soc/mediatek/mt8183/memory.c b/src/soc/mediatek/mt8183/memory.c index b2c7441..67f6c65 100644 --- a/src/soc/mediatek/mt8183/memory.c +++ b/src/soc/mediatek/mt8183/memory.c @@ -19,12 +19,12 @@ #include <soc/emi.h> #include <symbols.h>
-void mt_mem_init(const struct sdram_params *params) +void mt_mem_init(const struct sdram_params *freq_params) { u64 rank_size[RANK_MAX];
/* memory calibration */ - mt_set_emi(params); + mt_set_emi(freq_params);
if (CONFIG(MEMORY_TEST)) { size_t r;
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use calibration result do fast calibration ......................................................................
Patch Set 1:
(17 comments)
https://review.coreboot.org/c/coreboot/+/35164/1/src/soc/mediatek/mt8183/dra... File src/soc/mediatek/mt8183/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/35164/1/src/soc/mediatek/mt8183/dra... PS1, Line 938: (dly_coarse_large_rodt_p1 << 4) | (dly_coarse_large_rodt_p1 << 12) | line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/1/src/soc/mediatek/mt8183/dra... PS1, Line 939: (dly_coarse_large_rodt_p1 << 20) | (dly_coarse_large_rodt_p1 << 28)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/1/src/soc/mediatek/mt8183/dra... PS1, Line 944: (dly_coarse_0p5t_rodt_p1 << 4) | (dly_coarse_0p5t_rodt_p1 << 12) | line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/1/src/soc/mediatek/mt8183/dra... PS1, Line 945: (dly_coarse_0p5t_rodt_p1 << 20) | (dly_coarse_0p5t_rodt_p1 << 28)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/1/src/soc/mediatek/mt8183/dra... PS1, Line 947: for (u8 dly_fine_xt = 0; dly_fine_xt < DQS_GW_FINE_END; dly_fine_xt += 4) { line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/1/src/soc/mediatek/mt8183/dra... PS1, Line 991: dly_coarse_large, dly_coarse_0p5t, pass_begin, pass_count, line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/1/src/soc/mediatek/mt8183/dra... PS1, Line 1581: vref_dly[index].win_center = params->tx_win_center[chn][rank][index]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/1/src/soc/mediatek/mt8183/dra... PS1, Line 1582: vref_dly[index].best_first = params->tx_first_pass[chn][rank][index]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/1/src/soc/mediatek/mt8183/dra... PS1, Line 1583: vref_dly[index].best_last = params->tx_last_pass[chn][rank][index]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/1/src/soc/mediatek/mt8183/dra... PS1, Line 1594: center_dly[byte].min_center = vref_dly[index].win_center; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/1/src/soc/mediatek/mt8183/dra... PS1, Line 1596: center_dly[byte].max_center = vref_dly[index].win_center; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/1/src/soc/mediatek/mt8183/dra... PS1, Line 1758: dramc_set_tx_best_dly(chn, rank, bypass_tx,vref_dly.perbit_dly, type, space required after that ',' (ctx:VxV)
https://review.coreboot.org/c/coreboot/+/35164/1/src/soc/mediatek/mt8183/dra... PS1, Line 1796: if (params->have_full_k_params && (type == RX_WIN_RD_DQC ||type == RX_WIN_TEST_ENG)) { line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/1/src/soc/mediatek/mt8183/dra... PS1, Line 1796: if (params->have_full_k_params && (type == RX_WIN_RD_DQC ||type == RX_WIN_TEST_ENG)) { spaces required around that '||' (ctx:WxV)
https://review.coreboot.org/c/coreboot/+/35164/1/src/soc/mediatek/mt8183/dra... PS1, Line 1799: win_perbit[bit].best_first = params->rx_firspass[chn][rank][bit]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/1/src/soc/mediatek/mt8183/dra... PS1, Line 1813: /* pass window bigger than 7, consider as real pass window */ line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/1/src/soc/mediatek/mt8183/dra... PS1, Line 1841: if (dramk_calc_best_vref(type, vref_use, &vref_dly, win_perbit, &win_min_max)) line over 96 characters
Hello Julius Werner, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35164
to look at the new patch set (#3).
Change subject: mediatek/mt8183: Use calibration result do fast calibration ......................................................................
mediatek/mt8183: Use calibration result do fast calibration
Load calibration result from flash, if result was correct, use this calibration result do fast calibration to reduce the bootup time.
BUG=b:80501386 BRANCH=none TEST=Boots correctly on Kukui.
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/dramc_pi_api.h M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/memory.c 6 files changed, 401 insertions(+), 261 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35164/3
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use calibration result do fast calibration ......................................................................
Patch Set 3:
(16 comments)
https://review.coreboot.org/c/coreboot/+/35164/3/src/soc/mediatek/mt8183/dra... File src/soc/mediatek/mt8183/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/35164/3/src/soc/mediatek/mt8183/dra... PS3, Line 951: (dly_coarse_large_rodt_p1 << 4) | (dly_coarse_large_rodt_p1 << 12) | line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/3/src/soc/mediatek/mt8183/dra... PS3, Line 952: (dly_coarse_large_rodt_p1 << 20) | (dly_coarse_large_rodt_p1 << 28)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/3/src/soc/mediatek/mt8183/dra... PS3, Line 957: (dly_coarse_0p5t_rodt_p1 << 4) | (dly_coarse_0p5t_rodt_p1 << 12) | line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/3/src/soc/mediatek/mt8183/dra... PS3, Line 958: (dly_coarse_0p5t_rodt_p1 << 20) | (dly_coarse_0p5t_rodt_p1 << 28)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/3/src/soc/mediatek/mt8183/dra... PS3, Line 960: for (u8 dly_fine_xt = 0; dly_fine_xt < DQS_GW_FINE_END; dly_fine_xt += 4) { line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/3/src/soc/mediatek/mt8183/dra... PS3, Line 1004: dly_coarse_large, dly_coarse_0p5t, pass_begin, pass_count, line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/3/src/soc/mediatek/mt8183/dra... PS3, Line 1611: vref_dly[index].win_center = params->tx_win_center[chn][rank][index]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/3/src/soc/mediatek/mt8183/dra... PS3, Line 1612: vref_dly[index].best_first = params->tx_first_pass[chn][rank][index]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/3/src/soc/mediatek/mt8183/dra... PS3, Line 1613: vref_dly[index].best_last = params->tx_last_pass[chn][rank][index]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/3/src/soc/mediatek/mt8183/dra... PS3, Line 1624: center_dly[byte].min_center = vref_dly[index].win_center; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/3/src/soc/mediatek/mt8183/dra... PS3, Line 1626: center_dly[byte].max_center = vref_dly[index].win_center; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/3/src/soc/mediatek/mt8183/dra... PS3, Line 1788: dramc_set_tx_best_dly(chn, rank, bypass_tx,vref_dly.perbit_dly, type, space required after that ',' (ctx:VxV)
https://review.coreboot.org/c/coreboot/+/35164/3/src/soc/mediatek/mt8183/dra... PS3, Line 1826: if (have_calibration_params(params) && (type == RX_WIN_RD_DQC || type == RX_WIN_TEST_ENG)) { line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/3/src/soc/mediatek/mt8183/dra... PS3, Line 1829: win_perbit[bit].best_first = params->rx_firspass[chn][rank][bit]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/3/src/soc/mediatek/mt8183/dra... PS3, Line 1843: /* pass window bigger than 7, consider as real pass window */ line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/3/src/soc/mediatek/mt8183/dra... PS3, Line 1871: if (dramk_calc_best_vref(type, vref_use, &vref_dly, win_perbit, &win_min_max)) line over 96 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use calibration result do fast calibration ......................................................................
Patch Set 4:
(16 comments)
https://review.coreboot.org/c/coreboot/+/35164/4/src/soc/mediatek/mt8183/dra... File src/soc/mediatek/mt8183/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/35164/4/src/soc/mediatek/mt8183/dra... PS4, Line 951: (dly_coarse_large_rodt_p1 << 4) | (dly_coarse_large_rodt_p1 << 12) | line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/4/src/soc/mediatek/mt8183/dra... PS4, Line 952: (dly_coarse_large_rodt_p1 << 20) | (dly_coarse_large_rodt_p1 << 28)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/4/src/soc/mediatek/mt8183/dra... PS4, Line 957: (dly_coarse_0p5t_rodt_p1 << 4) | (dly_coarse_0p5t_rodt_p1 << 12) | line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/4/src/soc/mediatek/mt8183/dra... PS4, Line 958: (dly_coarse_0p5t_rodt_p1 << 20) | (dly_coarse_0p5t_rodt_p1 << 28)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/4/src/soc/mediatek/mt8183/dra... PS4, Line 960: for (u8 dly_fine_xt = 0; dly_fine_xt < DQS_GW_FINE_END; dly_fine_xt += 4) { line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/4/src/soc/mediatek/mt8183/dra... PS4, Line 1004: dly_coarse_large, dly_coarse_0p5t, pass_begin, pass_count, line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/4/src/soc/mediatek/mt8183/dra... PS4, Line 1611: vref_dly[index].win_center = params->tx_win_center[chn][rank][index]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/4/src/soc/mediatek/mt8183/dra... PS4, Line 1612: vref_dly[index].best_first = params->tx_first_pass[chn][rank][index]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/4/src/soc/mediatek/mt8183/dra... PS4, Line 1613: vref_dly[index].best_last = params->tx_last_pass[chn][rank][index]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/4/src/soc/mediatek/mt8183/dra... PS4, Line 1624: center_dly[byte].min_center = vref_dly[index].win_center; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/4/src/soc/mediatek/mt8183/dra... PS4, Line 1626: center_dly[byte].max_center = vref_dly[index].win_center; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/4/src/soc/mediatek/mt8183/dra... PS4, Line 1788: dramc_set_tx_best_dly(chn, rank, bypass_tx,vref_dly.perbit_dly, type, space required after that ',' (ctx:VxV)
https://review.coreboot.org/c/coreboot/+/35164/4/src/soc/mediatek/mt8183/dra... PS4, Line 1826: if (have_calibration_params(params) && (type == RX_WIN_RD_DQC || type == RX_WIN_TEST_ENG)) { line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/4/src/soc/mediatek/mt8183/dra... PS4, Line 1829: win_perbit[bit].best_first = params->rx_firspass[chn][rank][bit]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/4/src/soc/mediatek/mt8183/dra... PS4, Line 1843: /* pass window bigger than 7, consider as real pass window */ line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/4/src/soc/mediatek/mt8183/dra... PS4, Line 1871: if (dramk_calc_best_vref(type, vref_use, &vref_dly, win_perbit, &win_min_max)) line over 96 characters
Yu-Ping Wu has uploaded a new patch set (#5) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use calibration result do fast calibration ......................................................................
mediatek/mt8183: Use calibration result do fast calibration
Load calibration result from flash, if result was correct, use this calibration result do fast calibration to reduce the bootup time.
BUG=b:80501386 BRANCH=none TEST=Boots correctly on Kukui.
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/dramc_pi_api.h M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/memory.c 6 files changed, 403 insertions(+), 261 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35164/5
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use calibration result do fast calibration ......................................................................
Patch Set 5:
(16 comments)
https://review.coreboot.org/c/coreboot/+/35164/5/src/soc/mediatek/mt8183/dra... File src/soc/mediatek/mt8183/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/35164/5/src/soc/mediatek/mt8183/dra... PS5, Line 951: (dly_coarse_large_rodt_p1 << 4) | (dly_coarse_large_rodt_p1 << 12) | line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/5/src/soc/mediatek/mt8183/dra... PS5, Line 952: (dly_coarse_large_rodt_p1 << 20) | (dly_coarse_large_rodt_p1 << 28)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/5/src/soc/mediatek/mt8183/dra... PS5, Line 957: (dly_coarse_0p5t_rodt_p1 << 4) | (dly_coarse_0p5t_rodt_p1 << 12) | line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/5/src/soc/mediatek/mt8183/dra... PS5, Line 958: (dly_coarse_0p5t_rodt_p1 << 20) | (dly_coarse_0p5t_rodt_p1 << 28)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/5/src/soc/mediatek/mt8183/dra... PS5, Line 960: for (u8 dly_fine_xt = 0; dly_fine_xt < DQS_GW_FINE_END; dly_fine_xt += 4) { line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/5/src/soc/mediatek/mt8183/dra... PS5, Line 1004: dly_coarse_large, dly_coarse_0p5t, pass_begin, pass_count, line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/5/src/soc/mediatek/mt8183/dra... PS5, Line 1611: vref_dly[index].win_center = params->tx_win_center[chn][rank][index]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/5/src/soc/mediatek/mt8183/dra... PS5, Line 1612: vref_dly[index].best_first = params->tx_first_pass[chn][rank][index]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/5/src/soc/mediatek/mt8183/dra... PS5, Line 1613: vref_dly[index].best_last = params->tx_last_pass[chn][rank][index]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/5/src/soc/mediatek/mt8183/dra... PS5, Line 1624: center_dly[byte].min_center = vref_dly[index].win_center; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/5/src/soc/mediatek/mt8183/dra... PS5, Line 1626: center_dly[byte].max_center = vref_dly[index].win_center; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/5/src/soc/mediatek/mt8183/dra... PS5, Line 1788: dramc_set_tx_best_dly(chn, rank, bypass_tx,vref_dly.perbit_dly, type, space required after that ',' (ctx:VxV)
https://review.coreboot.org/c/coreboot/+/35164/5/src/soc/mediatek/mt8183/dra... PS5, Line 1826: if (have_calibration_params(params) && (type == RX_WIN_RD_DQC || type == RX_WIN_TEST_ENG)) { line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/5/src/soc/mediatek/mt8183/dra... PS5, Line 1829: win_perbit[bit].best_first = params->rx_firspass[chn][rank][bit]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/5/src/soc/mediatek/mt8183/dra... PS5, Line 1843: /* pass window bigger than 7, consider as real pass window */ line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/5/src/soc/mediatek/mt8183/dra... PS5, Line 1871: if (dramk_calc_best_vref(type, vref_use, &vref_dly, win_perbit, &win_min_max)) line over 96 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use calibration result do fast calibration ......................................................................
Patch Set 7:
(16 comments)
https://review.coreboot.org/c/coreboot/+/35164/7/src/soc/mediatek/mt8183/dra... File src/soc/mediatek/mt8183/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/35164/7/src/soc/mediatek/mt8183/dra... PS7, Line 951: (dly_coarse_large_rodt_p1 << 4) | (dly_coarse_large_rodt_p1 << 12) | line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/7/src/soc/mediatek/mt8183/dra... PS7, Line 952: (dly_coarse_large_rodt_p1 << 20) | (dly_coarse_large_rodt_p1 << 28)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/7/src/soc/mediatek/mt8183/dra... PS7, Line 957: (dly_coarse_0p5t_rodt_p1 << 4) | (dly_coarse_0p5t_rodt_p1 << 12) | line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/7/src/soc/mediatek/mt8183/dra... PS7, Line 958: (dly_coarse_0p5t_rodt_p1 << 20) | (dly_coarse_0p5t_rodt_p1 << 28)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/7/src/soc/mediatek/mt8183/dra... PS7, Line 960: for (u8 dly_fine_xt = 0; dly_fine_xt < DQS_GW_FINE_END; dly_fine_xt += 4) { line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/7/src/soc/mediatek/mt8183/dra... PS7, Line 1004: dly_coarse_large, dly_coarse_0p5t, pass_begin, pass_count, line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/7/src/soc/mediatek/mt8183/dra... PS7, Line 1611: vref_dly[index].win_center = params->tx_win_center[chn][rank][index]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/7/src/soc/mediatek/mt8183/dra... PS7, Line 1612: vref_dly[index].best_first = params->tx_first_pass[chn][rank][index]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/7/src/soc/mediatek/mt8183/dra... PS7, Line 1613: vref_dly[index].best_last = params->tx_last_pass[chn][rank][index]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/7/src/soc/mediatek/mt8183/dra... PS7, Line 1624: center_dly[byte].min_center = vref_dly[index].win_center; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/7/src/soc/mediatek/mt8183/dra... PS7, Line 1626: center_dly[byte].max_center = vref_dly[index].win_center; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/7/src/soc/mediatek/mt8183/dra... PS7, Line 1788: dramc_set_tx_best_dly(chn, rank, bypass_tx,vref_dly.perbit_dly, type, space required after that ',' (ctx:VxV)
https://review.coreboot.org/c/coreboot/+/35164/7/src/soc/mediatek/mt8183/dra... PS7, Line 1826: if (have_calibration_params(params) && (type == RX_WIN_RD_DQC || type == RX_WIN_TEST_ENG)) { line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/7/src/soc/mediatek/mt8183/dra... PS7, Line 1829: win_perbit[bit].best_first = params->rx_firspass[chn][rank][bit]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/7/src/soc/mediatek/mt8183/dra... PS7, Line 1843: /* pass window bigger than 7, consider as real pass window */ line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/7/src/soc/mediatek/mt8183/dra... PS7, Line 1871: if (dramk_calc_best_vref(type, vref_use, &vref_dly, win_perbit, &win_min_max)) line over 96 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use calibration result do fast calibration ......................................................................
Patch Set 8:
(16 comments)
https://review.coreboot.org/c/coreboot/+/35164/8/src/soc/mediatek/mt8183/dra... File src/soc/mediatek/mt8183/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/35164/8/src/soc/mediatek/mt8183/dra... PS8, Line 951: (dly_coarse_large_rodt_p1 << 4) | (dly_coarse_large_rodt_p1 << 12) | line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/8/src/soc/mediatek/mt8183/dra... PS8, Line 952: (dly_coarse_large_rodt_p1 << 20) | (dly_coarse_large_rodt_p1 << 28)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/8/src/soc/mediatek/mt8183/dra... PS8, Line 957: (dly_coarse_0p5t_rodt_p1 << 4) | (dly_coarse_0p5t_rodt_p1 << 12) | line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/8/src/soc/mediatek/mt8183/dra... PS8, Line 958: (dly_coarse_0p5t_rodt_p1 << 20) | (dly_coarse_0p5t_rodt_p1 << 28)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/8/src/soc/mediatek/mt8183/dra... PS8, Line 960: for (u8 dly_fine_xt = 0; dly_fine_xt < DQS_GW_FINE_END; dly_fine_xt += 4) { line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/8/src/soc/mediatek/mt8183/dra... PS8, Line 1004: dly_coarse_large, dly_coarse_0p5t, pass_begin, pass_count, line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/8/src/soc/mediatek/mt8183/dra... PS8, Line 1611: vref_dly[index].win_center = params->tx_win_center[chn][rank][index]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/8/src/soc/mediatek/mt8183/dra... PS8, Line 1612: vref_dly[index].best_first = params->tx_first_pass[chn][rank][index]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/8/src/soc/mediatek/mt8183/dra... PS8, Line 1613: vref_dly[index].best_last = params->tx_last_pass[chn][rank][index]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/8/src/soc/mediatek/mt8183/dra... PS8, Line 1624: center_dly[byte].min_center = vref_dly[index].win_center; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/8/src/soc/mediatek/mt8183/dra... PS8, Line 1626: center_dly[byte].max_center = vref_dly[index].win_center; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/8/src/soc/mediatek/mt8183/dra... PS8, Line 1788: dramc_set_tx_best_dly(chn, rank, bypass_tx,vref_dly.perbit_dly, type, space required after that ',' (ctx:VxV)
https://review.coreboot.org/c/coreboot/+/35164/8/src/soc/mediatek/mt8183/dra... PS8, Line 1826: if (have_calibration_params(params) && (type == RX_WIN_RD_DQC || type == RX_WIN_TEST_ENG)) { line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/8/src/soc/mediatek/mt8183/dra... PS8, Line 1829: win_perbit[bit].best_first = params->rx_firspass[chn][rank][bit]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/8/src/soc/mediatek/mt8183/dra... PS8, Line 1843: /* pass window bigger than 7, consider as real pass window */ line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/8/src/soc/mediatek/mt8183/dra... PS8, Line 1871: if (dramk_calc_best_vref(type, vref_use, &vref_dly, win_perbit, &win_min_max)) line over 96 characters
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use calibration result do fast calibration ......................................................................
Patch Set 8:
(3 comments)
https://review.coreboot.org/c/coreboot/+/35164/7/src/soc/mediatek/mt8183/emi... File src/soc/mediatek/mt8183/emi.c:
https://review.coreboot.org/c/coreboot/+/35164/7/src/soc/mediatek/mt8183/emi... PS7, Line 370: if DUAL_FREQ_K : current_freqsel = freq_tbl[DRAM_DFS_SHUFFLE_3]; : params = &freq_params[DRAM_DFS_SHUFFLE_3]; : #else : current_freqsel = freq_tbl[DRAM_DFS_SHUFFLE_1]; : params = &freq_params[DRAM_DFS_SHUFFLE_1]; : #endif int freq_index = DRAM_DFS_SHUFFULE_1;
if (CONFIG(MT8183_DRAM_DUAL_FREQ)) freq_index = DRAM_DFS_SHUFFLE_3;
current_freqsel = freq_tbl[freq_index]; params = &freq_params[freq_index];
https://review.coreboot.org/c/coreboot/+/35164/7/src/soc/mediatek/mt8183/emi... PS7, Line 381: #if DUAL_FREQ_K isn't this 'multiple frequency' than 'dual'?
I think we should change this to
static void dram_calibrate(int shuffle) { const u8 *const freq_tbl = freq_shuffle;
if (CONFIG(MT8183_DRAM_EMCP)) { freq_tbl = freq_shuffle_emcp; }
current_freqsel = freq_tbl[shuffle]; params = &freq_params[shuffle];
dfs_init_for_calibration(params, current_freqsel); do_calib(params, current_freqsel); }
void mt_set_emi(...) { if (CONFIG(MT8183_DRAM_MULTI_FREQUENCY)) { dram_calibrate(DRAM_DFS_SHUFFLE_3); dram_calibrate(DRAM_DFS_SHUFFLE_2); } dram_calibrate(DRAM_DFS_SHUFFLE_1); after_calib(); }
https://review.coreboot.org/c/coreboot/+/35164/7/src/soc/mediatek/mt8183/inc... File src/soc/mediatek/mt8183/include/soc/dramc_pi_api.h:
https://review.coreboot.org/c/coreboot/+/35164/7/src/soc/mediatek/mt8183/inc... PS7, Line 41: #define DUAL_FREQ_K 0 Move this to a KConfig.
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use calibration result do fast calibration ......................................................................
Patch Set 9:
(16 comments)
https://review.coreboot.org/c/coreboot/+/35164/9/src/soc/mediatek/mt8183/dra... File src/soc/mediatek/mt8183/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/35164/9/src/soc/mediatek/mt8183/dra... PS9, Line 951: (dly_coarse_large_rodt_p1 << 4) | (dly_coarse_large_rodt_p1 << 12) | line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/9/src/soc/mediatek/mt8183/dra... PS9, Line 952: (dly_coarse_large_rodt_p1 << 20) | (dly_coarse_large_rodt_p1 << 28)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/9/src/soc/mediatek/mt8183/dra... PS9, Line 957: (dly_coarse_0p5t_rodt_p1 << 4) | (dly_coarse_0p5t_rodt_p1 << 12) | line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/9/src/soc/mediatek/mt8183/dra... PS9, Line 958: (dly_coarse_0p5t_rodt_p1 << 20) | (dly_coarse_0p5t_rodt_p1 << 28)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/9/src/soc/mediatek/mt8183/dra... PS9, Line 960: for (u8 dly_fine_xt = 0; dly_fine_xt < DQS_GW_FINE_END; dly_fine_xt += 4) { line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/9/src/soc/mediatek/mt8183/dra... PS9, Line 1004: dly_coarse_large, dly_coarse_0p5t, pass_begin, pass_count, line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/9/src/soc/mediatek/mt8183/dra... PS9, Line 1611: vref_dly[index].win_center = params->tx_win_center[chn][rank][index]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/9/src/soc/mediatek/mt8183/dra... PS9, Line 1612: vref_dly[index].best_first = params->tx_first_pass[chn][rank][index]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/9/src/soc/mediatek/mt8183/dra... PS9, Line 1613: vref_dly[index].best_last = params->tx_last_pass[chn][rank][index]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/9/src/soc/mediatek/mt8183/dra... PS9, Line 1624: center_dly[byte].min_center = vref_dly[index].win_center; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/9/src/soc/mediatek/mt8183/dra... PS9, Line 1626: center_dly[byte].max_center = vref_dly[index].win_center; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/9/src/soc/mediatek/mt8183/dra... PS9, Line 1788: dramc_set_tx_best_dly(chn, rank, bypass_tx,vref_dly.perbit_dly, type, space required after that ',' (ctx:VxV)
https://review.coreboot.org/c/coreboot/+/35164/9/src/soc/mediatek/mt8183/dra... PS9, Line 1826: if (have_calibration_params(params) && (type == RX_WIN_RD_DQC || type == RX_WIN_TEST_ENG)) { line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/9/src/soc/mediatek/mt8183/dra... PS9, Line 1829: win_perbit[bit].best_first = params->rx_firspass[chn][rank][bit]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/9/src/soc/mediatek/mt8183/dra... PS9, Line 1843: /* pass window bigger than 7, consider as real pass window */ line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/9/src/soc/mediatek/mt8183/dra... PS9, Line 1871: if (dramk_calc_best_vref(type, vref_use, &vref_dly, win_perbit, &win_min_max)) line over 96 characters
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use calibration result do fast calibration ......................................................................
Patch Set 10:
(16 comments)
https://review.coreboot.org/c/coreboot/+/35164/10/src/soc/mediatek/mt8183/dr... File src/soc/mediatek/mt8183/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/35164/10/src/soc/mediatek/mt8183/dr... PS10, Line 951: (dly_coarse_large_rodt_p1 << 4) | (dly_coarse_large_rodt_p1 << 12) | line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/10/src/soc/mediatek/mt8183/dr... PS10, Line 952: (dly_coarse_large_rodt_p1 << 20) | (dly_coarse_large_rodt_p1 << 28)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/10/src/soc/mediatek/mt8183/dr... PS10, Line 957: (dly_coarse_0p5t_rodt_p1 << 4) | (dly_coarse_0p5t_rodt_p1 << 12) | line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/10/src/soc/mediatek/mt8183/dr... PS10, Line 958: (dly_coarse_0p5t_rodt_p1 << 20) | (dly_coarse_0p5t_rodt_p1 << 28)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/10/src/soc/mediatek/mt8183/dr... PS10, Line 960: for (u8 dly_fine_xt = 0; dly_fine_xt < DQS_GW_FINE_END; dly_fine_xt += 4) { line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/10/src/soc/mediatek/mt8183/dr... PS10, Line 1004: dly_coarse_large, dly_coarse_0p5t, pass_begin, pass_count, line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/10/src/soc/mediatek/mt8183/dr... PS10, Line 1611: vref_dly[index].win_center = params->tx_win_center[chn][rank][index]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/10/src/soc/mediatek/mt8183/dr... PS10, Line 1612: vref_dly[index].best_first = params->tx_first_pass[chn][rank][index]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/10/src/soc/mediatek/mt8183/dr... PS10, Line 1613: vref_dly[index].best_last = params->tx_last_pass[chn][rank][index]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/10/src/soc/mediatek/mt8183/dr... PS10, Line 1624: center_dly[byte].min_center = vref_dly[index].win_center; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/10/src/soc/mediatek/mt8183/dr... PS10, Line 1626: center_dly[byte].max_center = vref_dly[index].win_center; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/10/src/soc/mediatek/mt8183/dr... PS10, Line 1788: dramc_set_tx_best_dly(chn, rank, bypass_tx,vref_dly.perbit_dly, type, space required after that ',' (ctx:VxV)
https://review.coreboot.org/c/coreboot/+/35164/10/src/soc/mediatek/mt8183/dr... PS10, Line 1826: if (have_calibration_params(params) && (type == RX_WIN_RD_DQC || type == RX_WIN_TEST_ENG)) { line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/10/src/soc/mediatek/mt8183/dr... PS10, Line 1829: win_perbit[bit].best_first = params->rx_firspass[chn][rank][bit]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/10/src/soc/mediatek/mt8183/dr... PS10, Line 1843: /* pass window bigger than 7, consider as real pass window */ line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/10/src/soc/mediatek/mt8183/dr... PS10, Line 1871: if (dramk_calc_best_vref(type, vref_use, &vref_dly, win_perbit, &win_min_max)) line over 96 characters
Hello Yu-Ping Wu, Julius Werner, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35164
to look at the new patch set (#11).
Change subject: mediatek/mt8183: Use calibration result do fast calibration ......................................................................
mediatek/mt8183: Use calibration result do fast calibration
Load calibration result from flash, if result was correct, use this calibration result do fast calibration to reduce the bootup time.
BUG=b:80501386 BRANCH=none TEST=Boots correctly on Kukui.
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/dramc_pi_api.h M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/memory.c 6 files changed, 401 insertions(+), 261 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35164/11
Hello Yu-Ping Wu, Julius Werner, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35164
to look at the new patch set (#12).
Change subject: mediatek/mt8183: Use calibration result do fast calibration ......................................................................
mediatek/mt8183: Use calibration result do fast calibration
Load calibration result from flash, if result was correct, use this calibration result do fast calibration to reduce the bootup time.
BUG=b:80501386 BRANCH=none TEST=Boots correctly on Kukui.
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/dramc_common_mt8183.h M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/memory.c 6 files changed, 405 insertions(+), 268 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35164/12
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use calibration result do fast calibration ......................................................................
Patch Set 12:
(15 comments)
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... File src/soc/mediatek/mt8183/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 951: (dly_coarse_large_rodt_p1 << 4) | (dly_coarse_large_rodt_p1 << 12) | line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 952: (dly_coarse_large_rodt_p1 << 20) | (dly_coarse_large_rodt_p1 << 28)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 957: (dly_coarse_0p5t_rodt_p1 << 4) | (dly_coarse_0p5t_rodt_p1 << 12) | line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 958: (dly_coarse_0p5t_rodt_p1 << 20) | (dly_coarse_0p5t_rodt_p1 << 28)); line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 960: for (u8 dly_fine_xt = 0; dly_fine_xt < DQS_GW_FINE_END; dly_fine_xt += 4) { line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 1004: dly_coarse_large, dly_coarse_0p5t, pass_begin, pass_count, line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 1611: vref_dly[index].win_center = params->tx_win_center[chn][rank][index]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 1612: vref_dly[index].best_first = params->tx_first_pass[chn][rank][index]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 1613: vref_dly[index].best_last = params->tx_last_pass[chn][rank][index]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 1624: center_dly[byte].min_center = vref_dly[index].win_center; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 1626: center_dly[byte].max_center = vref_dly[index].win_center; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 1826: if (have_calibration_params(params) && (type == RX_WIN_RD_DQC || type == RX_WIN_TEST_ENG)) { line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 1829: win_perbit[bit].best_first = params->rx_firspass[chn][rank][bit]; line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 1843: /* pass window bigger than 7, consider as real pass window */ line over 96 characters
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 1871: if (dramk_calc_best_vref(type, vref_use, &vref_dly, win_perbit, &win_min_max)) line over 96 characters
Huayang Duan has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use calibration result do fast calibration ......................................................................
Patch Set 12:
(3 comments)
https://review.coreboot.org/c/coreboot/+/35164/7/src/soc/mediatek/mt8183/emi... File src/soc/mediatek/mt8183/emi.c:
https://review.coreboot.org/c/coreboot/+/35164/7/src/soc/mediatek/mt8183/emi... PS7, Line 370: if DUAL_FREQ_K : current_freqsel = freq_tbl[DRAM_DFS_SHUFFLE_3]; : params = &freq_params[DRAM_DFS_SHUFFLE_3]; : #else : current_freqsel = freq_tbl[DRAM_DFS_SHUFFLE_1]; : params = &freq_params[DRAM_DFS_SHUFFLE_1]; : #endif
int freq_index = DRAM_DFS_SHUFFULE_1; […]
Done
https://review.coreboot.org/c/coreboot/+/35164/7/src/soc/mediatek/mt8183/emi... PS7, Line 381: #if DUAL_FREQ_K
isn't this 'multiple frequency' than 'dual'? […]
Done
https://review.coreboot.org/c/coreboot/+/35164/7/src/soc/mediatek/mt8183/inc... File src/soc/mediatek/mt8183/include/soc/dramc_pi_api.h:
https://review.coreboot.org/c/coreboot/+/35164/7/src/soc/mediatek/mt8183/inc... PS7, Line 41: #define DUAL_FREQ_K 0
Move this to a KConfig.
Done
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use calibration result do fast calibration ......................................................................
Patch Set 12:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... File src/soc/mediatek/mt8183/dramc_init_setting.c:
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 658: die("Invalid DDR frequency group %u\n", freq_group); Wrong indentation
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use calibration result do fast calibration ......................................................................
Patch Set 12:
(13 comments)
This is a huge diffstat. Thank you. Please document the implementation in comments and/or the commit message.
To reduce the indentation level, several code blocks should be factored out into functions.
Lastly, measurements should be done using the stopwatch framework.
https://review.coreboot.org/c/coreboot/+/35164/12//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/35164/12//COMMIT_MSG@7 PS12, Line 7: mediatek/mt8183: Use calibration result do fast calibration *to* looks wrong:
… for faster calibration
or
Use cached calibration for faster boot
https://review.coreboot.org/c/coreboot/+/35164/12//COMMIT_MSG@9 PS12, Line 9: , if . If
https://review.coreboot.org/c/coreboot/+/35164/12//COMMIT_MSG@10 PS12, Line 10: use this calibration result do fast calibration to reduce the bootup time. Some words fit on the line above (75 characters).
https://review.coreboot.org/c/coreboot/+/35164/12//COMMIT_MSG@10 PS12, Line 10: do for
https://review.coreboot.org/c/coreboot/+/35164/12//COMMIT_MSG@11 PS12, Line 11: Please explain the implementation. What is the shuffling about?
Please give specific numbers how much the time is reduced.
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... File src/soc/mediatek/mt8183/dramc_init_setting.c:
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 616: dramc_dbg("bypass duty calibration\n"); … and use cached calibration data
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 618: u8 Why u8? Why not `int` or `unsigned int`?
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 620: dramc_duty_set_dqs_delay(chn, params->duty_dqs_delay[chn]); Please measure the times by using the stopwatch framework. (Maybe a separate commit.)
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... File src/soc/mediatek/mt8183/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 911: dramc_dbg("[bypass Gating]\n"); Why format it like that?
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 1617: for (u8 byte = 0; byte < DQS_NUMBER; byte++) { Can’t you factor this out into a dedicated function?
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 1759: dramc_dbg("bypass RX vref:%d\n", vref_begin); Please add a space after the colon.
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 1763: dramc_dbg("bypass TX vref:%d\n", vref_begin); Ditto.
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/em... File src/soc/mediatek/mt8183/emi.c:
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/em... PS12, Line 71: return false; Use ternary operator? Or even better, directly return:
return (params->calibration_result_start == PARAM_START_PATTERN && params->calibration_result_end == PARAM_END_PATTERN)
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use calibration result do fast calibration ......................................................................
Patch Set 12:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... File src/soc/mediatek/mt8183/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 912: { maybe move this to a standalone function so we don't need to have too many levels of indentation.
Huayang Duan has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use calibration result do fast calibration ......................................................................
Patch Set 12:
(1 comment)
below data tested under no DRAM calibration debug log full calibration clock 800 using 1434 msecs clock 1600 using 1032 msecs clock 1866 using 1384 msecs Total:3850 ms
partital calibration K finish with clock:800 mem init time of freq_shuffle:2, using 1349385 usecs K finish with clock:1600 mem init time of freq_shuffle:1, using 924698 usecs K finish with clock:1866 mem init time of freq_shuffle:0, using 1270089 usecs Total:3544172 usecs
fast calibration K finish with clock:800 mem init time of freq_shuffle:2, using 216663 usecs K finish with clock:1600 mem init time of freq_shuffle:1, using 328220 usecs K finish with clock:1866 mem init time of freq_shuffle:0, using 322612 usecs Total:867495 usecs
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/em... File src/soc/mediatek/mt8183/emi.c:
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/em... PS12, Line 71: return false;
Use ternary operator? Or even better, directly return: […]
Done
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use calibration result do fast calibration ......................................................................
Patch Set 12:
Thank you for the timings. Please add it to the commit message.
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use calibration result do fast calibration ......................................................................
Patch Set 12:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/in... File src/soc/mediatek/mt8183/include/soc/emi.h:
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/in... PS12, Line 26: sdram_params I think a better style is to isolate the part of serialization, for example
struct sdram_params_header { u32 magic; u16 version; u16 size; /* assume the params won't exceed 64k */ u32 checksum; /* checksum of the param parts, can be optional if we don't really care */ }
struct sdram_param { u16 frequency; /* in fact I'm not sure if this should better be in header of param itself */ u8 wr_level... }
When reading from signed CBFS, there's no need to have the header, just read and use.
When reading from cache, we should read header first, make sure the magic, version and size looks good, and read bytes specified by size, and then verify it (checksum).
In this way we can enforce a re-training when we have to update the DRAM calibration cached values.
Huayang Duan has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use calibration result do fast calibration ......................................................................
Patch Set 12:
(12 comments)
https://review.coreboot.org/c/coreboot/+/35164/12//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/35164/12//COMMIT_MSG@7 PS12, Line 7: mediatek/mt8183: Use calibration result do fast calibration
*to* looks wrong: […]
Done
https://review.coreboot.org/c/coreboot/+/35164/12//COMMIT_MSG@9 PS12, Line 9: , if
. If
Done
https://review.coreboot.org/c/coreboot/+/35164/12//COMMIT_MSG@10 PS12, Line 10: do
for
Done
https://review.coreboot.org/c/coreboot/+/35164/12//COMMIT_MSG@10 PS12, Line 10: use this calibration result do fast calibration to reduce the bootup time.
Some words fit on the line above (75 characters).
Done
https://review.coreboot.org/c/coreboot/+/35164/12//COMMIT_MSG@11 PS12, Line 11:
Please explain the implementation. What is the shuffling about? […]
Done
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... File src/soc/mediatek/mt8183/dramc_init_setting.c:
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 616: dramc_dbg("bypass duty calibration\n");
… and use cached calibration data
no need add here
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 618: u8
Why u8? Why not `int` or `unsigned int`?
why int better than u8?
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 620: dramc_duty_set_dqs_delay(chn, params->duty_dqs_delay[chn]);
Please measure the times by using the stopwatch framework. (Maybe a separate commit. […]
Done
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 658: die("Invalid DDR frequency group %u\n", freq_group);
Wrong indentation
Done
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... File src/soc/mediatek/mt8183/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 911: dramc_dbg("[bypass Gating]\n");
Why format it like that?
what is the meaning?
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 1759: dramc_dbg("bypass RX vref:%d\n", vref_begin);
Please add a space after the colon.
Done
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 1763: dramc_dbg("bypass TX vref:%d\n", vref_begin);
Ditto.
Done
Hello Yu-Ping Wu, Julius Werner, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35164
to look at the new patch set (#13).
Change subject: mediatek/mt8183: Use cached calibration result for fast boot ......................................................................
mediatek/mt8183: Use cached calibration result for fast boot
Load calibration params from flash. If the format of params was correct, use this calibration params for fast calibration to reduce the bootup time.
For bootup time of DRAM partital calibration calibration low frequency using 1349385 usecs calibration middle frequency using 924698 usecs calibration high frequency using 1270089 usecs total using 3544172 usecs
For bootup time of DRAM fast calibration calibration low frequency using 216663 usecs calibration middle frequency using 328220 usecs calibration high frequency using 322612 usecs total using 867495 usecs
BUG=b:80501386 BRANCH=none TEST=Boots correctly on Kukui.
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/dramc_common_mt8183.h M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/memory.c 6 files changed, 431 insertions(+), 295 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35164/13
Yu-Ping Wu has uploaded a new patch set (#14) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use cached calibration result for fast boot ......................................................................
mediatek/mt8183: Use cached calibration result for fast boot
Load calibration params from flash. If the format of params was correct, use this calibration params for fast calibration to reduce the bootup time.
For bootup time of DRAM partital calibration calibration low frequency using 1349385 usecs calibration middle frequency using 924698 usecs calibration high frequency using 1270089 usecs total using 3544172 usecs
For bootup time of DRAM fast calibration calibration low frequency using 216663 usecs calibration middle frequency using 328220 usecs calibration high frequency using 322612 usecs total using 867495 usecs
BUG=b:80501386 BRANCH=none TEST=Boots correctly on Kukui.
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/dramc_common_mt8183.h M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/memory.c 6 files changed, 431 insertions(+), 295 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35164/14
Hello Yu-Ping Wu, Julius Werner, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/35164
to look at the new patch set (#15).
Change subject: mediatek/mt8183: Use cached calibration result for fast boot ......................................................................
mediatek/mt8183: Use cached calibration result for fast boot
Load calibration params from flash. If the format of params was correct, use this calibration params for fast calibration to reduce the bootup time.
For bootup time of DRAM partital calibration calibration low frequency using 1349385 usecs calibration middle frequency using 924698 usecs calibration high frequency using 1270089 usecs total using 3544172 usecs
For bootup time of DRAM fast calibration calibration low frequency using 216663 usecs calibration middle frequency using 328220 usecs calibration high frequency using 322612 usecs total using 867495 usecs
BUG=b:80501386 BRANCH=none TEST=Boots correctly on Kukui.
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/dramc_common_mt8183.h M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/include/soc/memlayout.ld M src/soc/mediatek/mt8183/memory.c 7 files changed, 447 insertions(+), 295 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35164/15
Yu-Ping Wu has uploaded a new patch set (#16) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
mediatek/mt8183: Use cached calibration result for faster bootup
Load calibration params from flash. If the format of the params is correct, use these calibration params for fast calibration to reduce the bootup time.
Bootup time of DRAM partial calibration: - 1,349,385 usecs with low frequency - 924,698 usecs with middle frequency - 1,270,089 usecs with high frequency 3,544,172 usecs in total.
Bootup time of DRAM fast calibration: - 216,663 usecs with low frequency - 328,220 usecs with middle frequency - 322,612 usecs with high frequency 867,495 usecs in total.
BUG=b:80501386 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/include/soc/memlayout.ld M src/soc/mediatek/mt8183/memory.c 6 files changed, 427 insertions(+), 282 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35164/16
Yu-Ping Wu has uploaded a new patch set (#17) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
mediatek/mt8183: Use cached calibration result for faster bootup
Load calibration params from flash. If the format of the params is correct, use these calibration params for fast calibration to reduce the bootup time.
Bootup time of DRAM partial calibration: - 1,349,385 usecs with low frequency - 924,698 usecs with middle frequency - 1,270,089 usecs with high frequency 3,544,172 usecs in total.
Bootup time of DRAM fast calibration: - 216,663 usecs with low frequency - 328,220 usecs with middle frequency - 322,612 usecs with high frequency 867,495 usecs in total.
BUG=b:80501386 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/include/soc/memlayout.ld M src/soc/mediatek/mt8183/memory.c 6 files changed, 427 insertions(+), 282 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35164/17
Yu-Ping Wu has uploaded a new patch set (#18) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
mediatek/mt8183: Use cached calibration result for faster bootup
Load calibration params from flash. If the format of the params is correct, use these calibration params for fast calibration to reduce the bootup time.
Bootup time of DRAM partial calibration: - 1,349,385 usecs with low frequency - 924,698 usecs with middle frequency - 1,270,089 usecs with high frequency 3,544,172 usecs in total.
Bootup time of DRAM fast calibration: - 216,663 usecs with low frequency - 328,220 usecs with middle frequency - 322,612 usecs with high frequency 867,495 usecs in total.
BUG=b:80501386 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/include/soc/memlayout.ld M src/soc/mediatek/mt8183/memory.c 6 files changed, 426 insertions(+), 280 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35164/18
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
Patch Set 18:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35164/18//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/35164/18//COMMIT_MSG@20 PS18, Line 20: - 216,663 usecs with low frequency : - 328,220 usecs with middle frequency : - 322,612 usecs with high frequency Indentation to be fixed
Yu-Ping Wu has uploaded a new patch set (#19) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
mediatek/mt8183: Use cached calibration result for faster bootup
Load calibration params from flash. If the format of the params is correct, use these calibration params for fast calibration to reduce the bootup time.
Bootup time of DRAM partial calibration: - 1,349,385 usecs with low frequency - 924,698 usecs with middle frequency - 1,270,089 usecs with high frequency 3,544,172 usecs in total.
Bootup time of DRAM fast calibration: - 216,663 usecs with low frequency - 328,220 usecs with middle frequency - 322,612 usecs with high frequency 867,495 usecs in total.
BUG=b:80501386 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/include/soc/memlayout.ld M src/soc/mediatek/mt8183/memory.c 6 files changed, 426 insertions(+), 280 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35164/19
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
Patch Set 19:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35164/19//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/35164/19//COMMIT_MSG@25 PS19, Line 25: 80501386 139099592
Yu-Ping Wu has uploaded a new patch set (#20) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
mediatek/mt8183: Use cached calibration result for faster bootup
Load calibration params from flash. If the format of the params is correct, use these calibration params for fast calibration to reduce the bootup time.
Bootup time of DRAM partial calibration: - 1,349,385 usecs with low frequency - 924,698 usecs with middle frequency - 1,270,089 usecs with high frequency 3,544,172 usecs in total.
Bootup time of DRAM fast calibration: - 216,663 usecs with low frequency - 328,220 usecs with middle frequency - 322,612 usecs with high frequency 867,495 usecs in total.
BUG=b:80501386 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/include/soc/memlayout.ld M src/soc/mediatek/mt8183/memory.c 6 files changed, 425 insertions(+), 280 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35164/20
Yu-Ping Wu has uploaded a new patch set (#21) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
mediatek/mt8183: Use cached calibration result for faster bootup
Load calibration params from flash. If the format of the params is correct, use these calibration params for fast calibration to reduce the bootup time.
Bootup time of DRAM partial calibration: - 1,349,385 usecs with low frequency - 924,698 usecs with middle frequency - 1,270,089 usecs with high frequency 3,544,172 usecs in total.
Bootup time of DRAM fast calibration: - 216,663 usecs with low frequency - 328,220 usecs with middle frequency - 322,612 usecs with high frequency 867,495 usecs in total.
BUG=b:80501386 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/include/soc/memlayout.ld M src/soc/mediatek/mt8183/memory.c 6 files changed, 425 insertions(+), 280 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35164/21
Yu-Ping Wu has uploaded a new patch set (#22) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
mediatek/mt8183: Use cached calibration result for faster bootup
Load calibration params from flash. If the format of the params is correct, use these calibration params for fast calibration to reduce the bootup time.
Bootup time of DRAM partial calibration: - 1,349,385 usecs with low frequency - 924,698 usecs with middle frequency - 1,270,089 usecs with high frequency 3,544,172 usecs in total.
Bootup time of DRAM fast calibration: - 216,663 usecs with low frequency - 328,220 usecs with middle frequency - 322,612 usecs with high frequency 867,495 usecs in total.
BUG=b:80501386 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/include/soc/memlayout.ld M src/soc/mediatek/mt8183/memory.c 6 files changed, 425 insertions(+), 280 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35164/22
Yu-Ping Wu has uploaded a new patch set (#23) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
mediatek/mt8183: Use cached calibration result for faster bootup
Load calibration params from flash. If the format of the params is correct, use these calibration params for fast calibration to reduce the bootup time.
Bootup time of DRAM partial calibration: - 1,349,385 usecs with low frequency - 924,698 usecs with middle frequency - 1,270,089 usecs with high frequency 3,544,172 usecs in total.
Bootup time of DRAM fast calibration: - 216,663 usecs with low frequency - 328,220 usecs with middle frequency - 322,612 usecs with high frequency 867,495 usecs in total.
BUG=b:80501386 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/include/soc/memlayout.ld M src/soc/mediatek/mt8183/memory.c 6 files changed, 446 insertions(+), 285 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35164/23
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
Patch Set 23:
(5 comments)
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... File src/soc/mediatek/mt8183/dramc_init_setting.c:
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 616: dramc_dbg("bypass duty calibration\n");
no need add here
Ack
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 618: u8
why int better than u8?
I think using u8 is consistent with other code in this file.
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... File src/soc/mediatek/mt8183/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 911: dramc_dbg("[bypass Gating]\n");
what is the meaning?
@huayang Why adding "[" and "]" in this debug message?
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 912: {
maybe move this to a standalone function so we don't need to have too many levels of indentation.
Done
https://review.coreboot.org/c/coreboot/+/35164/23/src/soc/mediatek/mt8183/dr... File src/soc/mediatek/mt8183/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/35164/23/src/soc/mediatek/mt8183/dr... PS23, Line 858: dramc_rx_dqs_gating_cal2 @huayang I have no idea how to name this function. Any suggestion?
Yu-Ping Wu has uploaded a new patch set (#24) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
mediatek/mt8183: Use cached calibration result for faster bootup
Load calibration params from flash. If the format of the params is correct, use these calibration params for fast calibration to reduce the bootup time.
Bootup time of DRAM partial calibration: - 1,349,385 usecs with low frequency - 924,698 usecs with middle frequency - 1,270,089 usecs with high frequency 3,544,172 usecs in total.
Bootup time of DRAM fast calibration: - 216,663 usecs with low frequency - 328,220 usecs with middle frequency - 322,612 usecs with high frequency 867,495 usecs in total.
BUG=b:80501386 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/include/soc/memlayout.ld M src/soc/mediatek/mt8183/memory.c 6 files changed, 456 insertions(+), 281 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35164/24
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
Patch Set 24:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... File src/soc/mediatek/mt8183/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 1617: for (u8 byte = 0; byte < DQS_NUMBER; byte++) {
Can’t you factor this out into a dedicated function?
Done
Yu-Ping Wu has uploaded a new patch set (#25) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
mediatek/mt8183: Use cached calibration result for faster bootup
Load calibration params from flash. If the format of the params is correct, use these calibration params for fast calibration to reduce the bootup time.
Bootup time of DRAM partial calibration: - 1,349,385 usecs with low frequency - 924,698 usecs with middle frequency - 1,270,089 usecs with high frequency 3,544,172 usecs in total.
Bootup time of DRAM fast calibration: - 216,663 usecs with low frequency - 328,220 usecs with middle frequency - 322,612 usecs with high frequency 867,495 usecs in total.
BUG=b:139099592 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/include/soc/memlayout.ld M src/soc/mediatek/mt8183/memory.c 6 files changed, 456 insertions(+), 281 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35164/25
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
Patch Set 25:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35164/19//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/35164/19//COMMIT_MSG@25 PS19, Line 25: 80501386
139099592
Done
Yu-Ping Wu has uploaded a new patch set (#26) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
mediatek/mt8183: Use cached calibration result for faster bootup
Load calibration params from flash. If the format of the params is correct, use these calibration params for fast calibration to reduce the bootup time.
Bootup time of DRAM partial calibration: - 1,349,385 usecs with low frequency - 924,698 usecs with middle frequency - 1,270,089 usecs with high frequency 3,544,172 usecs in total.
Bootup time of DRAM fast calibration: - 216,663 usecs with low frequency - 328,220 usecs with middle frequency - 322,612 usecs with high frequency 867,495 usecs in total.
BUG=b:139099592 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/include/soc/memlayout.ld M src/soc/mediatek/mt8183/memory.c 6 files changed, 443 insertions(+), 281 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35164/26
Yu-Ping Wu has uploaded a new patch set (#27) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
mediatek/mt8183: Use cached calibration result for faster bootup
Load calibration params from flash. If the format of the params is correct, use these calibration params for fast calibration to reduce the bootup time.
Bootup time of DRAM partial calibration: - 1,349,385 usecs with low frequency - 924,698 usecs with middle frequency - 1,270,089 usecs with high frequency 3,544,172 usecs in total.
Bootup time of DRAM fast calibration: - 216,663 usecs with low frequency - 328,220 usecs with middle frequency - 322,612 usecs with high frequency 867,495 usecs in total.
BUG=b:139099592 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/include/soc/memlayout.ld M src/soc/mediatek/mt8183/memory.c 6 files changed, 443 insertions(+), 281 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35164/27
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
Patch Set 27:
(3 comments)
https://review.coreboot.org/c/coreboot/+/35164/27/src/soc/mediatek/mt8183/dr... File src/soc/mediatek/mt8183/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/35164/27/src/soc/mediatek/mt8183/dr... PS27, Line 1873: if (dramc_check_dqdqs_win(&(win_perbit[bit]), Too many leading tabs - consider code refactoring
https://review.coreboot.org/c/coreboot/+/35164/27/src/soc/mediatek/mt8183/dr... PS27, Line 1877: if (vref_scan_enable) Too many leading tabs - consider code refactoring
https://review.coreboot.org/c/coreboot/+/35164/27/src/soc/mediatek/mt8183/dr... PS27, Line 1880: if (bit % DQS_BIT_NUMBER == 7) Too many leading tabs - consider code refactoring
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
Patch Set 28:
(3 comments)
https://review.coreboot.org/c/coreboot/+/35164/28/src/soc/mediatek/mt8183/dr... File src/soc/mediatek/mt8183/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/35164/28/src/soc/mediatek/mt8183/dr... PS28, Line 1873: if (dramc_check_dqdqs_win(&(win_perbit[bit]), Too many leading tabs - consider code refactoring
https://review.coreboot.org/c/coreboot/+/35164/28/src/soc/mediatek/mt8183/dr... PS28, Line 1877: if (vref_scan_enable) Too many leading tabs - consider code refactoring
https://review.coreboot.org/c/coreboot/+/35164/28/src/soc/mediatek/mt8183/dr... PS28, Line 1880: if (bit % DQS_BIT_NUMBER == 7) Too many leading tabs - consider code refactoring
Yu-Ping Wu has uploaded a new patch set (#29) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
mediatek/mt8183: Use cached calibration result for faster bootup
Load calibration params from flash. If the format of the params is correct, use these calibration params for fast calibration to reduce the bootup time.
Bootup time of DRAM partial calibration: - 1,349,385 usecs with low frequency - 924,698 usecs with middle frequency - 1,270,089 usecs with high frequency 3,544,172 usecs in total.
Bootup time of DRAM fast calibration: - 216,663 usecs with low frequency - 328,220 usecs with middle frequency - 322,612 usecs with high frequency 867,495 usecs in total.
BUG=b:139099592 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/include/soc/memlayout.ld M src/soc/mediatek/mt8183/memory.c 6 files changed, 456 insertions(+), 283 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35164/29
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
Patch Set 29:
(4 comments)
https://review.coreboot.org/c/coreboot/+/35164/23/src/soc/mediatek/mt8183/dr... File src/soc/mediatek/mt8183/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/35164/23/src/soc/mediatek/mt8183/dr... PS23, Line 858: dramc_rx_dqs_gating_cal2
@huayang I have no idea how to name this function. […]
Renamed to dramc_rx_dqs_gating_cal_partial.
https://review.coreboot.org/c/coreboot/+/35164/28/src/soc/mediatek/mt8183/dr... File src/soc/mediatek/mt8183/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/35164/28/src/soc/mediatek/mt8183/dr... PS28, Line 1873: if (dramc_check_dqdqs_win(&(win_perbit[bit]),
Too many leading tabs - consider code refactoring
Done
https://review.coreboot.org/c/coreboot/+/35164/28/src/soc/mediatek/mt8183/dr... PS28, Line 1877: if (vref_scan_enable)
Too many leading tabs - consider code refactoring
Done
https://review.coreboot.org/c/coreboot/+/35164/28/src/soc/mediatek/mt8183/dr... PS28, Line 1880: if (bit % DQS_BIT_NUMBER == 7)
Too many leading tabs - consider code refactoring
Done
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
Patch Set 29:
(2 comments)
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... File src/soc/mediatek/mt8183/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/dr... PS12, Line 911: dramc_dbg("[bypass Gating]\n");
@huayang Why adding "[" and "]" in this debug message?
I think that's okay for debug messages. After all, this file already contains this kinds of logs.
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/in... File src/soc/mediatek/mt8183/include/soc/emi.h:
https://review.coreboot.org/c/coreboot/+/35164/12/src/soc/mediatek/mt8183/in... PS12, Line 26: sdram_params
I think a better style is to isolate the part of serialization, for example […]
Done
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
Patch Set 29:
(3 comments)
https://review.coreboot.org/c/coreboot/+/35164/29/src/soc/mediatek/mt8183/dr... File src/soc/mediatek/mt8183/dramc_init_setting.c:
https://review.coreboot.org/c/coreboot/+/35164/29/src/soc/mediatek/mt8183/dr... PS29, Line 615: if (have_calibration_params(params)) { : dramc_dbg("bypass duty calibration\n"); : : for (u8 chn = 0; chn < CHANNEL_MAX; chn++) { : dramc_duty_set_clk_delay(chn, params->duty_clk_delay[chn]); : dramc_duty_set_dqs_delay(chn, params->duty_dqs_delay[chn]); : } what about just 'return' after done so we don't need the 'else' block to change following lines?
https://review.coreboot.org/c/coreboot/+/35164/29/src/soc/mediatek/mt8183/em... File src/soc/mediatek/mt8183/emi.c:
https://review.coreboot.org/c/coreboot/+/35164/29/src/soc/mediatek/mt8183/em... PS29, Line 365: const struct sdram_params *freq_params since dramc_params is already merged in previous change, will it be easier if we pass dramc_params here?
https://review.coreboot.org/c/coreboot/+/35164/29/src/soc/mediatek/mt8183/in... File src/soc/mediatek/mt8183/include/soc/emi.h:
https://review.coreboot.org/c/coreboot/+/35164/29/src/soc/mediatek/mt8183/in... PS29, Line 88: have_calibration_params do you want to move this into dramc_params? we can check status, flags, ... everything there
Yu-Ping Wu has uploaded a new patch set (#30) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
mediatek/mt8183: Use cached calibration result for faster bootup
Load calibration params from flash. If the format of the params is correct, use these calibration params for fast calibration to reduce the bootup time.
Bootup time of DRAM partial calibration: - 1,349,385 usecs with low frequency - 924,698 usecs with middle frequency - 1,270,089 usecs with high frequency 3,544,172 usecs in total.
Bootup time of DRAM fast calibration: - 216,663 usecs with low frequency - 328,220 usecs with middle frequency - 322,612 usecs with high frequency 867,495 usecs in total.
BUG=b:139099592 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/include/soc/memlayout.ld M src/soc/mediatek/mt8183/memory.c 6 files changed, 369 insertions(+), 192 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35164/30
Yu-Ping Wu has uploaded a new patch set (#31) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
mediatek/mt8183: Use cached calibration result for faster bootup
Load calibration params from flash. If the format of the params is correct, use these calibration params for fast calibration to reduce the bootup time.
Bootup time of DRAM partial calibration: - 1,349,385 usecs with low frequency - 924,698 usecs with middle frequency - 1,270,089 usecs with high frequency 3,544,172 usecs in total.
Bootup time of DRAM fast calibration: - 216,663 usecs with low frequency - 328,220 usecs with middle frequency - 322,612 usecs with high frequency 867,495 usecs in total.
BUG=b:139099592 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/include/soc/memlayout.ld M src/soc/mediatek/mt8183/memory.c 6 files changed, 369 insertions(+), 192 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35164/31
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
Patch Set 31:
(2 comments)
https://review.coreboot.org/c/coreboot/+/35164/29/src/soc/mediatek/mt8183/dr... File src/soc/mediatek/mt8183/dramc_init_setting.c:
https://review.coreboot.org/c/coreboot/+/35164/29/src/soc/mediatek/mt8183/dr... PS29, Line 615: if (have_calibration_params(params)) { : dramc_dbg("bypass duty calibration\n"); : : for (u8 chn = 0; chn < CHANNEL_MAX; chn++) { : dramc_duty_set_clk_delay(chn, params->duty_clk_delay[chn]); : dramc_duty_set_dqs_delay(chn, params->duty_dqs_delay[chn]); : }
what about just 'return' after done so we don't need the 'else' block to change following lines?
Done
https://review.coreboot.org/c/coreboot/+/35164/29/src/soc/mediatek/mt8183/em... File src/soc/mediatek/mt8183/emi.c:
https://review.coreboot.org/c/coreboot/+/35164/29/src/soc/mediatek/mt8183/em... PS29, Line 365: const struct sdram_params *freq_params
since dramc_params is already merged in previous change, will it be easier if we pass dramc_params h […]
dramc_param.h already includes emi.h, so emi.h cannot include dramc_param.h.
Yu-Ping Wu has uploaded a new patch set (#32) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: soc/mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
soc/mediatek/mt8183: Use cached calibration result for faster bootup
Load calibration params from flash. If the format of the params is correct, use these calibration params for fast calibration to reduce the bootup time.
Bootup time of DRAM partial calibration: - 1,349,385 usecs with low frequency - 924,698 usecs with middle frequency - 1,270,089 usecs with high frequency 3,544,172 usecs in total.
Bootup time of DRAM fast calibration: - 216,663 usecs with low frequency - 328,220 usecs with middle frequency - 322,612 usecs with high frequency 867,495 usecs in total.
BUG=b:139099592 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/include/soc/memlayout.ld M src/soc/mediatek/mt8183/memory.c 6 files changed, 369 insertions(+), 192 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35164/32
Yu-Ping Wu has uploaded a new patch set (#33) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: soc/mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
soc/mediatek/mt8183: Use cached calibration result for faster bootup
Load calibration params from flash. If the format of the params is correct, use these calibration params for fast calibration to reduce the bootup time.
Bootup time of DRAM partial calibration: - 1,349,385 usecs with low frequency - 924,698 usecs with middle frequency - 1,270,089 usecs with high frequency 3,544,172 usecs in total.
Bootup time of DRAM fast calibration: - 216,663 usecs with low frequency - 328,220 usecs with middle frequency - 322,612 usecs with high frequency 867,495 usecs in total.
BUG=b:139099592 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/include/soc/memlayout.ld M src/soc/mediatek/mt8183/memory.c 6 files changed, 366 insertions(+), 192 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35164/33
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: soc/mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
Patch Set 33:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35164/29/src/soc/mediatek/mt8183/in... File src/soc/mediatek/mt8183/include/soc/emi.h:
https://review.coreboot.org/c/coreboot/+/35164/29/src/soc/mediatek/mt8183/in... PS29, Line 88: have_calibration_params
do you want to move this into dramc_params? we can check status, flags, ... […]
have_calibration_params() has been removed.
Yu-Ping Wu has uploaded a new patch set (#34) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: soc/mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
soc/mediatek/mt8183: Use cached calibration result for faster bootup
Load calibration params from flash. If the format of the params is correct, use these calibration params for fast calibration to reduce the bootup time.
Bootup time of DRAM partial calibration: - 1,349,385 usecs with low frequency - 924,698 usecs with middle frequency - 1,270,089 usecs with high frequency 3,544,172 usecs in total.
Bootup time of DRAM fast calibration: - 216,663 usecs with low frequency - 328,220 usecs with middle frequency - 322,612 usecs with high frequency 867,495 usecs in total.
BUG=b:139099592 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/include/soc/memlayout.ld M src/soc/mediatek/mt8183/memory.c 6 files changed, 363 insertions(+), 192 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35164/34
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: soc/mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
Patch Set 34:
(1 comment)
`
https://review.coreboot.org/c/coreboot/+/35164/29/src/soc/mediatek/mt8183/em... File src/soc/mediatek/mt8183/emi.c:
https://review.coreboot.org/c/coreboot/+/35164/29/src/soc/mediatek/mt8183/em... PS29, Line 365: const struct sdram_params *freq_params
dramc_param.h already includes emi.h, so emi.h cannot include dramc_param.h.
Done
Yu-Ping Wu has uploaded a new patch set (#35) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: soc/mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
soc/mediatek/mt8183: Use cached calibration result for faster bootup
Load calibration params from flash. If the format of the params is correct, use these calibration params for fast calibration to reduce the bootup time.
Bootup time of DRAM partial calibration: - 1,349,385 usecs with low frequency - 924,698 usecs with middle frequency - 1,270,089 usecs with high frequency 3,544,172 usecs in total.
Bootup time of DRAM fast calibration: - 216,663 usecs with low frequency - 328,220 usecs with middle frequency - 322,612 usecs with high frequency 867,495 usecs in total.
BUG=b:139099592 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-H9HCNNNCPMALHR-4GB.c M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-K4UBE3D4AA-MGCL-4GB.c M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-KMDH6001DA-B422-4GB.c M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-KMDP6001DA-B425-4GB.c M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-KMDV6001DA-B620-4GB.c M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-MT29VZZZAD8DQKSL-4GB.c M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-MT53E1G32D4NQ-4GB.c M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-SDADA4CR-128G-4GB.c M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/include/soc/memlayout.ld M src/soc/mediatek/mt8183/memory.c 14 files changed, 379 insertions(+), 192 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35164/35
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: soc/mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
Patch Set 35:
(3 comments)
https://review.coreboot.org/c/coreboot/+/35164/35/src/soc/mediatek/mt8183/dr... File src/soc/mediatek/mt8183/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/35164/35/src/soc/mediatek/mt8183/dr... PS35, Line 1011: if (params->source == DRAMC_PARAM_SOURCE_FLASH) { : dramc_dbg("[bypass Gating]\n"); : } else { if (param->source == DRAMC_PARAM_SOURCE_SDRAM_CONFIG) { .... }
https://review.coreboot.org/c/coreboot/+/35164/29/src/soc/mediatek/mt8183/em... File src/soc/mediatek/mt8183/emi.c:
https://review.coreboot.org/c/coreboot/+/35164/29/src/soc/mediatek/mt8183/em... PS29, Line 365: const struct sdram_params *freq_params
Done
That's not a problem, as long as we don't need complete definition in emi.h.
In emi.h you can declare a struct without body:
struct dramc_param;
Then you can use "struct dramc_param *param" in the function prototypes.
And in the .c file you have to include dramc_param.h, then you can use the fields inside struct.
https://review.coreboot.org/c/coreboot/+/35164/35/src/soc/mediatek/mt8183/in... File src/soc/mediatek/mt8183/include/soc/emi.h:
https://review.coreboot.org/c/coreboot/+/35164/35/src/soc/mediatek/mt8183/in... PS35, Line 24: DRAMC_PARAM_SOURCE_SDRAM_CONFIG = 0, : DRAMC_PARAM_SOURCE_FLASH, What about adding a DRAMC_PARAM_SOURCE_INVALID = 0 ?
Then we can make sure if people didn't load or set properly, the config won't work.
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: soc/mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
Patch Set 35:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35164/35/src/soc/mediatek/mt8183/in... File src/soc/mediatek/mt8183/include/soc/emi.h:
https://review.coreboot.org/c/coreboot/+/35164/35/src/soc/mediatek/mt8183/in... PS35, Line 24: DRAMC_PARAM_SOURCE_SDRAM_CONFIG = 0, : DRAMC_PARAM_SOURCE_FLASH,
What about adding a DRAMC_PARAM_SOURCE_INVALID = 0 ? […]
I've thought about it, but then we would have to deal with the _invalid_ case every time.
What do you think we should do when encountering _invalid_ source?
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: soc/mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
Patch Set 35:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35164/35/src/soc/mediatek/mt8183/in... File src/soc/mediatek/mt8183/include/soc/emi.h:
https://review.coreboot.org/c/coreboot/+/35164/35/src/soc/mediatek/mt8183/in... PS35, Line 24: DRAMC_PARAM_SOURCE_SDRAM_CONFIG = 0, : DRAMC_PARAM_SOURCE_FLASH,
I've thought about it, but then we would have to deal with the _invalid_ case every time. […]
Since you are declaring this as u16, you already need to consider any unexpected values.
In fact I think we don't need to care about invalid case every time, it should be fine to only handle that in where the param is loaded, and the entry of some functions.
And it helps to make sure we won't fail when adding new sources, if we do a switch-case (and default: assert) when different logic is needed.
Yu-Ping Wu has uploaded a new patch set (#36) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: soc/mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
soc/mediatek/mt8183: Use cached calibration result for faster bootup
Load calibration params from flash. If the format of the params is correct, use these calibration params for fast calibration to reduce the bootup time.
Bootup time of DRAM partial calibration: - 1,349,385 usecs with low frequency - 924,698 usecs with middle frequency - 1,270,089 usecs with high frequency 3,544,172 usecs in total.
Bootup time of DRAM fast calibration: - 216,663 usecs with low frequency - 328,220 usecs with middle frequency - 322,612 usecs with high frequency 867,495 usecs in total.
BUG=b:139099592 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-H9HCNNNCPMALHR-4GB.c M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-K4UBE3D4AA-MGCL-4GB.c M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-KMDH6001DA-B422-4GB.c M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-KMDP6001DA-B425-4GB.c M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-KMDV6001DA-B620-4GB.c M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-MT29VZZZAD8DQKSL-4GB.c M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-MT53E1G32D4NQ-4GB.c M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-SDADA4CR-128G-4GB.c M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/include/soc/memlayout.ld M src/soc/mediatek/mt8183/memory.c 14 files changed, 377 insertions(+), 192 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35164/36
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: soc/mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
Patch Set 36:
(2 comments)
https://review.coreboot.org/c/coreboot/+/35164/35/src/soc/mediatek/mt8183/dr... File src/soc/mediatek/mt8183/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/35164/35/src/soc/mediatek/mt8183/dr... PS35, Line 1011: if (params->source == DRAMC_PARAM_SOURCE_FLASH) { : dramc_dbg("[bypass Gating]\n"); : } else {
if (param->source == DRAMC_PARAM_SOURCE_SDRAM_CONFIG) { […]
Done
https://review.coreboot.org/c/coreboot/+/35164/29/src/soc/mediatek/mt8183/em... File src/soc/mediatek/mt8183/emi.c:
https://review.coreboot.org/c/coreboot/+/35164/29/src/soc/mediatek/mt8183/em... PS29, Line 365: const struct sdram_params *freq_params
That's not a problem, as long as we don't need complete definition in emi.h. […]
Done
Yu-Ping Wu has uploaded a new patch set (#37) to the change originally created by huayang duan. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: soc/mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
soc/mediatek/mt8183: Use cached calibration result for faster bootup
Load calibration params from flash. If the format of the params is correct, use these calibration params for fast calibration to reduce the bootup time.
Bootup time of DRAM partial calibration: - 1,349,385 usecs with low frequency - 924,698 usecs with middle frequency - 1,270,089 usecs with high frequency 3,544,172 usecs in total.
Bootup time of DRAM fast calibration: - 216,663 usecs with low frequency - 328,220 usecs with middle frequency - 322,612 usecs with high frequency 867,495 usecs in total.
BUG=b:139099592 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com --- M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-H9HCNNNCPMALHR-4GB.c M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-K4UBE3D4AA-MGCL-4GB.c M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-KMDH6001DA-B422-4GB.c M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-KMDP6001DA-B425-4GB.c M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-KMDV6001DA-B620-4GB.c M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-MT29VZZZAD8DQKSL-4GB.c M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-MT53E1G32D4NQ-4GB.c M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-SDADA4CR-128G-4GB.c M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/include/soc/memlayout.ld M src/soc/mediatek/mt8183/memory.c 14 files changed, 419 insertions(+), 204 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35164/37
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: soc/mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
Patch Set 37:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35164/35/src/soc/mediatek/mt8183/in... File src/soc/mediatek/mt8183/include/soc/emi.h:
https://review.coreboot.org/c/coreboot/+/35164/35/src/soc/mediatek/mt8183/in... PS35, Line 24: DRAMC_PARAM_SOURCE_SDRAM_CONFIG = 0, : DRAMC_PARAM_SOURCE_FLASH,
Since you are declaring this as u16, you already need to consider any unexpected values. […]
Done
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: soc/mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
Patch Set 37: Code-Review+2
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: soc/mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
Patch Set 38:
(2 comments)
https://review.coreboot.org/c/coreboot/+/35164/38/src/soc/mediatek/mt8183/dr... File src/soc/mediatek/mt8183/dramc_pi_calibration_api.c:
https://review.coreboot.org/c/coreboot/+/35164/38/src/soc/mediatek/mt8183/dr... PS38, Line 1988: } else { nit: I wonder if we should move the else-block to another static function to make it clear, but it's also fine in current shape.
https://review.coreboot.org/c/coreboot/+/35164/38/src/soc/mediatek/mt8183/dr... PS38, Line 2013: assert(sum != 0); nit: since sum is not changed during dramc_engine2_end, we should probably do assert immediately after for-loop is done.
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: soc/mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
Patch Set 39:
LGTM
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: soc/mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
Patch Set 39:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35164/39//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/35164/39//COMMIT_MSG@26 PS39, Line 26: BRANCH=none nit: BRANCH=kukui
Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/35164 )
Change subject: soc/mediatek/mt8183: Use cached calibration result for faster bootup ......................................................................
soc/mediatek/mt8183: Use cached calibration result for faster bootup
Load calibration params from flash. If the format of the params is correct, use these calibration params for fast calibration to reduce the bootup time.
Bootup time of DRAM partial calibration: - 1,349,385 usecs with low frequency - 924,698 usecs with middle frequency - 1,270,089 usecs with high frequency 3,544,172 usecs in total.
Bootup time of DRAM fast calibration: - 216,663 usecs with low frequency - 328,220 usecs with middle frequency - 322,612 usecs with high frequency 867,495 usecs in total.
BUG=b:139099592 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: I9ef4265dd369a1c276bb02294696556df927e7bc Signed-off-by: Huayang Duan huayang.duan@mediatek.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/35164 Reviewed-by: Hung-Te Lin hungte@chromium.org Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-H9HCNNNCPMALHR-4GB.c M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-K4UBE3D4AA-MGCL-4GB.c M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-KMDH6001DA-B422-4GB.c M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-KMDP6001DA-B425-4GB.c M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-KMDV6001DA-B620-4GB.c M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-MT29VZZZAD8DQKSL-4GB.c M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-MT53E1G32D4NQ-4GB.c M src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-SDADA4CR-128G-4GB.c M src/soc/mediatek/mt8183/dramc_init_setting.c M src/soc/mediatek/mt8183/dramc_pi_calibration_api.c M src/soc/mediatek/mt8183/emi.c M src/soc/mediatek/mt8183/include/soc/emi.h M src/soc/mediatek/mt8183/include/soc/memlayout.ld M src/soc/mediatek/mt8183/memory.c 14 files changed, 419 insertions(+), 204 deletions(-)
Approvals: build bot (Jenkins): Verified Hung-Te Lin: Looks good to me, approved
diff --git a/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-H9HCNNNCPMALHR-4GB.c b/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-H9HCNNNCPMALHR-4GB.c index fab1240..5471f01 100644 --- a/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-H9HCNNNCPMALHR-4GB.c +++ b/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-H9HCNNNCPMALHR-4GB.c @@ -16,6 +16,8 @@ #include <soc/emi.h>
struct sdram_params params = { + .source = DRAMC_PARAM_SOURCE_SDRAM_CONFIG, + .frequency = 1600, .wr_level = { [CHANNEL_A] = { {0x22, 0x1b}, {0x22, 0x19} }, [CHANNEL_B] = { {0x24, 0x20}, {0x25, 0x20} } diff --git a/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-K4UBE3D4AA-MGCL-4GB.c b/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-K4UBE3D4AA-MGCL-4GB.c index d3c1496..5743304 100644 --- a/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-K4UBE3D4AA-MGCL-4GB.c +++ b/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-K4UBE3D4AA-MGCL-4GB.c @@ -16,6 +16,8 @@ #include <soc/emi.h>
struct sdram_params params = { + .source = DRAMC_PARAM_SOURCE_SDRAM_CONFIG, + .frequency = 1600, .wr_level = { [CHANNEL_A] = { {0x22, 0x1C}, {0x23, 0x1D} }, [CHANNEL_B] = { {0x26, 0x23}, {0x26, 0x23} } diff --git a/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-KMDH6001DA-B422-4GB.c b/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-KMDH6001DA-B422-4GB.c index c21cd12..de06818 100644 --- a/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-KMDH6001DA-B422-4GB.c +++ b/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-KMDH6001DA-B422-4GB.c @@ -16,6 +16,8 @@ #include <soc/emi.h>
struct sdram_params params = { + .source = DRAMC_PARAM_SOURCE_SDRAM_CONFIG, + .frequency = 1600, .wr_level = { [CHANNEL_A] = { {0x21, 0x21}, {0x20, 0x20} }, [CHANNEL_B] = { {0x1E, 0x1F}, {0x1D, 0x1E} } diff --git a/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-KMDP6001DA-B425-4GB.c b/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-KMDP6001DA-B425-4GB.c index 4349845..fb83e6f 100644 --- a/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-KMDP6001DA-B425-4GB.c +++ b/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-KMDP6001DA-B425-4GB.c @@ -16,6 +16,8 @@ #include <soc/emi.h>
struct sdram_params params = { + .source = DRAMC_PARAM_SOURCE_SDRAM_CONFIG, + .frequency = 1600, .wr_level = { [CHANNEL_A] = { {0x22, 0x21}, {0x20, 0x21} }, [CHANNEL_B] = { {0x23, 0x27}, {0x23, 0x27} } diff --git a/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-KMDV6001DA-B620-4GB.c b/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-KMDV6001DA-B620-4GB.c index cab57ce..415dbda 100644 --- a/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-KMDV6001DA-B620-4GB.c +++ b/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-KMDV6001DA-B620-4GB.c @@ -16,6 +16,8 @@ #include <soc/emi.h>
struct sdram_params params = { + .source = DRAMC_PARAM_SOURCE_SDRAM_CONFIG, + .frequency = 1600, .wr_level = { [CHANNEL_A] = { {0x21, 0x24}, {0x22, 0x24} }, [CHANNEL_B] = { {0x24, 0x28}, {0x22, 0x27} } diff --git a/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-MT29VZZZAD8DQKSL-4GB.c b/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-MT29VZZZAD8DQKSL-4GB.c index 2810ef5..bf3fe89 100644 --- a/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-MT29VZZZAD8DQKSL-4GB.c +++ b/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-MT29VZZZAD8DQKSL-4GB.c @@ -16,6 +16,8 @@ #include <soc/emi.h>
struct sdram_params params = { + .source = DRAMC_PARAM_SOURCE_SDRAM_CONFIG, + .frequency = 1600, .wr_level = { [CHANNEL_A] = { {0x21, 0x21}, {0x20, 0x20} }, [CHANNEL_B] = { {0x21, 0x28}, {0x21, 0x29} } diff --git a/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-MT53E1G32D4NQ-4GB.c b/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-MT53E1G32D4NQ-4GB.c index 329cc76..e5b3dcc 100644 --- a/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-MT53E1G32D4NQ-4GB.c +++ b/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-MT53E1G32D4NQ-4GB.c @@ -16,6 +16,8 @@ #include <soc/emi.h>
struct sdram_params params = { + .source = DRAMC_PARAM_SOURCE_SDRAM_CONFIG, + .frequency = 1600, .wr_level = { [CHANNEL_A] = { {0x1F, 0x19}, {0x20, 0x1A} }, [CHANNEL_B] = { {0x22, 0x1E}, {0x22, 0x1E} } diff --git a/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-SDADA4CR-128G-4GB.c b/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-SDADA4CR-128G-4GB.c index ccb591e..cb923f5 100644 --- a/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-SDADA4CR-128G-4GB.c +++ b/src/mainboard/google/kukui/sdram_params/sdram-lpddr4x-SDADA4CR-128G-4GB.c @@ -16,6 +16,8 @@ #include <soc/emi.h>
struct sdram_params params = { + .source = DRAMC_PARAM_SOURCE_SDRAM_CONFIG, + .frequency = 1600, .wr_level = { [CHANNEL_A] = { {0x1F, 0x1C}, {0x1C, 0x1B} }, [CHANNEL_B] = { {0x27, 0x28}, {0x23, 0x28} } diff --git a/src/soc/mediatek/mt8183/dramc_init_setting.c b/src/soc/mediatek/mt8183/dramc_init_setting.c index b8491d3..f4905e2 100644 --- a/src/soc/mediatek/mt8183/dramc_init_setting.c +++ b/src/soc/mediatek/mt8183/dramc_init_setting.c @@ -612,6 +612,22 @@
static void dramc_duty_calibration(const struct sdram_params *params, u8 freq_group) { + switch (params->source) { + case DRAMC_PARAM_SOURCE_SDRAM_CONFIG: + break; + case DRAMC_PARAM_SOURCE_FLASH: + dramc_dbg("bypass duty calibration\n"); + + for (u8 chn = 0; chn < CHANNEL_MAX; chn++) { + dramc_duty_set_clk_delay(chn, params->duty_clk_delay[chn]); + dramc_duty_set_dqs_delay(chn, params->duty_dqs_delay[chn]); + } + return; + default: + die("Invalid DRAM param source %u\n", params->source); + return; + } + s8 clkDelay[CHANNEL_MAX] = {0x0}; s8 dqsDelay[CHANNEL_MAX][DQS_NUMBER] = {0x0};
diff --git a/src/soc/mediatek/mt8183/dramc_pi_calibration_api.c b/src/soc/mediatek/mt8183/dramc_pi_calibration_api.c index 794e4f0..6537af0 100644 --- a/src/soc/mediatek/mt8183/dramc_pi_calibration_api.c +++ b/src/soc/mediatek/mt8183/dramc_pi_calibration_api.c @@ -248,19 +248,28 @@ }
static void dramc_cmd_bus_training(u8 chn, u8 rank, u8 freq_group, - const struct sdram_params *params) + const struct sdram_params *params, const bool fast_calib) { - u32 cbt_cs, mr12_value; + u32 final_vref, clk_dly, cmd_dly, cs_dly;
- cbt_cs = params->cbt_cs_dly[chn][rank]; - mr12_value = params->cbt_final_vref[chn][rank]; + clk_dly = params->cbt_clk_dly[chn][rank]; + cmd_dly = params->cbt_cmd_dly[chn][rank]; + cs_dly = params->cbt_cs_dly[chn][rank]; + final_vref = params->cbt_final_vref[chn][rank];
- /* CBT adjust cs */ - clrsetbits_le32(&ch[chn].phy.shu[0].rk[rank].ca_cmd[9], - SHU1_CA_CMD9_RG_RK_ARFINE_TUNE_CS_MASK, cbt_cs << 0); + if (fast_calib) { + /* Set CLK and CA delay */ + clrsetbits_le32(&ch[chn].phy.shu[0].rk[rank].ca_cmd[9], + (0x3f << 8) | (0x3f << 24), + (cmd_dly << 8) | (clk_dly << 24)); + udelay(1); + } + + /* Set CLK and CS delay */ + clrsetbits_le32(&ch[chn].phy.shu[0].rk[rank].ca_cmd[9], 0x3f, cs_dly << 0);
/* CBT set vref */ - dramc_mode_reg_write_by_rank(chn, rank, 12, mr12_value); + dramc_mode_reg_write_by_rank(chn, rank, 12, final_vref); }
static void dramc_read_dbi_onoff(bool on) @@ -781,6 +790,13 @@
}
+static void set_selph_gating_value(uint32_t *addr, u8 dly, u8 dly_p1) +{ + clrsetbits_le32(addr, 0x77777777, + (dly << 0) | (dly << 8) | (dly << 16) | (dly << 24) | + (dly_p1 << 4) | (dly_p1 << 12) | (dly_p1 << 20) | (dly_p1 << 28)); +} + static void dramc_write_dqs_gating_result(u8 chn, u8 rank, u8 *best_coarse_tune2t, u8 *best_coarse_tune0p5t, u8 *best_coarse_tune2t_p1, u8 *best_coarse_tune0p5t_p1) @@ -840,8 +856,101 @@ (best_coarse_0p5t_rodt_p1[0] << 4) | (best_coarse_0p5t_rodt_p1[1] << 12)); }
+static void dramc_rx_dqs_gating_cal_partial(u8 chn, u8 rank, + u32 coarse_start, u32 coarse_end, u8 freqDiv, + u8 *pass_begin, u8 *pass_count, u8 *pass_count_1, u8 *dqs_done, + u8 *dqs_high, u8 *dqs_transition, u8 *dly_coarse_large_cnt, + u8 *dly_coarse_0p5t_cnt, u8 *dly_fine_tune_cnt) +{ + u8 dqs; + u32 debug_cnt[DQS_NUMBER]; + + for (u32 coarse_tune = coarse_start; coarse_tune < coarse_end; + coarse_tune++) { + u32 dly_coarse_large_rodt = 0, dly_coarse_0p5t_rodt = 0; + u32 dly_coarse_large_rodt_p1 = 4, dly_coarse_0p5t_rodt_p1 = 4; + + u8 dly_coarse_large = coarse_tune / RX_DQS_CTL_LOOP; + u8 dly_coarse_0p5t = coarse_tune % RX_DQS_CTL_LOOP; + u32 dly_coarse_large_p1 = (coarse_tune + freqDiv) / RX_DQS_CTL_LOOP; + u32 dly_coarse_0p5t_p1 = (coarse_tune + freqDiv) % RX_DQS_CTL_LOOP; + u32 value = (dly_coarse_large << 3) + dly_coarse_0p5t; + + if (value >= 11) { + value -= 11; + dly_coarse_large_rodt = value >> 3; + dly_coarse_0p5t_rodt = + value - (dly_coarse_large_rodt << 3); + value = (dly_coarse_large << 3) + dly_coarse_0p5t - 11; + dly_coarse_large_rodt_p1 = value >> 3; + dly_coarse_0p5t_rodt_p1 = + value - (dly_coarse_large_rodt_p1 << 3); + } + + set_selph_gating_value(&ch[chn].ao.shu[0].rk[rank].selph_dqsg0, + dly_coarse_large, dly_coarse_large_p1); + set_selph_gating_value(&ch[chn].ao.shu[0].rk[rank].selph_dqsg1, + dly_coarse_0p5t, dly_coarse_0p5t_p1); + set_selph_gating_value(&ch[chn].ao.shu[0].rk[rank].selph_odten0, + dly_coarse_large_rodt, dly_coarse_large_rodt_p1); + set_selph_gating_value(&ch[chn].ao.shu[0].rk[rank].selph_odten1, + dly_coarse_0p5t_rodt, dly_coarse_0p5t_rodt_p1); + + for (u8 dly_fine_xt = 0; dly_fine_xt < DQS_GW_FINE_END; + dly_fine_xt += 4) { + dramc_set_gating_mode(chn, 0); + write32(&ch[chn].ao.shu[0].rk[rank].dqsien, + dly_fine_xt | (dly_fine_xt << 8)); + + dram_phy_reset(chn); + setbits_le32(&ch[chn].ao.spcmd, + 1 << SPCMD_DQSGCNTRST_SHIFT); + udelay(1); + clrbits_le32(&ch[chn].ao.spcmd, + 1 << SPCMD_DQSGCNTRST_SHIFT); + + dramc_engine2_run(chn, TE_OP_READ_CHECK); + + u32 result_r = read32(&ch[chn].phy.misc_stberr_rk0_r) & + MISC_STBERR_RK_R_STBERR_RK_R_MASK; + u32 result_f = read32(&ch[chn].phy.misc_stberr_rk0_f) & + MISC_STBERR_RK_F_STBERR_RK_F_MASK; + debug_cnt[0] = read32(&ch[chn].nao.dqsgnwcnt[0]); + debug_cnt[1] = (debug_cnt[0] >> 16) & 0xffff; + debug_cnt[0] &= 0xffff; + + dramc_set_gating_mode(chn, 1); + dramc_engine2_run(chn, TE_OP_READ_CHECK); + + dramc_find_dly_tune(chn, dly_coarse_large, + dly_coarse_0p5t, dly_fine_xt, dqs_high, + dly_coarse_large_cnt, dly_coarse_0p5t_cnt, + dly_fine_tune_cnt, dqs_transition, dqs_done); + + dramc_dbg("%d %d %d |", dly_coarse_large, + dly_coarse_0p5t, dly_fine_xt); + for (dqs = 0; dqs < DQS_NUMBER; dqs++) + dramc_dbg("%X ", debug_cnt[dqs]); + + dramc_dbg(" |"); + for (dqs = 0; dqs < DQS_NUMBER; dqs++) { + dramc_dbg("(%X %X)", + (result_f >> (DQS_BIT_NUMBER * dqs)) & 0xff, + (result_r >> (DQS_BIT_NUMBER * dqs)) & 0xff); + } + + dramc_dbg("\n"); + if (dramc_find_gating_window(result_r, result_f, debug_cnt, + dly_coarse_large, dly_coarse_0p5t, pass_begin, + pass_count, pass_count_1, &dly_fine_xt, + dqs_high, dqs_done)) + coarse_tune = coarse_end; + } + } +} + static void dramc_rx_dqs_gating_cal(u8 chn, u8 rank, u8 freq_group, - const struct sdram_params *params) + const struct sdram_params *params, const bool fast_calib) { u8 dqs, fsp, freqDiv = 4; u8 pass_begin[DQS_NUMBER] = {0}, pass_count[DQS_NUMBER] = {0}, @@ -855,7 +964,6 @@ u8 dly_coarse_large_cnt[DQS_NUMBER] = {0}, dly_coarse_0p5t_cnt[DQS_NUMBER] = {0}, dly_fine_tune_cnt[DQS_NUMBER] = {0}; u32 coarse_start, coarse_end; - u32 debug_cnt[DQS_NUMBER];
struct reg_value regs_bak[] = { {&ch[chn].ao.stbcal, 0x0}, @@ -899,111 +1007,29 @@ coarse_end = coarse_start + 12;
dramc_dbg("[Gating]\n"); - for (u32 coarse_tune = coarse_start; coarse_tune < coarse_end; coarse_tune++) { - u32 dly_coarse_large_rodt = 0, dly_coarse_0p5t_rodt = 0; - u32 dly_coarse_large_rodt_p1 = 4, dly_coarse_0p5t_rodt_p1 = 4;
- u8 dly_coarse_large = coarse_tune / RX_DQS_CTL_LOOP; - u8 dly_coarse_0p5t = coarse_tune % RX_DQS_CTL_LOOP; - u32 dly_coarse_large_p1 = (coarse_tune + freqDiv) / RX_DQS_CTL_LOOP; - u32 dly_coarse_0p5t_p1 = (coarse_tune + freqDiv) % RX_DQS_CTL_LOOP; - u32 value = (dly_coarse_large << 3) + dly_coarse_0p5t; - - if (value >= 11) { - value -= 11; - dly_coarse_large_rodt = value >> 3; - dly_coarse_0p5t_rodt = - value - (dly_coarse_large_rodt << 3); - - value = (dly_coarse_large << 3) + dly_coarse_0p5t - 11; - dly_coarse_large_rodt_p1 = value >> 3; - dly_coarse_0p5t_rodt_p1 = - value - (dly_coarse_large_rodt_p1 << 3); - } - - clrsetbits_le32(&ch[chn].ao.shu[0].rk[rank].selph_dqsg0, - 0x77777777, - (dly_coarse_large << 0) | (dly_coarse_large << 8) | - (dly_coarse_large << 16) | (dly_coarse_large << 24) | - (dly_coarse_large_p1 << 4) | (dly_coarse_large_p1 << 12) | - (dly_coarse_large_p1 << 20) | (dly_coarse_large_p1 << 28)); - clrsetbits_le32(&ch[chn].ao.shu[0].rk[rank].selph_dqsg1, - 0x77777777, - (dly_coarse_0p5t << 0) | (dly_coarse_0p5t << 8) | - (dly_coarse_0p5t << 16) | (dly_coarse_0p5t << 24) | - (dly_coarse_0p5t_p1 << 4) | (dly_coarse_0p5t_p1 << 12) | - (dly_coarse_0p5t_p1 << 20) | (dly_coarse_0p5t_p1 << 28)); - clrsetbits_le32(&ch[chn].ao.shu[0].rk[rank].selph_odten0, - 0x77777777, - (dly_coarse_large_rodt << 0) | (dly_coarse_large_rodt << 8) | - (dly_coarse_large_rodt << 16) | (dly_coarse_large_rodt << 24) | - (dly_coarse_large_rodt_p1 << 4) | (dly_coarse_large_rodt_p1 << 12) | - (dly_coarse_large_rodt_p1 << 20) | (dly_coarse_large_rodt_p1 << 28)); - clrsetbits_le32(&ch[chn].ao.shu[0].rk[rank].selph_odten1, - 0x77777777, - (dly_coarse_0p5t_rodt << 0) | (dly_coarse_0p5t_rodt << 8) | - (dly_coarse_0p5t_rodt << 16) | (dly_coarse_0p5t_rodt << 24) | - (dly_coarse_0p5t_rodt_p1 << 4) | (dly_coarse_0p5t_rodt_p1 << 12) | - (dly_coarse_0p5t_rodt_p1 << 20) | (dly_coarse_0p5t_rodt_p1 << 28)); - - for (u8 dly_fine_xt = 0; dly_fine_xt < DQS_GW_FINE_END; dly_fine_xt += 4) { - dramc_set_gating_mode(chn, 0); - write32(&ch[chn].ao.shu[0].rk[rank].dqsien, - dly_fine_xt | (dly_fine_xt << 8)); - - dram_phy_reset(chn); - setbits_le32(&ch[chn].ao.spcmd, - 1 << SPCMD_DQSGCNTRST_SHIFT); - udelay(1); - clrbits_le32(&ch[chn].ao.spcmd, - 1 << SPCMD_DQSGCNTRST_SHIFT); - - dramc_engine2_run(chn, TE_OP_READ_CHECK); - - u32 result_r = read32(&ch[chn].phy.misc_stberr_rk0_r) & - MISC_STBERR_RK_R_STBERR_RK_R_MASK; - u32 result_f = read32(&ch[chn].phy.misc_stberr_rk0_f) & - MISC_STBERR_RK_F_STBERR_RK_F_MASK; - debug_cnt[0] = read32(&ch[chn].nao.dqsgnwcnt[0]); - debug_cnt[1] = (debug_cnt[0] >> 16) & 0xffff; - debug_cnt[0] &= 0xffff; - - dramc_set_gating_mode(chn, 1); - dramc_engine2_run(chn, TE_OP_READ_CHECK); - - dramc_find_dly_tune(chn, dly_coarse_large, - dly_coarse_0p5t, dly_fine_xt, dqs_high, - dly_coarse_large_cnt, dly_coarse_0p5t_cnt, - dly_fine_tune_cnt, dqs_transition, dqs_done); - - dramc_dbg("%d %d %d |", dly_coarse_large, - dly_coarse_0p5t, dly_fine_xt); - for (dqs = 0; dqs < DQS_NUMBER; dqs++) - dramc_dbg("%X ", debug_cnt[dqs]); - - dramc_dbg(" |"); - for (dqs = 0; dqs < DQS_NUMBER; dqs++) { - dramc_dbg("(%X %X)", - (result_f >> (DQS_BIT_NUMBER * dqs)) & 0xff, - (result_r >> (DQS_BIT_NUMBER * dqs)) & 0xff); - } - - dramc_dbg("\n"); - if (dramc_find_gating_window(result_r, result_f, debug_cnt, - dly_coarse_large, dly_coarse_0p5t, pass_begin, pass_count, - pass_count_1, &dly_fine_xt, dqs_high, dqs_done)) - coarse_tune = coarse_end; - } + if (!fast_calib) { + dramc_rx_dqs_gating_cal_partial(chn, rank, + coarse_start, coarse_end, + freqDiv, pass_begin, pass_count, pass_count_1, dqs_done, + dqs_high, dqs_transition, dly_coarse_large_cnt, + dly_coarse_0p5t_cnt, dly_fine_tune_cnt); + dramc_engine2_end(chn, dummy_rd_backup); }
- dramc_engine2_end(chn, dummy_rd_backup); - for (dqs = 0; dqs < DQS_NUMBER; dqs++) { - pass_count[dqs] = dqs_transition[dqs]; - min_fine_tune[dqs] = dly_fine_tune_cnt[dqs]; - min_coarse_tune0p5t[dqs] = dly_coarse_0p5t_cnt[dqs]; - min_coarse_tune2t[dqs] = dly_coarse_large_cnt[dqs]; - + if (fast_calib) { + dramc_dbg("[bypass Gating params] dqs: %d\n", dqs); + pass_count[dqs] = params->gating_pass_count[chn][rank][dqs]; + min_fine_tune[dqs] = params->gating_fine_tune[chn][rank][dqs]; + min_coarse_tune0p5t[dqs] = params->gating05T[chn][rank][dqs]; + min_coarse_tune2t[dqs] = params->gating2T[chn][rank][dqs]; + } else { + pass_count[dqs] = dqs_transition[dqs]; + min_fine_tune[dqs] = dly_fine_tune_cnt[dqs]; + min_coarse_tune0p5t[dqs] = dly_coarse_0p5t_cnt[dqs]; + min_coarse_tune2t[dqs] = dly_coarse_large_cnt[dqs]; + } u8 tmp_offset = pass_count[dqs] * DQS_GW_FINE_STEP / 2; u8 tmp_value = min_fine_tune[dqs] + tmp_offset; best_fine_tune[dqs] = tmp_value % RX_DLY_DQSIENSTB_LOOP; @@ -1548,9 +1574,35 @@ dramc_set_tx_dly_factor(chn, rank, type, small_value, dly); }
+static void dramc_set_tx_dly_center(struct per_byte_dly *center_dly, + const struct win_perbit_dly *vref_dly) +{ + int index; + struct per_byte_dly *dly; + + for (u8 byte = 0; byte < DQS_NUMBER; byte++) { + dly = ¢er_dly[byte]; + dly->min_center = 0xffff; + dly->max_center = 0; + + for (u8 bit = 0; bit < DQS_BIT_NUMBER; bit++) { + index = bit + 8 * byte; + if (vref_dly[index].win_center < dly->min_center) + dly->min_center = vref_dly[index].win_center; + if (vref_dly[index].win_center > dly->max_center) + dly->max_center = vref_dly[index].win_center; + } + dramc_dbg("center_dly[%d].min_center = %d, " + "center_dly[%d].max_center = %d\n", + byte, center_dly[byte].min_center, + byte, center_dly[byte].max_center); + } +} + static void dramc_set_tx_best_dly(u8 chn, u8 rank, bool bypass_tx, struct win_perbit_dly *vref_dly, enum CAL_TYPE type, u8 freq_group, - u16 *tx_dq_precal_result, u16 dly_cell_unit, const struct sdram_params *params) + u16 *tx_dq_precal_result, u16 dly_cell_unit, const struct sdram_params *params, + const bool fast_calib) { int index, clock_rate; u8 use_delay_cell; @@ -1581,20 +1633,23 @@ else use_delay_cell = 0;
- for (u8 byte = 0; byte < DQS_NUMBER; byte++) { - center_dly[byte].min_center = 0xffff; - center_dly[byte].max_center = 0; - - for (u8 bit = 0; bit < DQS_BIT_NUMBER; bit++) { - index = bit + 8 * byte; - if (vref_dly[index].win_center < center_dly[byte].min_center) - center_dly[byte].min_center = vref_dly[index].win_center; - if (vref_dly[index].win_center > center_dly[byte].max_center) - center_dly[byte].max_center = vref_dly[index].win_center; + if (fast_calib && bypass_tx) { + dramc_dbg("bypass TX\n"); + for (u8 byte = 0; byte < DQS_NUMBER; byte++) { + center_dly[byte].min_center = params->tx_center_min[chn][rank][byte]; + center_dly[byte].max_center = params->tx_center_max[chn][rank][byte]; + for (u8 bit = 0; bit < DQS_BIT_NUMBER; bit++) { + index = bit + 8 * byte; + vref_dly[index].win_center = + params->tx_win_center[chn][rank][index]; + vref_dly[index].best_first = + params->tx_first_pass[chn][rank][index]; + vref_dly[index].best_last = + params->tx_last_pass[chn][rank][index]; + } } - dramc_dbg("[channel %d] [rank %d] byte:%d, center_dly[byte].min_center:%d, center_dly[byte].max_center:%d\n", - chn, rank, byte, center_dly[byte].min_center, - center_dly[byte].max_center); + } else { + dramc_set_tx_dly_center(center_dly, vref_dly); }
for (u8 byte = 0; byte < DQS_NUMBER; byte++) { @@ -1697,13 +1752,57 @@ return err_value; }
+static void dramc_window_perbit_cal_partial(u8 chn, u8 rank, + s16 dly_begin, s16 dly_end, s16 dly_step, + enum CAL_TYPE type, u8 *small_value, u8 vref_scan_enable, + struct win_perbit_dly *win_perbit) +{ + u32 finish_bit = 0; + + for (s16 dly = dly_begin; dly < dly_end; dly += dly_step) { + dramc_set_dqdqs_dly(chn, rank, type, small_value, dly); + + u32 err_value = dram_k_perbit(chn, type); + if (!vref_scan_enable) + dramc_dbg("%d ", dly); + + for (size_t bit = 0; bit < DQ_DATA_WIDTH; bit++) { + bool bit_fail = (err_value & ((u32) 1 << bit)) != 0; + + /* pass window bigger than 7, + * consider as real pass window. + */ + if (dramc_check_dqdqs_win(&(win_perbit[bit]), + dly, dly_end, bit_fail) > 7) + finish_bit |= (1 << bit); + + if (vref_scan_enable) + continue; + + dramc_dbg("%s", bit_fail ? "x" : "o"); + if (bit % DQS_BIT_NUMBER == 7) + dramc_dbg(" "); + } + + if (!vref_scan_enable) + dramc_dbg(" [MSB]\n"); + + if (finish_bit == 0xffff && (err_value & 0xffff) == 0xffff) { + dramc_dbg("all bits window found, " + "early break! delay=%#x\n", dly); + break; + } + } +} + static u8 dramc_window_perbit_cal(u8 chn, u8 rank, u8 freq_group, - enum CAL_TYPE type, const struct sdram_params *params) + enum CAL_TYPE type, const struct sdram_params *params, + const bool fast_calib) { u8 vref = 0, vref_begin = 0, vref_end = 1, vref_step = 1, vref_use = 0; u8 vref_scan_enable = 0, small_reg_value = 0xff; - s16 dly, dly_begin = 0, dly_end = 0, dly_step = 1; - u32 dummy_rd_bak_engine2 = 0, err_value, finish_bit, win_min_max = 0; + s16 dly_begin = 0, dly_end = 0, dly_step = 1; + u32 dummy_rd_bak_engine2 = 0, finish_bit, win_min_max = 0; static u16 dq_precal_result[DQS_NUMBER]; struct vref_perbit_dly vref_dly; struct win_perbit_dly win_perbit[DQ_DATA_WIDTH]; @@ -1711,16 +1810,30 @@
u8 fsp = get_freq_fsq(freq_group); u8 vref_range = !fsp; + bool bypass_tx = !fsp;
dramc_get_vref_prop(rank, type, fsp, &vref_scan_enable, &vref_begin, &vref_end); dramc_get_dly_range(chn, rank, type, freq_group, dq_precal_result, &dly_begin, &dly_end, params);
+ if (fast_calib) { + if (type == RX_WIN_TEST_ENG && vref_scan_enable == 1) { + vref_begin = params->rx_vref[chn]; + vref_end = vref_begin + 1; + dramc_dbg("bypass RX vref: %d\n", vref_begin); + } else if (type == TX_WIN_DQ_ONLY) { + vref_begin = params->tx_vref[chn][rank]; + vref_end = vref_begin + 1; + dramc_dbg("bypass TX vref: %d\n", vref_begin); + } + vref_dly.best_vref = vref_begin; + } + if ((type == RX_WIN_RD_DQC || type == RX_WIN_TEST_ENG) && fsp == FSP_0) dly_step = 2;
- dramc_dbg("[channel %d] [rank %d] type:%d, vref_enable:%d, vref range[%d:%d]\n", + dramc_dbg("[channel %d] [rank %d] type: %d, vref_enable: %d, vref range[%d : %d]\n", chn, rank, type, vref_scan_enable, vref_begin, vref_end);
if (type == TX_WIN_DQ_ONLY || type == TX_WIN_DQ_DQM) { @@ -1735,6 +1848,17 @@ vref_step = 2; }
+ if (fast_calib && bypass_tx && + (type == TX_WIN_DQ_ONLY || type == TX_WIN_DQ_DQM)) { + dramc_set_tx_best_dly(chn, rank, true, vref_dly.perbit_dly, + type, freq_group, dq_precal_result, dly_cell_unit, + params, fast_calib); + + if (vref_scan_enable) + dramc_set_vref(chn, rank, type, vref_dly.best_vref); + return 0; + } + if (type == RX_WIN_RD_DQC) { dramc_rx_rd_dqc_init(chn, rank); } else { @@ -1770,36 +1894,20 @@ RX_DQ, FIRST_DQ_DELAY); }
- for (dly = dly_begin; dly < dly_end; dly += dly_step) { - dramc_set_dqdqs_dly(chn, rank, type, &small_reg_value, dly); - - err_value = dram_k_perbit(chn, type); - if (!vref_scan_enable) - dramc_dbg("%d ", dly); - + if (fast_calib && + (type == RX_WIN_RD_DQC || type == RX_WIN_TEST_ENG)) { + dramc_dbg("bypass RX params\n"); for (size_t bit = 0; bit < DQ_DATA_WIDTH; bit++) { - bool bit_fail = (err_value & ((u32) 1 << bit)) != 0; - - /* pass window bigger than 7, consider as real pass window */ - if (dramc_check_dqdqs_win(&(win_perbit[bit]), - dly, dly_end, bit_fail) > 7) - finish_bit |= (1 << bit); - - if (vref_scan_enable) - continue; - dramc_dbg("%s", bit_fail ? "x" : "o"); - if (bit % DQS_BIT_NUMBER == 7) - dramc_dbg(" "); + win_perbit[bit].best_first = + params->rx_firspass[chn][rank][bit]; + win_perbit[bit].best_last = + params->rx_lastpass[chn][rank][bit]; } - - if (!vref_scan_enable) - dramc_dbg(" [MSB]\n"); - - if (finish_bit == 0xffff && (err_value & 0xffff) == 0xffff) { - dramc_dbg("all bits window found, early break! delay=0x%x\n", - dly); - break; - } + } else { + dramc_window_perbit_cal_partial(chn, rank, + dly_begin, dly_end, dly_step, + type, &small_reg_value, + vref_scan_enable, win_perbit); }
for (size_t bit = 0; bit < DQ_DATA_WIDTH; bit++) @@ -1807,7 +1915,8 @@ win_perbit[bit].best_first, win_perbit[bit].best_last, win_perbit[bit].best_last - win_perbit[bit].best_first);
- if (dramk_calc_best_vref(type, vref_use, &vref_dly, win_perbit, &win_min_max)) + if (dramk_calc_best_vref(type, vref_use, &vref_dly, + win_perbit, &win_min_max)) break; }
@@ -1822,8 +1931,9 @@ if (type == RX_WIN_RD_DQC || type == RX_WIN_TEST_ENG) dramc_set_rx_best_dly(chn, rank, vref_dly.perbit_dly); else - dramc_set_tx_best_dly(chn, rank, false, vref_dly.perbit_dly, type, - freq_group, dq_precal_result, dly_cell_unit, params); + dramc_set_tx_best_dly(chn, rank, false, + vref_dly.perbit_dly, type, freq_group, + dq_precal_result, dly_cell_unit, params, fast_calib);
if (vref_scan_enable && type == TX_WIN_DQ_ONLY) dramc_set_vref(chn, rank, type, vref_dly.best_vref); @@ -1858,7 +1968,8 @@ dram_phy_reset(chn); }
-static u8 dramc_rx_datlat_cal(u8 chn, u8 rank, u8 freq_group, const struct sdram_params *params) +static u8 dramc_rx_datlat_cal(u8 chn, u8 rank, u8 freq_group, + const struct sdram_params *params, const bool fast_calib) { u32 datlat, begin = 0, first = 0, sum = 0, best_step; u32 datlat_start = 7; @@ -1871,39 +1982,44 @@ u32 dummy_rd_backup = read32(&ch[chn].ao.dummy_rd); dramc_engine2_init(chn, rank, TEST2_1_CAL, TEST2_2_CAL, false);
- for (datlat = datlat_start; datlat < DATLAT_TAP_NUMBER; datlat++) { - dramc_dle_factor_handler(chn, datlat, freq_group); + if (fast_calib) { + best_step = params->rx_datlat[chn][rank]; + dramc_dbg("bypass DATLAT, best_step: %d\n", best_step); + } else { + for (datlat = datlat_start; datlat < DATLAT_TAP_NUMBER; datlat++) { + dramc_dle_factor_handler(chn, datlat, freq_group);
- u32 err = dramc_engine2_run(chn, TE_OP_WRITE_READ_CHECK); - if (err == 0) { - if (begin == 0) { - first = datlat; - begin = 1; + u32 err = dramc_engine2_run(chn, TE_OP_WRITE_READ_CHECK); + if (err == 0) { + if (begin == 0) { + first = datlat; + begin = 1; + } + if (begin == 1) { + sum++; + if (sum > 4) + break; + } + } else { + if (begin == 1) + begin = 0xff; } - if (begin == 1) { - sum++; - if (sum > 4) - break; - } - } else { - if (begin == 1) - begin = 0xff; + + dramc_dbg("Datlat=%2d, err_value=0x%4x, sum=%d\n", datlat, err, sum); }
- dramc_dbg("Datlat=%2d, err_value=0x%4x, sum=%d\n", datlat, err, sum); + dramc_engine2_end(chn, dummy_rd_backup); + + assert(sum != 0); + + if (sum <= 3) + best_step = first + (sum >> 1); + else + best_step = first + 2; + dramc_dbg("First_step=%d, total pass=%d, best_step=%d\n", + begin, sum, best_step); }
- dramc_engine2_end(chn, dummy_rd_backup); - - assert(sum != 0); - - if (sum <= 3) - best_step = first + (sum >> 1); - else - best_step = first + 2; - dramc_dbg("First_step=%d, total pass=%d, best_step=%d\n", - begin, sum, best_step); - dramc_dle_factor_handler(chn, best_step, freq_group);
clrsetbits_le32(&ch[chn].ao.padctrl, 0x3 | (0x1 << 3), @@ -1997,20 +2113,40 @@
void dramc_calibrate_all_channels(const struct sdram_params *pams, u8 freq_group) { + bool fast_calib; + switch (pams->source) { + case DRAMC_PARAM_SOURCE_SDRAM_CONFIG: + fast_calib = false; + break; + case DRAMC_PARAM_SOURCE_FLASH: + fast_calib = true; + break; + default: + die("Invalid DRAM param source %u\n", pams->source); + return; + } + u8 rx_datlat[RANK_MAX] = {0}; for (u8 chn = 0; chn < CHANNEL_MAX; chn++) { for (u8 rk = RANK_0; rk < RANK_MAX; rk++) { dramc_show("Start K ch:%d, rank:%d\n", chn, rk); dramc_auto_refresh_switch(chn, false); - dramc_cmd_bus_training(chn, rk, freq_group, pams); + dramc_cmd_bus_training(chn, rk, freq_group, pams, + fast_calib); dramc_write_leveling(chn, rk, freq_group, pams->wr_level); dramc_auto_refresh_switch(chn, true); - dramc_rx_dqs_gating_cal(chn, rk, freq_group, pams); - dramc_window_perbit_cal(chn, rk, freq_group, RX_WIN_RD_DQC, pams); - dramc_window_perbit_cal(chn, rk, freq_group, TX_WIN_DQ_DQM, pams); - dramc_window_perbit_cal(chn, rk, freq_group, TX_WIN_DQ_ONLY, pams); - rx_datlat[rk] = dramc_rx_datlat_cal(chn, rk, freq_group, pams); - dramc_window_perbit_cal(chn, rk, freq_group, RX_WIN_TEST_ENG, pams); + dramc_rx_dqs_gating_cal(chn, rk, freq_group, pams, + fast_calib); + dramc_window_perbit_cal(chn, rk, freq_group, + RX_WIN_RD_DQC, pams, fast_calib); + dramc_window_perbit_cal(chn, rk, freq_group, + TX_WIN_DQ_DQM, pams, fast_calib); + dramc_window_perbit_cal(chn, rk, freq_group, + TX_WIN_DQ_ONLY, pams, fast_calib); + rx_datlat[rk] = dramc_rx_datlat_cal(chn, rk, freq_group, + pams, fast_calib); + dramc_window_perbit_cal(chn, rk, freq_group, + RX_WIN_TEST_ENG, pams, fast_calib); }
dramc_rx_dqs_gating_post_process(chn, freq_group); diff --git a/src/soc/mediatek/mt8183/emi.c b/src/soc/mediatek/mt8183/emi.c index 8bd8a39..3b5b2a7 100644 --- a/src/soc/mediatek/mt8183/emi.c +++ b/src/soc/mediatek/mt8183/emi.c @@ -343,10 +343,10 @@
static void do_calib(const struct sdram_params *params, u8 freq_group) { - dramc_show("Start K freq group:%d\n", frequency_table[freq_group]); + dramc_show("Start K, current clock is:%d\n", params->frequency); dramc_calibrate_all_channels(params, freq_group); dramc_ac_timing_optimize(freq_group); - dramc_show("%s K freq group:%d finish!\n", __func__, frequency_table[freq_group]); + dramc_show("K finish with clock:%d\n", params->frequency); }
static void after_calib(void) @@ -355,18 +355,23 @@ dramc_runtime_config(); }
-void mt_set_emi(const struct sdram_params *params) +void mt_set_emi(const struct sdram_params *freq_params) { const u8 *freq_tbl; + const int shuffle = DRAM_DFS_SHUFFLE_1; u8 current_freqsel; + const struct sdram_params *params;
if (CONFIG(MT8183_DRAM_EMCP)) freq_tbl = freq_shuffle_emcp; else freq_tbl = freq_shuffle; - current_freqsel = freq_tbl[DRAM_DFS_SHUFFLE_1]; + + current_freqsel = freq_tbl[shuffle]; + params = &freq_params[shuffle];
init_dram(params, current_freqsel); do_calib(params, current_freqsel); + after_calib(); } diff --git a/src/soc/mediatek/mt8183/include/soc/emi.h b/src/soc/mediatek/mt8183/include/soc/emi.h index 15889ee..ab21bc7 100644 --- a/src/soc/mediatek/mt8183/include/soc/emi.h +++ b/src/soc/mediatek/mt8183/include/soc/emi.h @@ -20,10 +20,49 @@ #include <types.h> #include <soc/dramc_common_mt8183.h>
+enum DRAMC_PARAM_SOURCE { + DRAMC_PARAM_SOURCE_SDRAM_INVALID = 0, + DRAMC_PARAM_SOURCE_SDRAM_CONFIG, + DRAMC_PARAM_SOURCE_FLASH, +}; + struct sdram_params { + u16 source; /* DRAMC_PARAM_SOURCE */ + u16 frequency; u8 wr_level[CHANNEL_MAX][RANK_MAX][DQS_NUMBER]; - u8 cbt_cs_dly[CHANNEL_MAX][RANK_MAX]; + + /* DUTY */ + s8 duty_clk_delay[CHANNEL_MAX]; + s8 duty_dqs_delay[CHANNEL_MAX][DQS_NUMBER]; + + /* CBT */ u8 cbt_final_vref[CHANNEL_MAX][RANK_MAX]; + u8 cbt_clk_dly[CHANNEL_MAX][RANK_MAX]; + u8 cbt_cmd_dly[CHANNEL_MAX][RANK_MAX]; + u8 cbt_cs_dly[CHANNEL_MAX][RANK_MAX]; + + /* Gating */ + u8 gating2T[CHANNEL_MAX][RANK_MAX][DQS_NUMBER]; + u8 gating05T[CHANNEL_MAX][RANK_MAX][DQS_NUMBER]; + u8 gating_fine_tune[CHANNEL_MAX][RANK_MAX][DQS_NUMBER]; + u8 gating_pass_count[CHANNEL_MAX][RANK_MAX][DQS_NUMBER]; + + /* TX perbit */ + u8 tx_vref[CHANNEL_MAX][RANK_MAX]; + u16 tx_center_min[CHANNEL_MAX][RANK_MAX][DQS_NUMBER]; + u16 tx_center_max[CHANNEL_MAX][RANK_MAX][DQS_NUMBER]; + u16 tx_win_center[CHANNEL_MAX][RANK_MAX][DQ_DATA_WIDTH]; + u16 tx_first_pass[CHANNEL_MAX][RANK_MAX][DQ_DATA_WIDTH]; + u16 tx_last_pass[CHANNEL_MAX][RANK_MAX][DQ_DATA_WIDTH]; + + /* datlat */ + u8 rx_datlat[CHANNEL_MAX][RANK_MAX]; + + /* RX perbit */ + u8 rx_vref[CHANNEL_MAX]; + s16 rx_firspass[CHANNEL_MAX][RANK_MAX][DQ_DATA_WIDTH]; + u8 rx_lastpass[CHANNEL_MAX][RANK_MAX][DQ_DATA_WIDTH]; + u32 emi_cona_val; u32 emi_conh_val; u32 emi_conf_val; @@ -46,7 +85,7 @@ size_t sdram_size(void); const struct sdram_params *get_sdram_config(void); void enable_emi_dcm(void); -void mt_set_emi(const struct sdram_params *params); -void mt_mem_init(const struct sdram_params *params); +void mt_set_emi(const struct sdram_params *freq_params); +void mt_mem_init(const struct sdram_params *freq_params);
#endif /* SOC_MEDIATEK_MT8183_EMI_H */ diff --git a/src/soc/mediatek/mt8183/include/soc/memlayout.ld b/src/soc/mediatek/mt8183/include/soc/memlayout.ld index 73c880a..82e404f 100644 --- a/src/soc/mediatek/mt8183/include/soc/memlayout.ld +++ b/src/soc/mediatek/mt8183/include/soc/memlayout.ld @@ -24,6 +24,8 @@ */ #define SRAM_L2C_START(addr) SYMBOL(sram_l2c, addr) #define SRAM_L2C_END(addr) SYMBOL(esram_l2c, addr) +#define DRAM_INIT_CODE(addr, size) \ + REGION(dram_init_code, addr, size, 4)
SECTIONS { @@ -42,6 +44,7 @@ SRAM_L2C_START(0x00200000) OVERLAP_DECOMPRESSOR_VERSTAGE_ROMSTAGE(0x00201000, 188K) BOOTBLOCK(0x00230000, 64K) + DRAM_INIT_CODE(0x00240000, 256K) SRAM_L2C_END(0x00280000)
DRAM_START(0x40000000) diff --git a/src/soc/mediatek/mt8183/memory.c b/src/soc/mediatek/mt8183/memory.c index b2c7441..67f6c65 100644 --- a/src/soc/mediatek/mt8183/memory.c +++ b/src/soc/mediatek/mt8183/memory.c @@ -19,12 +19,12 @@ #include <soc/emi.h> #include <symbols.h>
-void mt_mem_init(const struct sdram_params *params) +void mt_mem_init(const struct sdram_params *freq_params) { u64 rank_size[RANK_MAX];
/* memory calibration */ - mt_set_emi(params); + mt_set_emi(freq_params);
if (CONFIG(MEMORY_TEST)) { size_t r;