]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
mpc5121: determine RAM size using get_ram_size()
authorAnatolij Gustschin <agust@denx.de>
Sat, 24 Apr 2010 17:27:08 +0000 (19:27 +0200)
committerWolfgang Denk <wd@denx.de>
Sat, 24 Apr 2010 20:56:35 +0000 (22:56 +0200)
Configure CONFIG_SYS_MAX_RAM_SIZE address range in
DDR Local Access Window and determine the RAM size.
Fix DDR LAW afterwards using detected RAM size.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
arch/powerpc/cpu/mpc512x/fixed_sdram.c
include/configs/aria.h
include/configs/mecp5123.h
include/configs/mpc5121ads.h

index 72d524caadcfed620f96e8c34ee15278fbc8f710..550cbd0bd6fcf1484e1c88158ceed156d25c0fff 100644 (file)
@@ -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 = CONFIG_SYS_MAX_RAM_SIZE;
        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, CONFIG_SYS_MAX_RAM_SIZE);
+       /* Fix DDR Local Window for new size */
+       out_be32(&im->sysconf.ddrlaw.ar, __ilog2(msize) - 1);
+       sync_law(&im->sysconf.ddrlaw.ar);
+
        return msize;
 }
index 7097ab72d012d04c86020d5e6debc23f6bc7f3c3..c5f9cc1046f747452bc03c1a61c777076b6c329e 100644 (file)
@@ -78,6 +78,7 @@
 #define CONFIG_SYS_DDR_SIZE            256             /* MB */
 #define CONFIG_SYS_DDR_BASE            0x00000000
 #define CONFIG_SYS_SDRAM_BASE          CONFIG_SYS_DDR_BASE
+#define CONFIG_SYS_MAX_RAM_SIZE                0x20000000
 
 #define CONFIG_SYS_IOCTRL_MUX_DDR      0x00000036
 
index cafd6a7f66d81bc2cedf36a2f9b04e8dd7305dce..92c4f5fdb30f39ddc3c9e3f780953e4120e047c5 100644 (file)
@@ -66,6 +66,7 @@
 
 #define CONFIG_SYS_DDR_BASE            0x00000000      /* DDR is sys memory*/
 #define CONFIG_SYS_SDRAM_BASE          CONFIG_SYS_DDR_BASE
+#define CONFIG_SYS_MAX_RAM_SIZE                0x20000000
 
 #define CONFIG_SYS_IOCTRL_MUX_DDR      0x00000036
 
index 8ecc9e114110bc3c23140cb47ca66a9268efd783..5281042efd10aeae32a6b5e4ec4b22dcdde4e361 100644 (file)
@@ -85,6 +85,7 @@
 #endif
 #define CONFIG_SYS_DDR_BASE            0x00000000      /* DDR is system memory*/
 #define CONFIG_SYS_SDRAM_BASE          CONFIG_SYS_DDR_BASE
+#define CONFIG_SYS_MAX_RAM_SIZE                0x20000000
 
 #define CONFIG_SYS_IOCTRL_MUX_DDR      0x00000036