soc/mediatek/mt8183: Force retraining memory if requested

To allow retraining memory without hotkey (for example in manufacturing
process), we want to enforce re-training when the recovery reason is set
to VB2_RECOVERY_TRAIN_AND_REBOOT (which can be done by running
 "crossystem recovery_request=0xc4").

The special reason was created for X86 MRC cache, for ensuring RO
calibration data is filled (the underlying implementation was in vboot,
not coreboot); and on MT8183 we have only RW calibration, but it seems
totally fine to extend that for RW.

BRANCH=kukui
BUG=None
TEST=boots; crossystem recovery_reason=0xc4; reboot

Change-Id: Iaa5275f0e0eb90f6ab3a7d4579977a6655d59bd9
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/36251
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Hung-Te Lin 2019-10-23 14:20:53 +08:00 committed by Patrick Georgi
parent 7f1da07849
commit 285975dbba
1 changed files with 2 additions and 1 deletions

View File

@ -169,7 +169,8 @@ void mt_mem_init(struct dramc_param_ops *dparam_ops)
/* Load calibration params from flash and run fast calibration */ /* Load calibration params from flash and run fast calibration */
if (recovery_mode) { if (recovery_mode) {
printk(BIOS_WARNING, "Skip loading cached calibration data\n"); printk(BIOS_WARNING, "Skip loading cached calibration data\n");
if (vboot_recovery_mode_memory_retrain()) { if (vboot_recovery_mode_memory_retrain() ||
vboot_check_recovery_request() == VB2_RECOVERY_TRAIN_AND_REBOOT) {
printk(BIOS_WARNING, "Retrain memory in next boot\n"); printk(BIOS_WARNING, "Retrain memory in next boot\n");
/* Use 0xFF as erased flash data. */ /* Use 0xFF as erased flash data. */
memset(dparam, 0xff, sizeof(*dparam)); memset(dparam, 0xff, sizeof(*dparam));