2 * Copyright (C) 2012 Stefan Roese <sr@denx.de>
4 * SPDX-License-Identifier: GPL-2.0+
10 static int spl_nor_load_image(struct spl_image_info *spl_image,
11 struct spl_boot_device *bootdev)
15 * Loading of the payload to SDRAM is done with skipping of
16 * the mkimage header in this SPL NOR driver
18 spl_image->flags |= SPL_COPY_PAYLOAD_ONLY;
20 #ifdef CONFIG_SPL_OS_BOOT
21 if (!spl_start_uboot()) {
22 const struct image_header *header;
25 * Load Linux from its location in NOR flash to its defined
28 header = (const struct image_header *)CONFIG_SYS_OS_BASE;
30 if (image_get_os(header) == IH_OS_LINUX) {
31 /* happy - was a Linux */
33 ret = spl_parse_image_header(spl_image, header);
37 memcpy((void *)spl_image->load_addr,
38 (void *)(CONFIG_SYS_OS_BASE +
39 sizeof(struct image_header)),
43 * Copy DT blob (fdt) to SDRAM. Passing pointer to
46 memcpy((void *)CONFIG_SYS_SPL_ARGS_ADDR,
47 (void *)(CONFIG_SYS_FDT_BASE),
52 puts("The Expected Linux image was not found.\n"
53 "Please check your NOR configuration.\n"
54 "Trying to start u-boot now...\n");
60 * Load real U-Boot from its location in NOR flash to its
61 * defined location in SDRAM
63 ret = spl_parse_image_header(spl_image,
64 (const struct image_header *)CONFIG_SYS_UBOOT_BASE);
68 memcpy((void *)(unsigned long)spl_image->load_addr,
69 (void *)(CONFIG_SYS_UBOOT_BASE + sizeof(struct image_header)),
74 SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_NOR, spl_nor_load_image);