diff options
author | Xi Chen <xixi.chen@mediatek.corp-partner.google.com> | 2022-01-21 17:18:45 +0800 |
---|---|---|
committer | Hung-Te Lin <hungte@chromium.org> | 2022-01-25 09:42:29 +0000 |
commit | f4bb77bd9eb576df0e16d261b1bf461512b784fd (patch) | |
tree | 5d030d239ebc05a3859b8da0a517ccb4d8024f5f /src/soc/mediatek/common | |
parent | 20f836bfdf2611c7aced8ad4b3452fc4db519727 (diff) |
soc/mediatek: Save dramc_param header to mrc_cache
Fast-k flow may need to re-init header because mrc_cache doesn't
store header. Storing header together with dparam data is better
for data consistancy.
TEST=fast calibration pass on Corsola
BUG=b:204226005
Signed-off-by: Xi Chen <xixi.chen@mediatek.corp-partner.google.com>
Change-Id: I22982923dce06c9e770aa4f20f3dcd2f33685d84
Reviewed-on: https://review.coreboot.org/c/coreboot/+/61294
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Diffstat (limited to 'src/soc/mediatek/common')
-rw-r--r-- | src/soc/mediatek/common/memory.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/soc/mediatek/common/memory.c b/src/soc/mediatek/common/memory.c index 93856d51e6..1b18dc7210 100644 --- a/src/soc/mediatek/common/memory.c +++ b/src/soc/mediatek/common/memory.c @@ -172,17 +172,15 @@ static void mem_init_set_default_config(struct dramc_param *dparam, static void mt_mem_init_run(struct dramc_param *dparam, const struct sdram_info *dram_info) { - const ssize_t mrc_cache_size = sizeof(dparam->dramc_datas); + const ssize_t mrc_cache_size = sizeof(*dparam); ssize_t data_size; struct stopwatch sw; int ret; /* Load calibration params from flash and run fast calibration */ - mem_init_set_default_config(dparam, dram_info); data_size = mrc_cache_load_current(MRC_TRAINING_DATA, DRAMC_PARAM_HEADER_VERSION, - &dparam->dramc_datas, - mrc_cache_size); + dparam, mrc_cache_size); if (data_size == mrc_cache_size) { printk(BIOS_INFO, "DRAM-K: Running fast calibration\n"); stopwatch_init(&sw); @@ -194,11 +192,10 @@ static void mt_mem_init_run(struct dramc_param *dparam, stopwatch_duration_msecs(&sw), ret); /* Erase flash data after fast calibration failed */ - memset(&dparam->dramc_datas, 0xa5, mrc_cache_size); + memset(dparam, 0xa5, mrc_cache_size); mrc_cache_stash_data(MRC_TRAINING_DATA, DRAMC_PARAM_HEADER_VERSION, - &dparam->dramc_datas, - mrc_cache_size); + dparam, mrc_cache_size); } else { printk(BIOS_INFO, "DRAM-K: Fast calibration passed in %ld msecs\n", stopwatch_duration_msecs(&sw)); @@ -220,7 +217,7 @@ static void mt_mem_init_run(struct dramc_param *dparam, stopwatch_duration_msecs(&sw)); mrc_cache_stash_data(MRC_TRAINING_DATA, DRAMC_PARAM_HEADER_VERSION, - &dparam->dramc_datas, mrc_cache_size); + dparam, mrc_cache_size); } else { printk(BIOS_ERR, "DRAM-K: Full calibration failed in %ld msecs\n", stopwatch_duration_msecs(&sw)); |