spl_onenand.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2013
  4. * ISEE 2007 SL - Enric Balletbo i Serra <eballetbo@iseebcn.com>
  5. *
  6. * Based on common/spl/spl_nand.c
  7. * Copyright (C) 2011
  8. * Corscience GmbH & Co. KG - Simon Schwarz <schwarz@corscience.de>
  9. */
  10. #include <common.h>
  11. #include <config.h>
  12. #include <spl.h>
  13. #include <asm/io.h>
  14. #include <onenand_uboot.h>
  15. static int spl_onenand_load_image(struct spl_image_info *spl_image,
  16. struct spl_boot_device *bootdev)
  17. {
  18. struct image_header *header;
  19. int ret;
  20. debug("spl: onenand\n");
  21. /*use CONFIG_SYS_TEXT_BASE as temporary storage area */
  22. header = (struct image_header *)(CONFIG_SYS_TEXT_BASE);
  23. /* Load u-boot */
  24. onenand_spl_load_image(CONFIG_SYS_ONENAND_U_BOOT_OFFS,
  25. CONFIG_SYS_ONENAND_PAGE_SIZE, (void *)header);
  26. ret = spl_parse_image_header(spl_image, header);
  27. if (ret)
  28. return ret;
  29. onenand_spl_load_image(CONFIG_SYS_ONENAND_U_BOOT_OFFS,
  30. spl_image->size, (void *)spl_image->load_addr);
  31. return 0;
  32. }
  33. /* Use priorty 1 so that Ubi can override this */
  34. SPL_LOAD_IMAGE_METHOD("OneNAND", 1, BOOT_DEVICE_ONENAND,
  35. spl_onenand_load_image);