summaryrefslogtreecommitdiff
path: root/board/davinci/common/misc.c
diff options
context:
space:
mode:
authorBen Gardiner <bengardiner@nanometrics.ca>2010-08-23 09:08:15 -0400
committerWolfgang Denk <wd@denx.de>2010-09-19 19:29:56 +0200
commit97003756249bd790910417eb66f0039bbf06a02c (patch)
tree48ec9d11d9f9bb67501f5bdfb670a1c1f05c81eb /board/davinci/common/misc.c
parenta51dd67a03d5a43c6c9a2964cfd854d332f52860 (diff)
downloadu-boot-imx-97003756249bd790910417eb66f0039bbf06a02c.zip
u-boot-imx-97003756249bd790910417eb66f0039bbf06a02c.tar.gz
u-boot-imx-97003756249bd790910417eb66f0039bbf06a02c.tar.bz2
da8xx: fixup ARM relocation support
Split the existing dram_init for da8xx when ARM reloc is enabled, like the changes to arch/arm/cpu/arm926ejs/orion5x/dram.c in 0f234d263b17ccf1b8fd776eb8c15b7cdb27a887 by Heiko Schocher <hs@denx.de>. Without these changes gd->ram_size is '0' which leads to incorrect relocation when CONFIG_SYS_ARM_WITHOUT_RELOC is defined and the board does not boot. We use get_ram_size to dynamically calculate the available RAM because it runs on different board version with different ram, as suggested by Heiko in private communication. Tested on a da850evm with 128M of DDR2 installed; with both CONFIG_SYS_ARM_WITHOUT_RELOC defined and undefined. Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca> Reviewed-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com> CC: Sudhakar Rajashekhara <sudhakar.raj@ti.com> CC: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'board/davinci/common/misc.c')
-rw-r--r--board/davinci/common/misc.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/board/davinci/common/misc.c b/board/davinci/common/misc.c
index 25ca326..86a875e 100644
--- a/board/davinci/common/misc.c
+++ b/board/davinci/common/misc.c
@@ -33,6 +33,7 @@
DECLARE_GLOBAL_DATA_PTR;
+#if defined(CONFIG_SYS_ARM_WITHOUT_RELOC)
int dram_init(void)
{
gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
@@ -40,6 +41,22 @@ int dram_init(void)
return(0);
}
+#else
+int dram_init(void)
+{
+ /* dram_init must store complete ramsize in gd->ram_size */
+ gd->ram_size = get_ram_size(
+ (volatile void *)CONFIG_SYS_SDRAM_BASE,
+ CONFIG_MAX_RAM_BANK_SIZE);
+ return 0;
+}
+
+void dram_init_banksize(void)
+{
+ gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
+ gd->bd->bi_dram[0].size = gd->ram_size;
+}
+#endif
#ifdef CONFIG_DRIVER_TI_EMAC