Skip to contentSkip to conversation

mpc83xx: spd_sdram.c: Disable memory controller before initializing

PATCH Superseded Stefan Roese 3 participants 3 messages Dec 4, 2009 – Dec 5, 2009

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mpc83xx: spd_sdram.c: Disable memory controller before initializing

The memory controller could already be enabled, when spd_sdram() is called. This could be the case for example, when the SDRAM is initialized by the JTAG debugger.

Cc Reinhard Arlt <[email protected]>
Cc Kim Phillips <[email protected]>
---
 cpu/mpc83xx/spd_sdram.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
cpu/mpc83xx/spd_sdram.c +7 -0
index 0f61180..952afeb 100644
@@ -150,6 +150,13 @@ long int spd_sdram()
 	unsigned int ddrc_ecc_enable;
 	unsigned int pvr = get_pvr();
 
+	/*
+	 * First disable the memory controller (could be enabled
+	 * by the debugger)
+	 */
+	ddr->sdram_cfg &= ~SDRAM_CFG_MEM_EN;
+	asm("sync;isync");
+
 	/* Read SPD parameters with I2C */
 	CONFIG_SYS_READ_SPD(SPD_EEPROM_ADDRESS, 0, 1, (uchar *) & spd, sizeof (spd));
 #ifdef SPD_DEBUG
Signature · 1 line
1.6.6.rc1
#2 lore raw

PATCH 1/1 mpc83xx: spd_sdram.c: Disable memory controller before initializing

In reply to Stefan Roese
Quoted 7 lines · On Fri, 4 Dec 2009 09:51:45 +0100 Stefan Roese <[email protected]> wrote:

The memory controller could already be enabled, when spd_sdram() is called. This could be the case for example, when the SDRAM is initialized by the JTAG debugger.

Cc Reinhard Arlt <[email protected]>
Cc Kim Phillips <[email protected]>

thanks for this, Stefan.

cpu/mpc83xx/spd_sdram.c long int spd_sdram() · line 158

Quoted 6 lines
cpu/mpc83xx/spd_sdram.c +6 -0
+	/*
+	 * First disable the memory controller (could be enabled
+	 * by the debugger)
+	 */
+	ddr->sdram_cfg &= ~SDRAM_CFG_MEM_EN;
+	asm("sync;isync");

I realize that this file already doesn't use accessor functions to any large extent, but that doesn't mean that we should continue this bad habit.

Kim