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