spl_nor.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright (C) 2012 Stefan Roese <sr@denx.de>
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.h>
  7. #include <spl.h>
  8. void spl_nor_load_image(void)
  9. {
  10. /*
  11. * Loading of the payload to SDRAM is done with skipping of
  12. * the mkimage header in this SPL NOR driver
  13. */
  14. spl_image.flags |= SPL_COPY_PAYLOAD_ONLY;
  15. if (spl_start_uboot()) {
  16. /*
  17. * Load real U-Boot from its location in NOR flash to its
  18. * defined location in SDRAM
  19. */
  20. spl_parse_image_header(
  21. (const struct image_header *)CONFIG_SYS_UBOOT_BASE);
  22. memcpy((void *)spl_image.load_addr,
  23. (void *)(CONFIG_SYS_UBOOT_BASE +
  24. sizeof(struct image_header)),
  25. spl_image.size);
  26. } else {
  27. /*
  28. * Load Linux from its location in NOR flash to its defined
  29. * location in SDRAM
  30. */
  31. spl_parse_image_header(
  32. (const struct image_header *)CONFIG_SYS_OS_BASE);
  33. memcpy((void *)spl_image.load_addr,
  34. (void *)(CONFIG_SYS_OS_BASE +
  35. sizeof(struct image_header)),
  36. spl_image.size);
  37. /*
  38. * Copy DT blob (fdt) to SDRAM. Passing pointer to flash
  39. * doesn't work (16 KiB should be enough for DT)
  40. */
  41. memcpy((void *)CONFIG_SYS_SPL_ARGS_ADDR,
  42. (void *)(CONFIG_SYS_FDT_BASE),
  43. (16 << 10));
  44. }
  45. }