Browse Source

u-boot: Relocation of text, data and bss sections

As the size of the u-boot increases and exceeds the size of the IRAM,
a re-organization of the u-boot memory is needed.

So for the 1st 512K starting at 0x3F000000 (2 banks of 256K), where the
ROM uses memory from 0x3F070000 until the end at 0x3F080000, we decided
to move the entire U-Boot image into this 512K bank of IRAM and instruct
U-Boot to not relocate the text+data+bss sections.  This required some
“tweaking” to how memory is seen in the system.

There were two things we affected.  The VMALLOC area was changed from
0x3F000000 to 0x3F400000 with a size of 128K.  The start of physical
memory was at 0x3F420000 for the remaining 384K of the 512K IRAM (OCRAM
Gfx).  The IRAM_BASE_ADDR and IRAM_SIZE mirrored the same starting
address and size as the physical memory.  In the board initialization,
since we instructed the system to not relocate U-Boot, we added logic to
not reserve memory from the 384K area for U-Boot (text+data+bss), and to
setup its stack and alloc area in this 384K.

Signed-off-by: Pardeep Kumar Singla <b45784@freescale.com>
Pardeep Kumar Singla 11 years ago
parent
commit
65ef037033

+ 2 - 2
arch/arm/include/asm/arch-vf610/imx-regs.h

@@ -22,8 +22,8 @@
 
 #define ARCH_MXC
 
-#define IRAM_BASE_ADDR		0x3F000000	/* internal ram */
-#define IRAM_SIZE		0x00080000	/* 512 KB */
+#define IRAM_BASE_ADDR		0x3F440000	/* internal ram */
+#define IRAM_SIZE		256*1024	/* 512 KB */
 
 #define AIPS0_BASE_ADDR		0x40000000
 #define AIPS1_BASE_ADDR		0x40080000

+ 10 - 4
arch/arm/lib/board.c

@@ -60,8 +60,8 @@
 #endif
 
 #ifdef CONFIG_VF610
-#define VF610_LOWER_BANK_ADDR  0x3F000000
-#define VF610_MALLOC_SIZE      (400<<10)
+#define VF610_LOWER_BANK_ADDR  0x3F400000
+#define VF610_MALLOC_SIZE      (256<<10)
 #endif
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -389,11 +389,12 @@ void board_init_f(ulong bootflag)
 	 * reserve memory for U-Boot code, data & bss
 	 * round down to next 4 kB limit
 	 */
+#ifndef CONFIG_VF610
 	addr -= gd->mon_len;
 	addr &= ~(4096 - 1);
 
 	debug("Reserving %ldk for U-Boot at: %08lx\n", gd->mon_len >> 10, addr);
-
+#endif
 #ifndef CONFIG_SPL_BUILD
 	/*
 	 * reserve memory for malloc() arena
@@ -464,10 +465,15 @@ void board_init_f(ulong bootflag)
 	/* Ram ist board specific, so move it to board code ... */
 	dram_init_banksize();
 	display_dram_config();	/* and display it */
-
+#ifndef CONFIG_VF610
 	gd->relocaddr = addr;
 	gd->start_addr_sp = addr_sp;
 	gd->reloc_off = addr - _TEXT_BASE;
+#else
+	gd->relocaddr = CONFIG_SYS_TEXT_BASE;
+	gd->start_addr_sp = addr_sp;
+	gd->reloc_off = 0;
+#endif
 	debug("relocation Offset is: %08lx\n", gd->reloc_off);
 	if (new_fdt) {
 		memcpy(new_fdt, gd->fdt_blob, fdt_size);

+ 2 - 1
board/freescale/vf610twr/vf610twr.c

@@ -254,7 +254,8 @@ int dram_init(void)
 	setup_iomux_ddr();
 
 	ddr_ctrl_init();
-	gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
+	gd->ram_size = PHYS_SDRAM_SIZE;
+
 
 	return 0;
 }

+ 3 - 3
include/configs/vf610twr.h

@@ -241,12 +241,12 @@
  * Stack sizes
  * The stack sizes are set up in start.S using the settings below
  */
-#define CONFIG_STACKSIZE		(128 * 1024)	/* regular stack */
+#define CONFIG_STACKSIZE		(64 * 1024)	/* regular stack */
 
 /* Physical memory map */
 #define CONFIG_NR_DRAM_BANKS		1
-#define PHYS_SDRAM			(0x3f400000)
-#define PHYS_SDRAM_SIZE			(512 * 1024)
+#define PHYS_SDRAM			(0x3f440000)
+#define PHYS_SDRAM_SIZE			(256 * 1024)
 
 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM
 #define CONFIG_SYS_INIT_RAM_ADDR	IRAM_BASE_ADDR