[U-Boot] [PATCH v2 2/4] tx25: copy SPL directly, not using relocate_code.

Benoît Thébaudeau
2013-05-14T15:15:09Z

Hi Albert,

On Tuesday, May 14, 2013 11:50:28 AM, Albert ARIBAUD wrote:
> Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
> ---
> Changes in v2:
> - dropped relocate_code() call from tx25 SPL
>
> board/karo/tx25/tx25.c | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/board/karo/tx25/tx25.c b/board/karo/tx25/tx25.c
> index 2952eba..461e21f 100644
> --- a/board/karo/tx25/tx25.c
> +++ b/board/karo/tx25/tx25.c
> @@ -35,7 +35,21 @@ DECLARE_GLOBAL_DATA_PTR;
> #ifdef CONFIG_SPL_BUILD
> void board_init_f(ulong bootflag)
> {
> - relocate_code(CONFIG_SPL_TEXT_BASE);
> + /*
> + * copy ourselves from where we are running to where we were
> + * linked at. Use ulong pointers as all addresses involved
> + * are 4-byte-aligned.
> + */
> + ulong *start_ptr, *end_ptr, *link_ptr, *run_ptr, *dst;
> + asm volatile ("ldr %0, =_start" : "=r"(start_ptr));
> + asm volatile ("ldr %0, =_end" : "=r"(end_ptr));

Same question as for mx31pdk.

> + asm volatile ("ldr %0, =board_init_f" : "=r"(link_ptr));
> + asm volatile ("adr %0, board_init_f" : "=r"(run_ptr));
> + for (dst = start_ptr; dst < end_ptr; dst++)
> + *dst = *(dst+(run_ptr-link_ptr));
> + /*
> + * branch to nand_boot's link-time address.
> + */
> asm volatile("ldr pc, =nand_boot");
> }
> #endif
> --
> 1.7.10.4

Best regards,
Beno?t