nb/intel/sandybridge: Refine power-down mode logic

When memory is running at fast frequencies, power-down modes can lessen
system stability. Check tXP and tXPDLL values and use safer power down
modes if their values are high. Do not use APD with DLL-off on mobile:
vendor firmware does not use it, and it can influence system stability.

Change-Id: Ic8e98162ca86ae454a8c951be163d58960940e0e
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/47746
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/src/northbridge/intel/sandybridge/Kconfig b/src/northbridge/intel/sandybridge/Kconfig
index ef6dc3d..9cd522f 100644
--- a/src/northbridge/intel/sandybridge/Kconfig
+++ b/src/northbridge/intel/sandybridge/Kconfig
@@ -99,6 +99,15 @@
 	hex
 	default 0x0
 
+config RAMINIT_ALWAYS_ALLOW_DLL_OFF
+	bool "Also enable memory DLL-off mode on desktops and servers"
+	default n
+	help
+	  If enabled, allow enabling DLL-off mode for platforms other than
+	  mobile. Saves power at the expense of higher exit latencies. Has
+	  no effect on mobile platforms, where DLL-off is always allowed.
+	  Power down is disabled for stability when running at high clocks.
+
 config RAMINIT_ENABLE_ECC
 	bool "Enable ECC if supported"
 	default y