Comments
Patch
===================================================================
@@ -26,6 +26,8 @@
#define BAR 0x90000000
+static unsigned ecc_capable;
+
static void sdram_set_registers(const struct mem_controller *ctrl)
{
static const u32 register_values[] = {
@@ -423,8 +425,8 @@
continue;
if ((spd_read_byte(ctrl->channel0[i], SPD_MODULE_DATA_WIDTH_LSB) & 0xf0) != 0x40)
die("ERROR: Only 64-bit DIMMs supported\n");
- if (!(spd_read_byte(ctrl->channel0[i], SPD_DIMM_CONFIG_TYPE) & 0x02))
- die("ERROR: Only ECC DIMMs supported\n");
+ if (spd_read_byte(ctrl->channel0[i], SPD_DIMM_CONFIG_TYPE) & 0x02)
+ ecc_capable = 1;
if (spd_read_byte(ctrl->channel0[i], SPD_PRIMARY_SDRAM_WIDTH) != 0x08)
die("ERROR: Only x8 DIMMs supported\n");
@@ -436,7 +438,10 @@
print_debug_hex8(cycle);
print_debug("\n");
- drc |= (1 << 20); /* enable ECC */
+ if (ecc_capable)
+ drc |= (1 << 20); /* enable ECC */
+ else
+ drc &= ~(1 << 20); /* disable ECC */
drc |= (3 << 30); /* enable CKE on each DIMM */
drc |= (1 << 4); /* enable CKE globally */
@@ -756,7 +761,11 @@
print_debug("clear memory CS");
print_debug_hex8(cs);
print_debug("\n");
- write32(BAR+MBCSR, 0xa00000f0 | ((cs+1)<<20) | (0<<16));
+ if (ecc_capable)
+ data32 = ((cs+1)<<20);
+ else
+ data32 = ~((cs+1)<<20);
+ write32(BAR+MBCSR, 0xa00000f0 | (data32 | (0<<16));
data32 = read32(BAR+MBCSR);
while (data32 & 0x80000000)
data32 = read32(BAR+MBCSR);