Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/47617 )
Change subject: nb/intel/sandybridge: Encapsulate JEDEC write leveling
......................................................................
nb/intel/sandybridge: Encapsulate JEDEC write leveling
Create and rename a few functions to contain the entire JEDEC write
leveling algorithm. Not all write training is JEDEC write leveling.
Tested on Asus P8H61-M PRO, still boots.
Change-Id: Ie9c6315340164029e30354723b4103d906633602
Signed-off-by: Angel Pons <th3fanbus(a)gmail.com>
---
M src/northbridge/intel/sandybridge/raminit_common.c
1 file changed, 19 insertions(+), 8 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/17/47617/1
diff --git a/src/northbridge/intel/sandybridge/raminit_common.c b/src/northbridge/intel/sandybridge/raminit_common.c
index cff7e8b..2799103 100644
--- a/src/northbridge/intel/sandybridge/raminit_common.c
+++ b/src/northbridge/intel/sandybridge/raminit_common.c
@@ -1714,7 +1714,7 @@
}
}
-static int discover_timB(ramctr_timing *ctrl, int channel, int slotrank)
+static int write_level_rank(ramctr_timing *ctrl, int channel, int slotrank)
{
int timB;
int statistics[NUM_LANES][128];
@@ -1960,13 +1960,9 @@
* the DRAM-chip samples the CLK on every DQS edge and feeds back the sampled value on the data
* lanes (DQ).
*/
-int write_training(ramctr_timing *ctrl)
+static int jedec_write_leveling(ramctr_timing *ctrl)
{
- int channel, slotrank, lane;
- int err;
-
- FOR_ALL_POPULATED_CHANNELS
- MCHBAR32_OR(TC_RWP_ch(channel), 1 << 27);
+ int channel, slotrank;
disable_refresh_machine(ctrl);
@@ -1989,7 +1985,7 @@
/* Set any valid value for timB, it gets corrected later */
FOR_ALL_CHANNELS FOR_ALL_POPULATED_RANKS {
- err = discover_timB(ctrl, channel, slotrank);
+ const int err = write_level_rank(ctrl, channel, slotrank);
if (err)
return err;
}
@@ -2021,6 +2017,21 @@
toggle_io_reset();
+ return 0;
+}
+
+int write_training(ramctr_timing *ctrl)
+{
+ int channel, slotrank, lane;
+ int err;
+
+ FOR_ALL_POPULATED_CHANNELS
+ MCHBAR32_OR(TC_RWP_ch(channel), 1 << 27);
+
+ err = jedec_write_leveling(ctrl);
+ if (err)
+ return err;
+
printram("CPE\n");
precharge(ctrl);
printram("CPF\n");
--
To view, visit https://review.coreboot.org/c/coreboot/+/47617
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ie9c6315340164029e30354723b4103d906633602
Gerrit-Change-Number: 47617
Gerrit-PatchSet: 1
Gerrit-Owner: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Patrick Rudolph <siro(a)das-labor.org>
Gerrit-MessageType: newchange
Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/47576 )
Change subject: nb/intel/sandybridge: Rename `read_training` function
......................................................................
nb/intel/sandybridge: Rename `read_training` function
Given that it sets the receive enable mode bit in the GDCRTRAININGMOD
register, it's clear that this is about receive enable calibration.
Change-Id: Iaefc8905adf2878bec3b43494dc53530064a9f5d
Signed-off-by: Angel Pons <th3fanbus(a)gmail.com>
---
M src/northbridge/intel/sandybridge/raminit_common.c
M src/northbridge/intel/sandybridge/raminit_common.h
M src/northbridge/intel/sandybridge/raminit_native.c
3 files changed, 3 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/76/47576/1
diff --git a/src/northbridge/intel/sandybridge/raminit_common.c b/src/northbridge/intel/sandybridge/raminit_common.c
index f20181e..9da5a97 100644
--- a/src/northbridge/intel/sandybridge/raminit_common.c
+++ b/src/northbridge/intel/sandybridge/raminit_common.c
@@ -1307,7 +1307,7 @@
* Once the controller has detected this pattern a bit in the result register is set for the
* current phase shift.
*/
-int read_training(ramctr_timing *ctrl)
+int receive_enable_calibration(ramctr_timing *ctrl)
{
int channel, slotrank, lane;
int err;
diff --git a/src/northbridge/intel/sandybridge/raminit_common.h b/src/northbridge/intel/sandybridge/raminit_common.h
index de74af5..5227536 100644
--- a/src/northbridge/intel/sandybridge/raminit_common.h
+++ b/src/northbridge/intel/sandybridge/raminit_common.h
@@ -400,7 +400,7 @@
void dram_zones(ramctr_timing *ctrl, int training);
void dram_memorymap(ramctr_timing *ctrl, int me_uma_size);
void dram_jedecreset(ramctr_timing *ctrl);
-int read_training(ramctr_timing *ctrl);
+int receive_enable_calibration(ramctr_timing *ctrl);
int write_training(ramctr_timing *ctrl);
int command_training(ramctr_timing *ctrl);
int discover_edges(ramctr_timing *ctrl);
diff --git a/src/northbridge/intel/sandybridge/raminit_native.c b/src/northbridge/intel/sandybridge/raminit_native.c
index 53017eb..20009cb 100644
--- a/src/northbridge/intel/sandybridge/raminit_native.c
+++ b/src/northbridge/intel/sandybridge/raminit_native.c
@@ -680,7 +680,7 @@
/* Prepare for memory training */
prepare_training(ctrl);
- err = read_training(ctrl);
+ err = receive_enable_calibration(ctrl);
if (err)
return err;
--
To view, visit https://review.coreboot.org/c/coreboot/+/47576
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Iaefc8905adf2878bec3b43494dc53530064a9f5d
Gerrit-Change-Number: 47576
Gerrit-PatchSet: 1
Gerrit-Owner: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-MessageType: newchange