nand_spl_load.c 990 B

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