ARM: AM43xx: Add support for RTC only + DDR in self-refresh mode

Kernel stores information to the RTC_SCRATCH0 and RTC_SCRATCH1 registers
for wakeup from RTC-only mode with DDR in self-refresh. Parse these
registers during SPL boot and jump to the kernel resume vector if the
device is waking up from RTC-only modewith DDR in Self-refresh.

The RTC scratch register layout used is:

SCRATCH0 : bits00-31 : kernel resume address
SCRATCH1 : bits00-15 : RTC magic value used to detect valid config
SCRATCH1 : bits16-31 : board type information populated by bootloader

During the normal boot path the SCRATCH1 : bits16-31 are updated with
the eeprom read board type data. In the rtc_only boot path the rtc
scratchpad register is read and the board type is determined and
correspondingly ddr dpll parameters are set. This is done so as to avoid
costly i2c read to eeprom.

RTC-only +DRR in self-refresh mode support is currently only enabled for
am43xx_evm_rtconly_config.
This is not to be used with epos evm builds.

Signed-off-by: Tero Kristo <t-kristo@ti.com>
[j-keerthy@ti.com Rebased to latest u-boot master branch]
Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
diff --git a/arch/arm/mach-omap2/am33xx/Kconfig b/arch/arm/mach-omap2/am33xx/Kconfig
index 9a9ccd7..76da6d9 100644
--- a/arch/arm/mach-omap2/am33xx/Kconfig
+++ b/arch/arm/mach-omap2/am33xx/Kconfig
@@ -239,6 +239,20 @@
 
 endchoice
 
+config SPL_RTC_DDR_SUPPORT
+	bool
+	depends on SPL
+	prompt "Enable RTC-DDR ONLY Support"
+	help
+	  If you want RTC-DDR ONLY Support, say Y. RTC Only with DDR in
+	  self-refresh mode is a special power saving mode where in all
+	  the other voltages are turned off apart from the RTC domain and DDR.
+	  So only RTC is alive and ticking and one can program it to wake
+	  up after a predetermined period. Once RTC alarm fires, the PMIC
+	  powers up all the voltage domains. U-Boot takes a special path
+	  as the DDR has contents is in self-refresh and restore path is
+	  followed.
+
 endif
 
 if AM43XX || AM33XX