t210: new sdram_lp0_save_params() function

New sdram_lp0_save_params() function for T210.

Due to its size, move the function from romstage to ramstage.

BUG=chrome-os-partner:40741
BRANCH=None
TEST=Build ok on Smaug; and check scratch registers

Change-Id: I420ac4c15262f2c6307bcd84beb6c5da0310c7c0
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 38860895938c40062a9f860f75e31a539f15992b
Original-Change-Id: Iaa478969458946faedd295578fe7d72b5a32e701
Original-Signed-off-by: Yen Lin <yelin@nvidia.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/277022
Original-Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: http://review.coreboot.org/10952
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
diff --git a/src/soc/nvidia/tegra210/soc.c b/src/soc/nvidia/tegra210/soc.c
index 7d91bc5..829acb2 100644
--- a/src/soc/nvidia/tegra210/soc.c
+++ b/src/soc/nvidia/tegra210/soc.c
@@ -36,6 +36,8 @@
 #include <string.h>
 #include <timer.h>
 #include <vendorcode/google/chromeos/chromeos.h>
+#include <soc/sdram.h>
+#include <soc/sdram_configs.h>
 
 #include "chip.h"
 
@@ -144,6 +146,10 @@
 
 	printk(BIOS_INFO, "chip %x rev %02x.%x\n",
 		rev.chip_id, rev.major, rev.minor);
+
+	/* Save sdram parameters to scratch regs to be used in LP0 resume */
+	sdram_lp0_save_params(get_sdram_config());
+	printk(BIOS_INFO, "sdram params saved.\n");
 }
 
 struct chip_operations soc_nvidia_tegra210_ops = {