Skip to contentSkip to conversation

am33xx:ddr:Fix config_sdram to work for all DDR

PATCH In review Tom Rini 1 participant 2 messages Mar 8, 2013 – Mar 26, 2013 Arm (32-bit)

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 am33xx:ddr:Fix config_sdram to work for all DDR

From: Steve Kipisz <[email protected]>

The original write to sdram_config is correct for DDR3 but incorrect for DDR2 so SPL was hanging. For DDR2, the write to sdram_config should be after the writes to ref_ctrl. This was working for DDR3 because there was a write of 0x2800 to ref_ctrl before a write to sdram_config.

Tested on: GP EVM 1.1A (DDR2), GP EVM 1.5A (DDR3),
Beaglebone A6 (DDR2), Beagleone Blacd A4A (DDR3)

---
 arch/arm/cpu/armv7/am33xx/ddr.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
arch/arm/cpu/armv7/am33xx/ddr.c +4 -1
index 448cc40..7932a39 100644
@@ -54,10 +54,13 @@ void config_sdram(const struct emif_regs *regs)
 		writel(0x2800, &emif_reg->emif_sdram_ref_ctrl);
 		writel(regs->zq_config, &emif_reg->emif_zq_config);
 		writel(regs->sdram_config, &cstat->secure_emif_sdram_config);
+		writel(regs->sdram_config, &emif_reg->emif_sdram_config);
+		writel(regs->ref_ctrl, &emif_reg->emif_sdram_ref_ctrl);
+		writel(regs->ref_ctrl, &emif_reg->emif_sdram_ref_ctrl_shdw);
 	}
-	writel(regs->sdram_config, &emif_reg->emif_sdram_config);
 	writel(regs->ref_ctrl, &emif_reg->emif_sdram_ref_ctrl);
 	writel(regs->ref_ctrl, &emif_reg->emif_sdram_ref_ctrl_shdw);
+	writel(regs->sdram_config, &emif_reg->emif_sdram_config);
 }
 
 /**
Signature · 1 line
1.7.2.3
author
#1 lore raw
Quoted 8 lines · Tom Rini

From: Steve Kipisz <[email protected]>

The original write to sdram_config is correct for DDR3 but incorrect for DDR2 so SPL was hanging. For DDR2, the write to sdram_config should be after the writes to ref_ctrl. This was working for DDR3 because there was a write of 0x2800 to ref_ctrl before a write to sdram_config.

Quoted 4 lines

Tested on: GP EVM 1.1A (DDR2), GP EVM 1.5A (DDR3),
Beaglebone A6 (DDR2), Beagleone Blacd A4A (DDR3)

Applied to u-boot-ti/master (and already pulled into u-boot-arm), thanks!

--
Tom