spl_onenand.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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 <image.h>
  13. #include <log.h>
  14. #include <spl.h>
  15. #include <asm/io.h>
  16. #include <onenand_uboot.h>
  17. static int spl_onenand_load_image(struct spl_image_info *spl_image,
  18. struct spl_boot_device *bootdev)
  19. {
  20. struct image_header *header;
  21. int ret;
  22. debug("spl: onenand\n");
  23. header = spl_get_load_buffer(0, CONFIG_SYS_ONENAND_PAGE_SIZE);
  24. /* Load u-boot */
  25. onenand_spl_load_image(CONFIG_SYS_ONENAND_U_BOOT_OFFS,
  26. CONFIG_SYS_ONENAND_PAGE_SIZE, (void *)header);
  27. ret = spl_parse_image_header(spl_image, header);
  28. if (ret)
  29. return ret;
  30. onenand_spl_load_image(CONFIG_SYS_ONENAND_U_BOOT_OFFS,
  31. spl_image->size, (void *)spl_image->load_addr);
  32. return 0;
  33. }
  34. /* Use priorty 1 so that Ubi can override this */
  35. SPL_LOAD_IMAGE_METHOD("OneNAND", 1, BOOT_DEVICE_ONENAND,
  36. spl_onenand_load_image);