From: Anatolij Gustschin Date: Wed, 14 Apr 2010 16:21:47 +0200 Subject: [U-Boot] [PATCH v3 1/3] mpc5121: determine RAM size using get_ram_size() In-Reply-To: <1271254909-20398-1-git-send-email-agust@denx.de> References: <20100321192306.BFE104C022@gemini.denx.de> <1271254909-20398-1-git-send-email-agust@denx.de> Message-ID: <1271254909-20398-2-git-send-email-agust@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Configure 1GiB address range in DDR LAW and determine the RAM size. Fix DDR LAW afterwards. Signed-off-by: Anatolij Gustschin --- arch/ppc/cpu/mpc512x/fixed_sdram.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/arch/ppc/cpu/mpc512x/fixed_sdram.c b/arch/ppc/cpu/mpc512x/fixed_sdram.c index 72d524c..01ae0a5 100644 --- a/arch/ppc/cpu/mpc512x/fixed_sdram.c +++ b/arch/ppc/cpu/mpc512x/fixed_sdram.c @@ -78,7 +78,7 @@ long int fixed_sdram(ddr512x_config_t *mddrc_config, u32 *dram_init_seq, int seq_sz) { volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR; - u32 msize = CONFIG_SYS_DDR_SIZE * 1024 * 1024; + u32 msize = 1024 * 1024 * 1024; u32 msize_log2 = __ilog2(msize); u32 i; @@ -148,5 +148,10 @@ long int fixed_sdram(ddr512x_config_t *mddrc_config, out_be32(&im->mddrc.ddr_time_config0, mddrc_config->ddr_time_config0); out_be32(&im->mddrc.ddr_sys_config, mddrc_config->ddr_sys_config); + msize = get_ram_size(CONFIG_SYS_DDR_BASE, 0x40000000); + /* Fix DDR Local Window for new size */ + out_be32(&im->sysconf.ddrlaw.ar, __ilog2(msize) - 1); + sync_law(&im->sysconf.ddrlaw.ar); + return msize; } -- 1.6.3.3