aboutsummaryrefslogtreecommitdiff
path: root/src/northbridge/intel/sandybridge/raminit_common.c
diff options
context:
space:
mode:
authorPatrick Rudolph <siro@das-labor.org>2017-11-20 11:57:01 +0100
committerFelix Held <felix-coreboot@felixheld.de>2018-07-28 16:00:42 +0000
commit74203de85185842f90ff1708b4f16445cc279688 (patch)
tree4ced98a0ea62d32dd8fb22686085b219f07e0bf4 /src/northbridge/intel/sandybridge/raminit_common.c
parent2a7be5bf3061fe8ccd5505f08489ea4671b61f20 (diff)
intel/sandybridge: Don't hardcode platform type
* Add a function to return CPU platform ID bits * Add a function to return platform type ** Platform id is 4 on Lenovo T430 (mobile) ** Platform id is 1 on HP8200 (desktop) * Use introduced method to handle platform specific code * Use enum for platform type * Report platform ID Change-Id: Ifbfc64c8cec98782d6efc987a4d4d5aeab1402ba Signed-off-by: Patrick Rudolph <siro@das-labor.org> Reviewed-on: https://review.coreboot.org/22530 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Diffstat (limited to 'src/northbridge/intel/sandybridge/raminit_common.c')
-rw-r--r--src/northbridge/intel/sandybridge/raminit_common.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/northbridge/intel/sandybridge/raminit_common.c b/src/northbridge/intel/sandybridge/raminit_common.c
index 44f7f6d82c..8964e3fcd2 100644
--- a/src/northbridge/intel/sandybridge/raminit_common.c
+++ b/src/northbridge/intel/sandybridge/raminit_common.c
@@ -763,6 +763,7 @@ static u32 make_mr0(ramctr_timing * ctrl, u8 rank)
{
u16 mr0reg, mch_cas, mch_wr;
static const u8 mch_wr_t[12] = { 1, 2, 3, 4, 0, 5, 0, 6, 0, 7, 0, 0 };
+ const size_t is_mobile = get_platform_type() == PLATFORM_MOBILE;
/* DLL Reset - self clearing - set after CLK frequency has been changed */
mr0reg = 0x100;
@@ -783,7 +784,7 @@ static u32 make_mr0(ramctr_timing * ctrl, u8 rank)
mr0reg = (mr0reg & ~0xe00) | (mch_wr << 9);
// Precharge PD - Fast (desktop) 0x1 or slow (mobile) 0x0 - mostly power-saving feature
- mr0reg = (mr0reg & ~0x1000) | (!ctrl->mobile << 12);
+ mr0reg = (mr0reg & ~0x1000) | (!is_mobile << 12);
return mr0reg;
}
@@ -3193,6 +3194,8 @@ static int encode_5d10(int ns)
/* FIXME: values in this function should be hardware revision-dependent. */
void final_registers(ramctr_timing * ctrl)
{
+ const size_t is_mobile = get_platform_type() == PLATFORM_MOBILE;
+
int channel;
int t1_cycles = 0, t1_ns = 0, t2_ns;
int t3_ns;
@@ -3203,7 +3206,7 @@ void final_registers(ramctr_timing * ctrl)
write32(DEFAULT_MCHBAR + 0x400c, (read32(DEFAULT_MCHBAR + 0x400c) & 0xFFFFCFFF) | 0x1000); // OK
write32(DEFAULT_MCHBAR + 0x440c, (read32(DEFAULT_MCHBAR + 0x440c) & 0xFFFFCFFF) | 0x1000); // OK
- if (ctrl->mobile)
+ if (is_mobile)
/* APD - DLL Off, 64 DCLKs until idle, decision per rank */
MCHBAR32(PM_PDWN_Config) = 0x00000740;
else