summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/northbridge/intel/sandybridge/raminit_common.c97
1 files changed, 52 insertions, 45 deletions
diff --git a/src/northbridge/intel/sandybridge/raminit_common.c b/src/northbridge/intel/sandybridge/raminit_common.c
index 95e7718bbf..0eb966d2fd 100644
--- a/src/northbridge/intel/sandybridge/raminit_common.c
+++ b/src/northbridge/intel/sandybridge/raminit_common.c
@@ -2350,74 +2350,81 @@ static int discover_edges_real(ramctr_timing *ctrl, int channel, int slotrank, i
return 0;
}
-int discover_edges(ramctr_timing *ctrl)
+static void find_predefined_pattern(ramctr_timing *ctrl, const int channel)
{
- int falling_edges[NUM_CHANNELS][NUM_SLOTRANKS][NUM_LANES];
- int rising_edges[NUM_CHANNELS][NUM_SLOTRANKS][NUM_LANES];
- int channel, slotrank, lane;
- int err;
+ int slotrank, lane;
- MCHBAR32(GDCRTRAININGMOD) = 0;
-
- toggle_io_reset();
+ fill_pattern0(ctrl, channel, 0, 0);
+ FOR_ALL_LANES {
+ MCHBAR32(IOSAV_By_BW_SERROR_C_ch(channel, lane));
+ }
- FOR_ALL_POPULATED_CHANNELS FOR_ALL_LANES {
- MCHBAR32(IOSAV_By_BW_MASK_ch(channel, lane)) = 0;
+ FOR_ALL_POPULATED_RANKS FOR_ALL_LANES {
+ ctrl->timings[channel][slotrank].lanes[lane].falling = 16;
+ ctrl->timings[channel][slotrank].lanes[lane].rising = 16;
}
- FOR_ALL_POPULATED_CHANNELS {
- fill_pattern0(ctrl, channel, 0, 0);
- FOR_ALL_LANES {
- MCHBAR32(IOSAV_By_BW_SERROR_C_ch(channel, lane));
- }
+ program_timings(ctrl, channel);
- FOR_ALL_POPULATED_RANKS FOR_ALL_LANES {
- ctrl->timings[channel][slotrank].lanes[lane].falling = 16;
- ctrl->timings[channel][slotrank].lanes[lane].rising = 16;
- }
+ FOR_ALL_POPULATED_RANKS {
+ wait_for_iosav(channel);
- program_timings(ctrl, channel);
+ iosav_write_read_mpr_sequence(
+ channel, slotrank, ctrl->tMOD, 3, 4, 1, ctrl->CAS + 8);
- FOR_ALL_POPULATED_RANKS {
- wait_for_iosav(channel);
+ /* Execute command queue */
+ iosav_run_once(channel);
- iosav_write_read_mpr_sequence(
- channel, slotrank, ctrl->tMOD, 3, 4, 1, ctrl->CAS + 8);
+ wait_for_iosav(channel);
+ }
- /* Execute command queue */
- iosav_run_once(channel);
+ /* XXX: check any measured value ? */
- wait_for_iosav(channel);
- }
+ FOR_ALL_POPULATED_RANKS FOR_ALL_LANES {
+ ctrl->timings[channel][slotrank].lanes[lane].falling = 48;
+ ctrl->timings[channel][slotrank].lanes[lane].rising = 48;
+ }
- /* XXX: check any measured value ? */
+ program_timings(ctrl, channel);
- FOR_ALL_POPULATED_RANKS FOR_ALL_LANES {
- ctrl->timings[channel][slotrank].lanes[lane].falling = 48;
- ctrl->timings[channel][slotrank].lanes[lane].rising = 48;
- }
+ FOR_ALL_POPULATED_RANKS {
+ wait_for_iosav(channel);
- program_timings(ctrl, channel);
+ iosav_write_read_mpr_sequence(
+ channel, slotrank, ctrl->tMOD, 3, 4, 1, ctrl->CAS + 8);
- FOR_ALL_POPULATED_RANKS {
- wait_for_iosav(channel);
+ /* Execute command queue */
+ iosav_run_once(channel);
- iosav_write_read_mpr_sequence(
- channel, slotrank, ctrl->tMOD, 3, 4, 1, ctrl->CAS + 8);
+ wait_for_iosav(channel);
+ }
- /* Execute command queue */
- iosav_run_once(channel);
+ /* XXX: check any measured value ? */
- wait_for_iosav(channel);
- }
+ FOR_ALL_LANES {
+ MCHBAR32(IOSAV_By_BW_MASK_ch(channel, lane)) =
+ ~MCHBAR32(IOSAV_By_BW_SERROR_ch(channel, lane)) & 0xff;
+ }
+}
+
+int discover_edges(ramctr_timing *ctrl)
+{
+ int falling_edges[NUM_CHANNELS][NUM_SLOTRANKS][NUM_LANES];
+ int rising_edges[NUM_CHANNELS][NUM_SLOTRANKS][NUM_LANES];
+ int channel, slotrank, lane;
+ int err;
- /* XXX: check any measured value ? */
+ MCHBAR32(GDCRTRAININGMOD) = 0;
+ toggle_io_reset();
+
+ FOR_ALL_POPULATED_CHANNELS {
FOR_ALL_LANES {
- MCHBAR32(IOSAV_By_BW_MASK_ch(channel, lane)) =
- ~MCHBAR32(IOSAV_By_BW_SERROR_ch(channel, lane)) & 0xff;
+ MCHBAR32(IOSAV_By_BW_MASK_ch(channel, lane)) = 0;
}
+ find_predefined_pattern(ctrl, channel);
+
fill_pattern0(ctrl, channel, 0, 0xffffffff);
}