nb/i945/raminit: Correct C0DRAMW & C1DRAMW for 4 DIMMs

Change-Id: Ib1f999447b37a1524d589552ea2eec640c2a2c7e
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/18387
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
This commit is contained in:
Elyes HAOUAS 2018-06-30 10:39:24 +02:00 committed by Patrick Georgi
parent 34510c377e
commit a4fc7bef7f
1 changed files with 37 additions and 30 deletions

View File

@ -629,43 +629,50 @@ static void sdram_get_dram_configuration(struct sys_info *sysinfo)
static void sdram_program_dram_width(struct sys_info *sysinfo) static void sdram_program_dram_width(struct sys_info *sysinfo)
{ {
u16 c0dramw = 0, c1dramw = 0; u16 c0dramw = 0, c1dramw = 0;
int idx; int i, idx;
if (sysinfo->dual_channel) if (sysinfo->dual_channel)
idx = 2; idx = 2;
else else
idx = 1; idx = 1;
switch (sysinfo->dimm[0]) { for (i = 0; i < DIMM_SOCKETS; i++) { /* Channel 0 */
case SYSINFO_DIMM_X16DS: switch (sysinfo->dimm[i]) {
c0dramw = 0x0000; break; case SYSINFO_DIMM_X16DS:
case SYSINFO_DIMM_X8DS: c0dramw |= (0x0000) << 4*(i % 2);
c0dramw = 0x0001; break; break;
case SYSINFO_DIMM_X16SS: case SYSINFO_DIMM_X8DS:
c0dramw = 0x0000; break; c0dramw |= (0x0001) << 4*(i % 2);
case SYSINFO_DIMM_X8DDS: break;
c0dramw = 0x0005; break; case SYSINFO_DIMM_X16SS:
case SYSINFO_DIMM_NOT_POPULATED: c0dramw |= (0x0000) << 4*(i % 2);
c0dramw = 0x0000; break; break;
case SYSINFO_DIMM_X8DDS:
c0dramw |= (0x0005) << 4*(i % 2);
break;
case SYSINFO_DIMM_NOT_POPULATED:
c0dramw |= (0x0000) << 4*(i % 2);
break;
}
} }
for (i = DIMM_SOCKETS; i < idx * DIMM_SOCKETS; i++) { /* Channel 1 */
switch (sysinfo->dimm[idx]) { switch (sysinfo->dimm[i]) {
case SYSINFO_DIMM_X16DS: case SYSINFO_DIMM_X16DS:
c1dramw = 0x0000; break; c1dramw |= (0x0000) << 4*(i % 2);
case SYSINFO_DIMM_X8DS: break;
c1dramw = 0x0010; break; case SYSINFO_DIMM_X8DS:
case SYSINFO_DIMM_X16SS: c1dramw |= (0x0001) << 4*(i % 2);
c1dramw = 0x0000; break; break;
case SYSINFO_DIMM_X8DDS: case SYSINFO_DIMM_X16SS:
c1dramw = 0x0050; break; c1dramw |= (0x0000) << 4*(i % 2);
case SYSINFO_DIMM_NOT_POPULATED: break;
c1dramw = 0x0000; break; case SYSINFO_DIMM_X8DDS:
} c1dramw |= (0x0005) << 4*(i % 2);
break;
if (!sdram_capabilities_dual_channel()) { case SYSINFO_DIMM_NOT_POPULATED:
/* Single Channel */ c1dramw |= (0x0000) << 4*(i % 2);
c0dramw |= c1dramw; break;
c1dramw = 0; }
} }
MCHBAR16(C0DRAMW) = c0dramw; MCHBAR16(C0DRAMW) = c0dramw;