nand_spl_load.c 987 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2011
  4. * Heiko Schocher, DENX Software Engineering, hs@denx.de.
  5. */
  6. #include <common.h>
  7. #include <nand.h>
  8. /*
  9. * The main entry for NAND booting. It's necessary that SDRAM is already
  10. * configured and available since this code loads the main U-Boot image
  11. * from NAND into SDRAM and starts it from there.
  12. */
  13. void nand_boot(void)
  14. {
  15. __attribute__((noreturn)) void (*uboot)(void);
  16. /*
  17. * Load U-Boot image from NAND into RAM
  18. */
  19. nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
  20. CONFIG_SYS_NAND_U_BOOT_SIZE,
  21. (void *)CONFIG_SYS_NAND_U_BOOT_DST);
  22. #ifdef CONFIG_NAND_ENV_DST
  23. nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
  24. (void *)CONFIG_NAND_ENV_DST);
  25. #ifdef CONFIG_ENV_OFFSET_REDUND
  26. nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE,
  27. (void *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE);
  28. #endif
  29. #endif
  30. /*
  31. * Jump to U-Boot image
  32. */
  33. uboot = (void *)CONFIG_SYS_NAND_U_BOOT_START;
  34. (*uboot)();
  35. }