1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2012 Stefan Roese <sr@denx.de>
9 static int spl_nor_load_image(struct spl_image_info *spl_image,
10 struct spl_boot_device *bootdev)
14 * Loading of the payload to SDRAM is done with skipping of
15 * the mkimage header in this SPL NOR driver
17 spl_image->flags |= SPL_COPY_PAYLOAD_ONLY;
19 #ifdef CONFIG_SPL_OS_BOOT
20 if (!spl_start_uboot()) {
21 const struct image_header *header;
24 * Load Linux from its location in NOR flash to its defined
27 header = (const struct image_header *)CONFIG_SYS_OS_BASE;
29 if (image_get_os(header) == IH_OS_LINUX) {
30 /* happy - was a Linux */
32 ret = spl_parse_image_header(spl_image, header);
36 memcpy((void *)spl_image->load_addr,
37 (void *)(CONFIG_SYS_OS_BASE +
38 sizeof(struct image_header)),
41 spl_image->arg = (void *)CONFIG_SYS_FDT_BASE;
45 puts("The Expected Linux image was not found.\n"
46 "Please check your NOR configuration.\n"
47 "Trying to start u-boot now...\n");
53 * Load real U-Boot from its location in NOR flash to its
54 * defined location in SDRAM
56 ret = spl_parse_image_header(spl_image,
57 (const struct image_header *)CONFIG_SYS_UBOOT_BASE);
61 memcpy((void *)(unsigned long)spl_image->load_addr,
62 (void *)(CONFIG_SYS_UBOOT_BASE + sizeof(struct image_header)),
67 SPL_LOAD_IMAGE_METHOD("NOR", 0, BOOT_DEVICE_NOR, spl_nor_load_image);