hw_err:
sz.side1 = 0;
sz.side2 = 0;
- out:
+out:
return sz;
}
/* If an hw_error occurs report that I have no memory */
hw_err:
dra = 0;
- out:
+out:
return dra;
}
/* If an hw_error occurs report that I have no memory */
hw_err:
drc = 0;
- out:
+out:
return drc;
}
u32 drc;
u32 data32;
u32 mode_reg;
- u32 const *iptr;
+ const u32 *iptr;
u16 data16;
static const struct {
u32 clkgr[4];
print_debug("Starting SDRAM Enable\n");
/* 0x80 */
-#ifdef DIMM_MAP_LOGICAL
pci_write_config32(ctrl->f0, DRM,
- 0x00410000 | DIMM_MAP_LOGICAL);
-#else
- pci_write_config32(ctrl->f0, DRM, 0x00411248);
-#endif
+ 0x00410000 | CONFIG_DIMM_MAP_LOGICAL);
/* set dram type and Front Side Bus freq. */
drc = spd_set_dram_controller_mode(ctrl, mask);
if( drc == 0) {
write32(MCBAR+DCALCSR, (0x01000000 | (i<<20)));
write32(MCBAR+DCALCSR, (0x81000000 | (i<<20)));
- data32 = read32(MCBAR+DCALCSR);
- while(data32 & 0x80000000)
- data32 = read32(MCBAR+DCALCSR);
+ do data32 = read32(MCBAR+DCALCSR);
+ while(data32 & 0x80000000);
}
/* Apply NOP */
for(cs=0;cs<8;cs+=2) {
write32(MCBAR + DCALCSR, (0x81000000 | (cs<<20)));
- data32 = read32(MCBAR+DCALCSR);
- while(data32 & 0x80000000)
- data32 = read32(MCBAR+DCALCSR);
+ do data32 = read32(MCBAR+DCALCSR);
+ while(data32 & 0x80000000);
}
/* Precharg all banks */
for(cs=0;cs<8;cs+=2) {
write32(MCBAR+DCALADDR, 0x04000000);
write32(MCBAR+DCALCSR, (0x81000002 | (cs<<20)));
- data32 = read32(MCBAR+DCALCSR);
- while(data32 & 0x80000000)
- data32 = read32(MCBAR+DCALCSR);
+ do data32 = read32(MCBAR+DCALCSR);
+ while(data32 & 0x80000000);
}
/* EMRS dll's enabled */
/* fixme hard code AL additive latency */
write32(MCBAR+DCALADDR, 0x0b940001);
write32(MCBAR+DCALCSR, (0x81000003 | (cs<<20)));
- data32 = read32(MCBAR+DCALCSR);
- while(data32 & 0x80000000)
- data32 = read32(MCBAR+DCALCSR);
+ do data32 = read32(MCBAR+DCALCSR);
+ while(data32 & 0x80000000);
}
/* MRS reset dll's */
do_delay();
for(cs=0;cs<8;cs+=2) {
write32(MCBAR+DCALADDR, mode_reg);
write32(MCBAR+DCALCSR, (0x81000003 | (cs<<20)));
- data32 = read32(MCBAR+DCALCSR);
- while(data32 & 0x80000000)
- data32 = read32(MCBAR+DCALCSR);
+ do data32 = read32(MCBAR+DCALCSR);
+ while(data32 & 0x80000000);
}
/* Precharg all banks */
for(cs=0;cs<8;cs+=2) {
write32(MCBAR+DCALADDR, 0x04000000);
write32(MCBAR+DCALCSR, (0x81000002 | (cs<<20)));
- data32 = read32(MCBAR+DCALCSR);
- while(data32 & 0x80000000)
- data32 = read32(MCBAR+DCALCSR);
+ do data32 = read32(MCBAR+DCALCSR);
+ while(data32 & 0x80000000);
}
/* Do 2 refreshes */
do_delay();
for(cs=0;cs<8;cs+=2) {
write32(MCBAR+DCALCSR, (0x81000001 | (cs<<20)));
- data32 = read32(MCBAR+DCALCSR);
- while(data32 & 0x80000000)
- data32 = read32(MCBAR+DCALCSR);
+ do data32 = read32(MCBAR+DCALCSR);
+ while(data32 & 0x80000000);
}
do_delay();
for(cs=0;cs<8;cs+=2) {
write32(MCBAR+DCALCSR, (0x81000001 | (cs<<20)));
- data32 = read32(MCBAR+DCALCSR);
- while(data32 & 0x80000000)
- data32 = read32(MCBAR+DCALCSR);
+ do data32 = read32(MCBAR+DCALCSR);
+ while(data32 & 0x80000000);
}
do_delay();
/* for good luck do 6 more */
for(cs=0;cs<8;cs+=2) {
write32(MCBAR+DCALADDR, (mode_reg & ~(1<<24)));
write32(MCBAR+DCALCSR, (0x81000003 | (cs<<20)));
- data32 = read32(MCBAR+DCALCSR);
- while(data32 & 0x80000000)
- data32 = read32(MCBAR+DCALCSR);
+ do data32 = read32(MCBAR+DCALCSR);
+ while(data32 & 0x80000000);
}
/* Do only if DDR2 EMRS dll's enabled */
for(cs=0;cs<8;cs+=2) {
write32(MCBAR+DCALADDR, (0x0b940001));
write32(MCBAR+DCALCSR, (0x81000003 | (cs<<20)));
- data32 = read32(MCBAR+DCALCSR);
- while(data32 & 0x80000000)
- data32 = read32(MCBAR+DCALCSR);
+ do data32 = read32(MCBAR+DCALCSR);
+ while(data32 & 0x80000000);
}
do_delay();
for(cs=0;cs<8;cs+=2) {
write32(MCBAR+DCALCSR, (0x810831d8 | (cs<<20)));
- data32 = read32(MCBAR+DCALCSR);
- while(data32 & 0x80000000)
- data32 = read32(MCBAR+DCALCSR);
+ do data32 = read32(MCBAR+DCALCSR);
+ while(data32 & 0x80000000);
}
/* Bring memory subsystem on line */
pci_write_config16(ctrl->f0, MCHSCRB, data16);
/* The memory is now setup, use it */
-#if CONFIG_USE_DCACHE_RAM == 0
+#if CONFIG_CACHE_AS_RAM == 0
cache_lbmem(MTRR_TYPE_WRBACK);
#endif
}