From a951d4dba265a3486f737205a05384aada6ca35e Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Tue, 2 Aug 2016 14:04:59 -0700 Subject: [PATCH] UPSTREAM: drivers/intel/fsp2_0: Ensure EC is in right mode before memory init If EC_GOOGLE_CHROMEEC is enabled, ensure that the EC is in correct mode before running memory init. This saves additional memory training required in recovery path because of reboot later in ramstage. BUG=chrome-os-partner:54245 BRANCH=None TEST=None Change-Id: I95b25327e4ec8b3c8784dbd34ff150c8c82864ea Signed-off-by: Furquan Shaikh Reviewed-on: https://review.coreboot.org/16034 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin Reviewed-on: https://chromium-review.googlesource.com/368712 Commit-Ready: Furquan Shaikh Tested-by: Furquan Shaikh --- src/drivers/intel/fsp2_0/memory_init.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/drivers/intel/fsp2_0/memory_init.c b/src/drivers/intel/fsp2_0/memory_init.c index 1957cdb952..e545b6d155 100644 --- a/src/drivers/intel/fsp2_0/memory_init.c +++ b/src/drivers/intel/fsp2_0/memory_init.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -295,6 +296,14 @@ void fsp_memory_init(bool s3wake) if (IS_ENABLED(CONFIG_ELOG_BOOT_COUNT) && !s3wake) boot_count_increment(); + /* + * Before doing any memory init/training, ensure that the EC is in the + * right mode. This saves an additional memory training when in recovery + * mode. + */ + if (IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC)) + google_chromeec_early_init(); + if (cbfs_boot_locate(&file_desc, name, NULL)) { printk(BIOS_CRIT, "Could not locate %s in CBFS\n", name); die("FSPM not available!\n");