@@ -47,25 +47,27 @@ void sdram_cfg(void)
early_udelay(200);
- force_precharge();
+ /*
+ * Errata of most EP93xx revisions say that PRECHARGE ALL isn't always
+ * issued, so we omit it at this point. Instead we force a precharge
+ * after having programmed the mode registers
+ */
setup_refresh_timer();
program_mode_registers();
- /* Select normal operation mode */
- writel(GLCONFIG_CKE, &sdram->glconfig);
+ force_precharge();
}
static void force_precharge(void)
{
- /*
- * Errata most EP93xx revisions say that PRECHARGE ALL isn't always
- * issued.
- *
- * Do a read from each bank to make sure they're precharged
- */
+ struct sdram_regs *sdram = (struct sdram_regs *)SDRAM_BASE;
+
+ /* Select normal operation mode */
+ writel(GLCONFIG_CKE, &sdram->glconfig);
+ /* Do a read from each bank to make sure they're precharged */
PRECHARGE_BANK(0);
PRECHARGE_BANK(1);
PRECHARGE_BANK(2);
@@ -101,6 +103,11 @@ static void setup_refresh_timer(void)
static void program_mode_registers(void)
{
+ struct sdram_regs *sdram = (struct sdram_regs *)SDRAM_BASE;
+
+ /* Select mode register update mode */
+ writel(GLCONFIG_MRS | GLCONFIG_CKE, &sdram->glconfig);
+
/*
* The mode registers are programmed by performing a read from each
* SDRAM bank. The value of the address that is read defines the value