From: Stefan Roese Date: Tue, 8 Dec 2009 08:10:04 +0000 (+0100) Subject: mpc83xx: spd_sdram.c: Disable memory controller before initializing X-Git-Tag: v2010.03-rc1~160^2~3 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7693640acd5222f5a64e59ccf5e3bc511e8054b9;p=u-boot 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. The "sync" after the register access via the accessor function is still needed, because the macro uses the sync before the real write is done. So until not all accesses are converted to using accessor functions, this sync still needs to be made "manually" here. Signed-off-by: Stefan Roese Cc: Reinhard Arlt Acked-by: Dave Liu Signed-off-by: Kim Phillips --- diff --git a/cpu/mpc83xx/spd_sdram.c b/cpu/mpc83xx/spd_sdram.c index 0f611804a0..44aaa9abc2 100644 --- a/cpu/mpc83xx/spd_sdram.c +++ b/cpu/mpc83xx/spd_sdram.c @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -150,6 +151,14 @@ 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) + */ + clrsetbits_be32(&ddr->sdram_cfg, SDRAM_CFG_MEM_EN, 0); + sync(); + isync(); + /* Read SPD parameters with I2C */ CONFIG_SYS_READ_SPD(SPD_EEPROM_ADDRESS, 0, 1, (uchar *) & spd, sizeof (spd)); #ifdef SPD_DEBUG