blob: aa967c04e7aa4cfc6af1430eb3142703c71fb5fa [file] [log] [blame]
Vladimir Zapolskiycdbb0cf2016-11-28 00:15:31 +02001/*
2 * Copyright (C) 2016 Vladimir Zapolskiy <vz@mleia.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <common.h>
8
9DECLARE_GLOBAL_DATA_PTR;
10
11int dram_init(void)
12{
13 gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE,
14 CONFIG_SYS_SDRAM_SIZE);
15
16 return 0;
17}
Vladimir Zapolskiybccf09e2016-11-28 00:15:32 +020018
19void relocate_code(ulong start_addr_sp, gd_t *new_gd, ulong relocaddr)
20{
21 void (*reloc_board_init_r)(gd_t *gd, ulong dest) = board_init_r;
22
23 if (new_gd->reloc_off) {
24 memcpy((void *)new_gd->relocaddr,
25 (void *)(new_gd->relocaddr - new_gd->reloc_off),
26 new_gd->mon_len);
27
28 reloc_board_init_r += new_gd->reloc_off;
29 }
30
31 __asm__ __volatile__("mov.l %0, r15\n" : : "m" (new_gd->start_addr_sp));
32
33 while (1)
34 reloc_board_init_r(new_gd, 0x0);
35}