mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-14 08:57:58 +00:00
bccf09e0e1
Commitsb61e90e6fd
("sh: Drop the arch-specific board init") andf41e6088eb
("sh: Fix build errors for generic board") left code and data relocation done in start.S, however further actual U-boot configuration is not started anymore. Practically SH boards with the code relocated into the expected position by start.S still can be booted, so the change adds this option and provides an option how to relocate code for board_init_r() execution. Signed-off-by: Vladimir Zapolskiy <vz@mleia.com> Reviewed-by: Simon Glass <sjg@chromium.org>
35 lines
742 B
C
35 lines
742 B
C
/*
|
|
* Copyright (C) 2016 Vladimir Zapolskiy <vz@mleia.com>
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
*/
|
|
|
|
#include <common.h>
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
int dram_init(void)
|
|
{
|
|
gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE,
|
|
CONFIG_SYS_SDRAM_SIZE);
|
|
|
|
return 0;
|
|
}
|
|
|
|
void relocate_code(ulong start_addr_sp, gd_t *new_gd, ulong relocaddr)
|
|
{
|
|
void (*reloc_board_init_r)(gd_t *gd, ulong dest) = board_init_r;
|
|
|
|
if (new_gd->reloc_off) {
|
|
memcpy((void *)new_gd->relocaddr,
|
|
(void *)(new_gd->relocaddr - new_gd->reloc_off),
|
|
new_gd->mon_len);
|
|
|
|
reloc_board_init_r += new_gd->reloc_off;
|
|
}
|
|
|
|
__asm__ __volatile__("mov.l %0, r15\n" : : "m" (new_gd->start_addr_sp));
|
|
|
|
while (1)
|
|
reloc_board_init_r(new_gd, 0x0);
|
|
}
|