diff options
author | Yu-Ping Wu <yupingso@chromium.org> | 2019-10-03 08:49:23 +0800 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2019-10-18 12:21:56 +0000 |
commit | 4d4ccced31f87fd98f1b0783438dbc5480b355f5 (patch) | |
tree | 2144e037b45d9846c8d8261bf8b78ac38b380fe3 /src/soc/mediatek/mt8183/emi.c | |
parent | cea735cf127e090fbb5fa588bd5d7bd3c959e49f (diff) | |
download | coreboot-4d4ccced31f87fd98f1b0783438dbc5480b355f5.tar.xz |
soc/mediatek/mt8183: Pass impedance data as a function argument
To make data flow more explicit, global variable 'impedance' is replaced
with a local variable, which is passed as a function argument.
BUG=none
BRANCH=kukui
TEST=Krane boots correctly
Change-Id: I0f6dacc33fda013a3476a10d9899821b7297e770
Signed-off-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/35766
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Diffstat (limited to 'src/soc/mediatek/mt8183/emi.c')
-rw-r--r-- | src/soc/mediatek/mt8183/emi.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/soc/mediatek/mt8183/emi.c b/src/soc/mediatek/mt8183/emi.c index 8cdbabfebb..653253fb7f 100644 --- a/src/soc/mediatek/mt8183/emi.c +++ b/src/soc/mediatek/mt8183/emi.c @@ -349,13 +349,16 @@ static void spm_pinmux_setting(void) write32(&mtk_spm->dramc_dpy_clk_sw_con_sel2, 0xffffffff); } -static void dfs_init_for_calibration(const struct sdram_params *params, u8 freq_group) +static void dfs_init_for_calibration(const struct sdram_params *params, + u8 freq_group, + struct dram_impedance *impedance) { - dramc_init(params, freq_group); + dramc_init(params, freq_group, impedance); dramc_apply_config_before_calibration(freq_group); } -static void init_dram(const struct sdram_params *params, u8 freq_group) +static void init_dram(const struct sdram_params *params, u8 freq_group, + struct dram_impedance *impedance) { global_option_init(params); emi_init(params); @@ -364,10 +367,11 @@ static void init_dram(const struct sdram_params *params, u8 freq_group) dramc_init_pre_settings(); spm_pinmux_setting(); - dramc_sw_impedance_cal(params, ODT_OFF); - dramc_sw_impedance_cal(params, ODT_ON); + dramc_sw_impedance_cal(params, ODT_OFF, impedance); + dramc_sw_impedance_cal(params, ODT_ON, impedance); - dfs_init_for_calibration(params, freq_group); + dramc_init(params, freq_group, impedance); + dramc_apply_config_before_calibration(freq_group); emi_init2(params); } @@ -487,6 +491,7 @@ static void dramc_save_result_to_shuffle(u32 src_shuffle, u32 dst_shuffle) } static int run_calib(const struct dramc_param *dparam, + struct dram_impedance *impedance, const int shuffle, bool *first_run) { const u8 *freq_tbl; @@ -505,9 +510,9 @@ static int run_calib(const struct dramc_param *dparam, freq_group, *first_run); if (*first_run) - init_dram(params, freq_group); + init_dram(params, freq_group, impedance); else - dfs_init_for_calibration(params, freq_group); + dfs_init_for_calibration(params, freq_group, impedance); *first_run = false; dramc_show("Start K (current clock: %u\n", params->frequency); @@ -528,17 +533,20 @@ static void after_calib(void) int mt_set_emi(const struct dramc_param *dparam) { + struct dram_impedance impedance; bool first_run = true; set_vdram1_vddq_voltage(); if (CONFIG(MT8183_DRAM_DVFS)) { - if (run_calib(dparam, DRAM_DFS_SHUFFLE_3, &first_run) != 0) + if (run_calib(dparam, &impedance, DRAM_DFS_SHUFFLE_3, + &first_run) != 0) return -1; - if (run_calib(dparam, DRAM_DFS_SHUFFLE_2, &first_run) != 0) + if (run_calib(dparam, &impedance, DRAM_DFS_SHUFFLE_2, + &first_run) != 0) return -1; } - if (run_calib(dparam, DRAM_DFS_SHUFFLE_1, &first_run) != 0) + if (run_calib(dparam, &impedance, DRAM_DFS_SHUFFLE_1, &first_run) != 0) return -1; after_calib(); |