From b6a2ebe5ef08d2544446968851fa98f05357157f Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Sun, 28 Mar 2021 18:52:14 +0200 Subject: [PATCH] nb/intel/x4x: Sort code in program_dll() Move the last block of the sync DLL programming up. It's independent of the switch/case statement that it's moved around. Change-Id: I71bc1ca1c629e4f2f4a13474c7e2c22d1a3b65d9 Signed-off-by: Nico Huber Reviewed-on: https://review.coreboot.org/c/coreboot/+/51904 Tested-by: build bot (Jenkins) Reviewed-by: Arthur Heymans Reviewed-by: Angel Pons --- src/northbridge/intel/x4x/raminit_ddr23.c | 32 +++++++++++------------ 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/northbridge/intel/x4x/raminit_ddr23.c b/src/northbridge/intel/x4x/raminit_ddr23.c index e5e17d14d5..b3321d5bf2 100644 --- a/src/northbridge/intel/x4x/raminit_ddr23.c +++ b/src/northbridge/intel/x4x/raminit_ddr23.c @@ -880,6 +880,22 @@ static void program_dll(struct sysinfo *s) printk(BIOS_NOTICE, "HMC failed, using async mode\n"); } + mchbar_clrbits8(0x180, 1 << 7); + + if ((s->spd_type == DDR3 && s->selected_timings.mem_clk == MEM_CLOCK_1066MHz) + || (s->spd_type == DDR2 && s->selected_timings.fsb_clk == FSB_CLOCK_800MHz + && s->selected_timings.mem_clk == MEM_CLOCK_667MHz)) { + i = mchbar_read8(0x1c8) & 0xf; + if (s->spd_type == DDR2) + i = (i + 10) % 14; + else /* DDR3 */ + i = (i + 3) % 12; + mchbar_clrsetbits8(0x1c8, 0x1f, i); + mchbar_setbits8(0x180, 1 << 4); + while (mchbar_read8(0x180) & (1 << 4)) + ; + } + switch (s->selected_timings.mem_clk) { case MEM_CLOCK_667MHz: clk = 0x1a; @@ -903,22 +919,6 @@ static void program_dll(struct sysinfo *s) break; } - mchbar_clrbits8(0x180, 1 << 7); - - if ((s->spd_type == DDR3 && s->selected_timings.mem_clk == MEM_CLOCK_1066MHz) - || (s->spd_type == DDR2 && s->selected_timings.fsb_clk == FSB_CLOCK_800MHz - && s->selected_timings.mem_clk == MEM_CLOCK_667MHz)) { - i = mchbar_read8(0x1c8) & 0xf; - if (s->spd_type == DDR2) - i = (i + 10) % 14; - else /* DDR3 */ - i = (i + 3) % 12; - mchbar_clrsetbits8(0x1c8, 0x1f, i); - mchbar_setbits8(0x180, 1 << 4); - while (mchbar_read8(0x180) & (1 << 4)) - ; - } - reg8 = mchbar_read8(0x188) & ~1; mchbar_write8(0x188, reg8); reg8 &= ~0x3e;