Yu-Ping Wu has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/36089 )
Change subject: soc/mediatek/mt8183: Skip fast calibration in recovery mode ......................................................................
soc/mediatek/mt8183: Skip fast calibration in recovery mode
According MediaTek, they have seen some extreme situations where the fast calibration passed complex memory test but there were sill memory issues after kernel is up. Therefore, they suggest skipping fast calibration in recovery mode. Also, the calculated parameters will not be saved to the flash.
BRANCH=kukui BUG=b:139099592 TEST=emerge-kukui coreboot
Change-Id: I29e0df71dc3357462e15ce8fc2ba02f21b54ed33 Signed-off-by: Yu-Ping Wu yupingso@chromium.org --- M src/soc/mediatek/mt8183/memory.c 1 file changed, 23 insertions(+), 15 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/89/36089/1
diff --git a/src/soc/mediatek/mt8183/memory.c b/src/soc/mediatek/mt8183/memory.c index b657708..5c10f49 100644 --- a/src/soc/mediatek/mt8183/memory.c +++ b/src/soc/mediatek/mt8183/memory.c @@ -17,6 +17,7 @@ #include <cbfs.h> #include <console/console.h> #include <ip_checksum.h> +#include <security/vboot/vboot_common.h> #include <soc/dramc_param.h> #include <soc/dramc_pi_api.h> #include <soc/emi.h> @@ -163,17 +164,22 @@ if (CONFIG(MT8183_DRAM_EMCP)) config |= DRAMC_CONFIG_EMCP;
+ const bool recovery_mode = vboot_recovery_mode_enabled(); + /* Load calibration params from flash and run fast calibration */ - if (dparam_ops->read_from_flash(dparam)) { - if (dram_run_fast_calibration(dparam, config) == 0) { - printk(BIOS_INFO, - "DRAM calibraion params loaded from flash\n"); - if (mt_set_emi(dparam) == 0 && mt_mem_test() == 0) - return; + if (!recovery_mode) { + if (dparam_ops->read_from_flash(dparam)) { + if (dram_run_fast_calibration(dparam, config) == 0) { + printk(BIOS_INFO, + "Calibraion params loaded from flash\n"); + if (mt_set_emi(dparam) == 0 && + mt_mem_test() == 0) + return; + } + } else { + printk(BIOS_WARNING, + "Failed to read calibration data from flash\n"); } - } else { - printk(BIOS_WARNING, - "Failed to read calibration data from flash\n"); }
/* Run full calibration */ @@ -181,12 +187,14 @@ if (err == 0) { printk(BIOS_INFO, "Successfully loaded DRAM blobs and " "ran DRAM calibration\n"); - set_source_to_flash(dparam->freq_params); - dparam->header.checksum = compute_checksum(dparam); - dparam_ops->write_to_flash(dparam); - printk(BIOS_DEBUG, "Calibration params saved to flash: " - "version=%#x, size=%#x\n", - dparam->header.version, dparam->header.size); + if (!recovery_mode) { + set_source_to_flash(dparam->freq_params); + dparam->header.checksum = compute_checksum(dparam); + dparam_ops->write_to_flash(dparam); + printk(BIOS_DEBUG, "Calibration params saved to flash: " + "version=%#x, size=%#x\n", + dparam->header.version, dparam->header.size); + } return; }