ARM: implement relocation for ARM926
Subsystems (2)
PATCH 15/26 ARM: implement relocation for ARM926
Change the implementation for arm926 to relocate the code to an arbitrary address in RAM.
Adapt the TX25 (i.MX25), magnesium board to test the changes.
da850 board:
Tested-by Ben Gardiner <[email protected]>
Signed-off-by Heiko Schocher <[email protected]>
---
- changes since v1:
- removed converted but not tested boards
- add CONFIG_SYS_ARM_WITHOUT_RELOC
arch/arm/cpu/arm926ejs/orion5x/dram.c | 24 +++++- arch/arm/cpu/arm926ejs/start.S | 172 ++++++++++++++++++++++++++++++++- arch/arm/cpu/arm926ejs/u-boot.lds | 14 +++- board/karo/tx25/config.mk | 4 +- board/karo/tx25/tx25.c | 11 ++- board/keymile/km_arm/km_arm.c | 24 +++++ board/logicpd/imx27lite/config.mk | 2 +- board/logicpd/imx27lite/imx27lite.c | 15 ++- include/configs/da850evm.h | 6 +- include/configs/imx27lite-common.h | 5 + include/configs/km_arm.h | 4 + include/configs/tx25.h | 13 ++- nand_spl/board/karo/tx25/u-boot.lds | 14 +++- 13 files changed, 287 insertions(+), 21 deletions(-)
arch/arm/cpu/arm926ejs/orion5x/dram.c +23 -1
@@ -49,7 +49,7 @@ u32 orion5x_sdram_bar(enum memory_bank bank) result = winregs[bank].base;return result; } - +#if defined(CONFIG_SYS_ARM_WITHOUT_RELOC )int dram_init (void ) {int i;
@@ -62,3 +62,25 @@ 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 long *)orion5x_sdram_bar (0 ), +CONFIG_MAX_RAM_BANK_SIZE ); +return 0 ; +} + +void dram_init_banksize (void ) +{ +int i; + +for (i =0 ; i <CONFIG_NR_DRAM_BANKS ; i++) { + gd->bd->bi_dram[i].start =orion5x_sdram_bar (i); + gd->bd->bi_dram[i].size =get_ram_size ( + (volatile long *) (gd->bd->bi_dram[i].start), +CONFIG_MAX_RAM_BANK_SIZE ); + } +} +#endif
arch/arm/cpu/arm926ejs/start.S +170 -2
220 lines not on this page · raw message
arch/arm/cpu/arm926ejs/u-boot.lds +13 -1
@@ -39,11 +39,23 @@ SECTIONS .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } . = ALIGN(4); - .data : { *(.data) } + .data : { + *(.data) + __datarel_start = .; + *(.data.rel) + __datarelrolocal_start = .; + *(.data.rel.ro.local) + __datarellocal_start = .; + *(.data.rel.local) + __datarelro_start = .; + *(.data.rel.ro) + } + __got_start = .; . = ALIGN(4); .got : { *(.got) } + __got_end = .; . = .; __u_boot_cmd_start = .; .u_boot_cmd : { *(.u_boot_cmd) }
board/karo/tx25/config.mk +2 -2
@@ -1,5 +1,5 @@ ifdef CONFIG_NAND_SPL -TEXT_BASE = 0x81ec0000 +TEXT_BASE = 0x810c0000 else -TEXT_BASE = 0x81f00000 +TEXT_BASE = 0x81fc1000 endif
board/karo/tx25/tx25.c +9 -2
@@ -159,7 +159,14 @@ int board_late_init(void)int dram_init (void ) { +/* dram_init must store complete ramsize in gd->ram_size */ + gd->ram_size =get_ram_size ((volatile void *)PHYS_SDRAM_1 , +PHYS_SDRAM_1_SIZE ); +return 0 ; +} +void dram_init_banksize (void ) +{ gd->bd->bi_dram[0 ].start =PHYS_SDRAM_1 ; gd->bd->bi_dram[0 ].size =get_ram_size ((volatile void *)PHYS_SDRAM_1 ,PHYS_SDRAM_1_SIZE );
@@ -167,9 +174,9 @@ int dram_init (void) gd->bd->bi_dram[1 ].start =PHYS_SDRAM_2 ; gd->bd->bi_dram[1 ].size =get_ram_size ((volatile void *)PHYS_SDRAM_2 ,PHYS_SDRAM_2_SIZE ); -#endif +#else -return 0 ; +#endif }int checkboard (void )
board/keymile/km_arm/km_arm.c +24 -0
@@ -225,6 +225,7 @@ U_BOOT_CMD( );#endif +#if defined(CONFIG_SYS_ARM_WITHOUT_RELOC )int dram_init (void ) {int i;
@@ -234,9 +235,32 @@ int dram_init(void) gd->bd->bi_dram[i].size =get_ram_size ((long *)kw_sdram_bar (i), kw_sdram_bs(i)); } + +return 0 ; +} +#else +int dram_init (void ) +{ +/* dram_init must store complete ramsize in gd->ram_size */ +/* Fix this */ + gd->ram_size =get_ram_size ((volatile void *)kw_sdram_bar (0 ), +kw_sdram_bs (0 ));return 0 ; } +void dram_init_banksize (void ) +{ +int i; + +for (i =0 ; i <CONFIG_NR_DRAM_BANKS ; i++) { + gd->bd->bi_dram[i].start =kw_sdram_bar (i); + gd->bd->bi_dram[i].size =kw_sdram_bs (i); + gd->bd->bi_dram[i].size =get_ram_size ((long *)kw_sdram_bar (i), +kw_sdram_bs (i)); + } +} +#endif +/* Configure and enable MV88E1118 PHY */ void reset_phy (void ) {
board/logicpd/imx27lite/config.mk +1 -1
@@ -1 +1 @@ -TEXT_BASE = 0xA7F00000 +TEXT_BASE = 0xc0000000
board/logicpd/imx27lite/imx27lite.c +9 -6
@@ -66,19 +66,22 @@ int board_init (void)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 , +PHYS_SDRAM_1_SIZE ); +return 0 ; +} -#if CONFIG_NR_DRAM_BANKS >0 - gd->bd->bi_dram[0 ].start =PHYS_SDRAM_1 ; - gd->bd->bi_dram[0 ].size =get_ram_size ((volatile void *)PHYS_SDRAM_1 , +void dram_init_banksize (void ) +{ + gd->bd->bi_dram[0 ].start =CONFIG_SYS_SDRAM_BASE ; + gd->bd->bi_dram[0 ].size =get_ram_size ((volatile void *)CONFIG_SYS_SDRAM_BASE ,PHYS_SDRAM_1_SIZE ); -#endif #if CONFIG_NR_DRAM_BANKS >1 gd->bd->bi_dram[1 ].start =PHYS_SDRAM_2 ; gd->bd->bi_dram[1 ].size =get_ram_size ((volatile void *)PHYS_SDRAM_2 ,PHYS_SDRAM_2_SIZE );#endif - -return 0 ; }int checkboard (void )
include/configs/da850evm.h +5 -1
@@ -39,7 +39,6 @@#define CONFIG_SYS_HZ_CLOCK clk_get(DAVINCI_AUXCLK_CLKID)#define CONFIG_SYS_HZ 1000#define CONFIG_SKIP_LOWLEVEL_INIT -#define CONFIG_SKIP_RELOCATE_UBOOT /* to a proper address, init done */ /* * Memory Info
@@ -137,4 +136,9 @@#undef CONFIG_CMD_ENV#endif +/* additions for new relocation code, must added to all boards */ +#undef CONFIG_SYS_ARM_WITHOUT_RELOC/* This board is tested with relocation support */ +#define CONFIG_SYS_SDRAM_BASE 0xc0000000 +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + 0x1000 - /* Fix this */ \ +CONFIG_SYS_GBL_DATA_SIZE )#endif /* __CONFIG_H */
include/configs/imx27lite-common.h +5 -0
@@ -234,4 +234,9 @@"mtdids=" MTDIDS_DEFAULT "\0" \"mtdparts=" MTDPARTS_DEFAULT "\0" \ +/* additions for new relocation code, must added to all boards */ +#undef CONFIG_SYS_ARM_WITHOUT_RELOC/* This board is tested with relocation support */ +#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + 0x1000 - /* Fix this */ \ +CONFIG_SYS_GBL_DATA_SIZE )#endif /* __IMX27LITE_COMMON_CONFIG_H */
include/configs/km_arm.h +4 -0
@@ -188,4 +188,8 @@ int get_scl (void);#undef CONFIG_JFFS2_CMDLINE#endif +/* additions for new relocation code, must added to all boards */ +#define CONFIG_SYS_SDRAM_BASE 0x00000000 +#define CONFIG_SYS_INIT_SP_ADDR (0x00000000 + 0x1000 - /* Fix this */ \ +CONFIG_SYS_GBL_DATA_SIZE )#endif /* _CONFIG_KM_ARM_H */
include/configs/tx25.h +9 -4
@@ -40,9 +40,9 @@/* Start copying real U-boot from the second page */ #define CONFIG_SYS_NAND_U_BOOT_OFFS 0x800#define CONFIG_SYS_NAND_U_BOOT_SIZE 0x30000 -/* Load U-Boot to this address */ -#define CONFIG_SYS_NAND_U_BOOT_DST 0x81f00000 -#define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_NAND_U_BOOT_DST + +#define CONFIG_SYS_NAND_U_BOOT_DST (0x81fc1000) +#define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_NAND_U_BOOT_DST#define CONFIG_SYS_NAND_PAGE_SIZE 2048#define CONFIG_SYS_NAND_SPARE_SIZE 64
@@ -52,7 +52,6 @@#define CONFIG_SYS_NAND_BAD_BLOCK_POS 0#else #define CONFIG_SKIP_LOWLEVEL_INIT -#define CONFIG_SKIP_RELOCATE_UBOOT #endif #define CONFIG_DISPLAY_CPUINFO
@@ -176,4 +175,10 @@"update=nand erase 0 40000;nand write ${loadaddr} 0 40000\0" \"upd=run load update\0" \ +/* additions for new relocation code, must added to all boards */ +#undef CONFIG_SYS_ARM_WITHOUT_RELOC/* This board is tested with relocation support */ +#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + 0x1000 - /* Fix this */ \ +CONFIG_SYS_GBL_DATA_SIZE ) +#endif /* __CONFIG_H */
nand_spl/board/karo/tx25/u-boot.lds +13 -1
@@ -41,11 +41,23 @@ SECTIONS .rodata : { *(.rodata) } . = ALIGN(4); - .data : { *(.data) } + .data : { + *(.data) + __datarel_start = .; + *(.data.rel) + __datarelrolocal_start = .; + *(.data.rel.ro.local) + __datarellocal_start = .; + *(.data.rel.local) + __datarelro_start = .; + *(.data.rel.ro) + } + __got_start = .; . = ALIGN(4); .got : { *(.got) } + __got_end = .; . = .; __u_boot_cmd_start = .; .u_boot_cmd : { *(.u_boot_cmd) }
Signature · 5 lines
1.6.2.5 -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany