board.c 782 B

123456789101112131415161718192021222324252627282930313233343536
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2016 Vladimir Zapolskiy <vz@mleia.com>
  4. */
  5. #include <common.h>
  6. #include <init.h>
  7. #include <asm/global_data.h>
  8. DECLARE_GLOBAL_DATA_PTR;
  9. int dram_init(void)
  10. {
  11. gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE,
  12. CONFIG_SYS_SDRAM_SIZE);
  13. return 0;
  14. }
  15. void relocate_code(ulong start_addr_sp, gd_t *new_gd, ulong relocaddr)
  16. {
  17. void (*reloc_board_init_r)(gd_t *gd, ulong dest) = board_init_r;
  18. if (new_gd->reloc_off) {
  19. memcpy((void *)new_gd->relocaddr,
  20. (void *)(new_gd->relocaddr - new_gd->reloc_off),
  21. new_gd->mon_len);
  22. reloc_board_init_r += new_gd->reloc_off;
  23. }
  24. __asm__ __volatile__("mov.l %0, r15\n" : : "m" (new_gd->start_addr_sp));
  25. while (1)
  26. reloc_board_init_r(new_gd, 0x0);
  27. }