summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatolij Gustschin <agust@denx.de>2010-04-24 19:27:08 +0200
committerWolfgang Denk <wd@denx.de>2010-04-24 22:56:35 +0200
commitb9947bbb08d0483be03004bdbce283b644471cb7 (patch)
tree888421b4d4be7a9ea2f32c85ee838a1e6c2dae10
parent5d937e8b59f27d8c300a2e78c168a4c22ec6922a (diff)
downloadu-boot-imx-b9947bbb08d0483be03004bdbce283b644471cb7.zip
u-boot-imx-b9947bbb08d0483be03004bdbce283b644471cb7.tar.gz
u-boot-imx-b9947bbb08d0483be03004bdbce283b644471cb7.tar.bz2
mpc5121: determine RAM size using get_ram_size()
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>
-rw-r--r--arch/powerpc/cpu/mpc512x/fixed_sdram.c7
-rw-r--r--include/configs/aria.h1
-rw-r--r--include/configs/mecp5123.h1
-rw-r--r--include/configs/mpc5121ads.h1
4 files changed, 9 insertions, 1 deletions
diff --git a/arch/powerpc/cpu/mpc512x/fixed_sdram.c b/arch/powerpc/cpu/mpc512x/fixed_sdram.c
index 72d524c..550cbd0 100644
--- a/arch/powerpc/cpu/mpc512x/fixed_sdram.c
+++ b/arch/powerpc/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 = 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;
}
diff --git a/include/configs/aria.h b/include/configs/aria.h
index 7097ab7..c5f9cc1 100644
--- a/include/configs/aria.h
+++ b/include/configs/aria.h
@@ -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
diff --git a/include/configs/mecp5123.h b/include/configs/mecp5123.h
index cafd6a7..92c4f5f 100644
--- a/include/configs/mecp5123.h
+++ b/include/configs/mecp5123.h
@@ -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
diff --git a/include/configs/mpc5121ads.h b/include/configs/mpc5121ads.h
index 8ecc9e1..5281042 100644
--- a/include/configs/mpc5121ads.h
+++ b/include/configs/mpc5121ads.h
@@ -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