spl.c 887 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (C) 2020 MediaTek Inc. All Rights Reserved.
  4. *
  5. * Author: Weijie Gao <weijie.gao@mediatek.com>
  6. */
  7. #include <common.h>
  8. #include <fdt.h>
  9. #include <spl.h>
  10. #include <asm/sections.h>
  11. #include <linux/sizes.h>
  12. #include <mach/serial.h>
  13. void __noreturn board_init_f(ulong dummy)
  14. {
  15. spl_init();
  16. #ifdef CONFIG_SPL_SERIAL_SUPPORT
  17. /*
  18. * mtmips_spl_serial_init() is useful if debug uart is enabled,
  19. * or DM based serial is not enabled.
  20. */
  21. mtmips_spl_serial_init();
  22. preloader_console_init();
  23. #endif
  24. board_init_r(NULL, 0);
  25. }
  26. void board_boot_order(u32 *spl_boot_list)
  27. {
  28. spl_boot_list[0] = BOOT_DEVICE_NOR;
  29. }
  30. unsigned long spl_nor_get_uboot_base(void)
  31. {
  32. void *uboot_base = __image_copy_end;
  33. if (fdt_magic(uboot_base) == FDT_MAGIC)
  34. return (unsigned long)uboot_base + fdt_totalsize(uboot_base);
  35. return (unsigned long)uboot_base;
  36. }