Yu-Ping Wu has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/36090 )
Change subject: soc/mediatek/mt8183: Force DRAM retraining if hotkey pressed ......................................................................
soc/mediatek/mt8183: Force DRAM retraining if hotkey pressed
Similar to MRC cache on x86 platforms, when a hotkey is pressed during boot, the calibration data cache saved in the flash will be cleared, consequently triggering DRAM retraining (full calibration) in the next boot.
BRANCH=kukui BUG=b:139099592 TEST=emerge-kukui coreboot
Change-Id: I2f9225f359e1fe5733e8e1c48b396aaeeb9a58ab Signed-off-by: Yu-Ping Wu yupingso@chromium.org --- M src/soc/mediatek/mt8183/memory.c 1 file changed, 10 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/90/36090/1
diff --git a/src/soc/mediatek/mt8183/memory.c b/src/soc/mediatek/mt8183/memory.c index 5c10f49..5aa42c6 100644 --- a/src/soc/mediatek/mt8183/memory.c +++ b/src/soc/mediatek/mt8183/memory.c @@ -14,6 +14,7 @@ */
#include <assert.h> +#include <bootmode.h> #include <cbfs.h> #include <console/console.h> #include <ip_checksum.h> @@ -21,6 +22,7 @@ #include <soc/dramc_param.h> #include <soc/dramc_pi_api.h> #include <soc/emi.h> +#include <string.h> #include <symbols.h>
static int mt_mem_test(void) @@ -165,6 +167,14 @@ config |= DRAMC_CONFIG_EMCP;
const bool recovery_mode = vboot_recovery_mode_enabled(); + const bool force_retrain = get_recovery_mode_retrain_switch(); + + /* Clean flash to force retrain on next boot */ + if (recovery_mode && force_retrain) { + printk(BIOS_INFO, "Cleaning calibration data in flash\n"); + memset(dparam, 0, sizeof(*dparam)); + dparam_ops->write_to_flash(dparam); + }
/* Load calibration params from flash and run fast calibration */ if (!recovery_mode) {