summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPatrick Rudolph <siro@das-labor.org>2017-10-31 10:49:52 +0100
committerPatrick Rudolph <siro@das-labor.org>2018-07-25 13:18:26 +0000
commit5ee9bc18407e4c2cad8e1c9e222ca16051d4b9b4 (patch)
treea06559c25282d4ca3b0dca9465e5a9a86bac47a8 /src
parent8c85880236d57abf05fb2578a97a3e6dd52e7b7c (diff)
nb/intel/sandybridge/raminit: Set REFIx9 according to spec
Set tREFIx9 to 8.9*tREFI/1024 as suggested in xeon-e3-1200v3-vol-2-datasheet.pdf chapter 4.2.15 or 2nd-gen-core-family-mobile-vol-2-datasheet chapter 2.14.1. Use the minimum value of REFI*8.9 and tRASmax as suggested by 3rd-gen-core-desktop-vol-2-datasheet.pdf chapter 2.13.9. Change-Id: Ifd32a70f28aa75418030b0e4d1fc7d539a315f83 Signed-off-by: Patrick Rudolph <siro@das-labor.org> Reviewed-on: https://review.coreboot.org/22259 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Diffstat (limited to 'src')
-rw-r--r--src/northbridge/intel/sandybridge/raminit_common.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/northbridge/intel/sandybridge/raminit_common.c b/src/northbridge/intel/sandybridge/raminit_common.c
index b82075e58b..5cf9b69873 100644
--- a/src/northbridge/intel/sandybridge/raminit_common.c
+++ b/src/northbridge/intel/sandybridge/raminit_common.c
@@ -264,16 +264,18 @@ void dram_timing_regs(ramctr_timing *ctrl)
dram_odt_stretch(ctrl, channel);
- // REFI
- reg = 0;
- val32 = ctrl->tREFI;
- reg = (reg & ~0xffff) | val32;
- val32 = ctrl->tRFC;
- reg = (reg & ~0x1ff0000) | (val32 << 16);
- val32 = (u32) (ctrl->tREFI * 9) / 1024;
- reg = (reg & ~0xfe000000) | (val32 << 25);
- printram("REFI [%x] = %x\n", 0x400 * channel + 0x4298,
- reg);
+ /*
+ * TC—Refresh timing parameters
+ * The tREFIx9 field should be programmed to minimum of
+ * 8.9*tREFI (to allow for possible delays from ZQ or
+ * isoc) and tRASmax (70us) divided by 1024.
+ */
+ val32 = MIN((ctrl->tREFI * 89) / 10, (70000 << 8) / ctrl->tCK);
+
+ reg = ((ctrl->tREFI & 0xffff) << 0) |
+ ((ctrl->tRFC & 0x1ff) << 16) |
+ (((val32 / 1024) & 0x7f) << 25);
+ printram("REFI [%x] = %x\n", 0x400 * channel + 0x4298, reg);
MCHBAR32(0x400 * channel + 0x4298) = reg;
MCHBAR32(0x400 * channel + 0x4294) |= 0xff;