diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/Kconfig | 6 | ||||
-rw-r--r-- | common/board_f.c | 14 | ||||
-rw-r--r-- | common/bootm.c | 12 | ||||
-rw-r--r-- | common/bootm_os.c | 1 | ||||
-rw-r--r-- | common/env_common.c | 2 | ||||
-rw-r--r-- | common/env_sf.c | 8 | ||||
-rw-r--r-- | common/fb_mmc.c | 2 | ||||
-rw-r--r-- | common/image-fit.c | 7 | ||||
-rw-r--r-- | common/image.c | 87 | ||||
-rw-r--r-- | common/spl/Makefile | 3 | ||||
-rw-r--r-- | common/spl/spl.c | 39 | ||||
-rw-r--r-- | common/spl/spl_fat.c | 3 | ||||
-rw-r--r-- | common/spl/spl_fit.c | 25 | ||||
-rw-r--r-- | common/spl/spl_mmc.c | 6 | ||||
-rw-r--r-- | common/spl/spl_ubi.c | 78 |
15 files changed, 259 insertions, 34 deletions
diff --git a/common/Kconfig b/common/Kconfig index 8adc821ae0..46e7173c7c 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -197,3 +197,9 @@ config CONSOLE_RECORD_IN_SIZE tstc() and getc() will use this in preference to real device input. The buffer is allocated immediately after the malloc() region is ready. + +config SYS_NO_FLASH + bool "Disable support for parallel NOR flash" + default n + help + This option is used to disable support for parallel NOR flash. diff --git a/common/board_f.c b/common/board_f.c index d405b5b407..c4501affd9 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -117,10 +117,11 @@ static int init_func_watchdog_init(void) # if defined(CONFIG_HW_WATCHDOG) && (defined(CONFIG_BLACKFIN) || \ defined(CONFIG_M68K) || defined(CONFIG_MICROBLAZE) || \ defined(CONFIG_SH) || defined(CONFIG_AT91SAM9_WATCHDOG) || \ + defined(CONFIG_DESIGNWARE_WATCHDOG) || \ defined(CONFIG_IMX_WATCHDOG)) hw_watchdog_init(); -# endif puts(" Watchdog enabled\n"); +# endif WATCHDOG_RESET(); return 0; @@ -339,7 +340,7 @@ static int setup_dest_addr(void) * Record secure memory location. Need recalcuate if memory splits * into banks, or the ram base is not zero. */ - gd->secure_ram = gd->ram_size; + gd->arch.secure_ram = gd->ram_size; #endif /* * Subtract specified amount of memory to hide so that it won't @@ -432,6 +433,15 @@ static int reserve_mmu(void) gd->arch.tlb_addr = gd->relocaddr; debug("TLB table from %08lx to %08lx\n", gd->arch.tlb_addr, gd->arch.tlb_addr + gd->arch.tlb_size); + +#ifdef CONFIG_SYS_MEM_RESERVE_SECURE + /* + * Record allocated tlb_addr in case gd->tlb_addr to be overwritten + * with location within secure ram. + */ + gd->arch.tlb_allocated = gd->arch.tlb_addr; +#endif + return 0; } #endif diff --git a/common/bootm.c b/common/bootm.c index 2431019b3f..9ed6428281 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -635,10 +635,6 @@ int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], goto err; else if (ret == BOOTM_ERR_OVERLAP) ret = 0; -#if defined(CONFIG_SILENT_CONSOLE) && !defined(CONFIG_SILENT_U_BOOT_ONLY) - if (images->os.os == IH_OS_LINUX) - fixup_silent_linux(); -#endif } /* Relocate the ramdisk */ @@ -678,13 +674,19 @@ int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], return 1; } + /* Call various other states that are not generally used */ if (!ret && (states & BOOTM_STATE_OS_CMDLINE)) ret = boot_fn(BOOTM_STATE_OS_CMDLINE, argc, argv, images); if (!ret && (states & BOOTM_STATE_OS_BD_T)) ret = boot_fn(BOOTM_STATE_OS_BD_T, argc, argv, images); - if (!ret && (states & BOOTM_STATE_OS_PREP)) + if (!ret && (states & BOOTM_STATE_OS_PREP)) { +#if defined(CONFIG_SILENT_CONSOLE) && !defined(CONFIG_SILENT_U_BOOT_ONLY) + if (images->os.os == IH_OS_LINUX) + fixup_silent_linux(); +#endif ret = boot_fn(BOOTM_STATE_OS_PREP, argc, argv, images); + } #ifdef CONFIG_TRACE /* Pretend to run the OS, then run a user command */ diff --git a/common/bootm_os.c b/common/bootm_os.c index 9ec84bd0db..e3f5a46412 100644 --- a/common/bootm_os.c +++ b/common/bootm_os.c @@ -481,6 +481,7 @@ int boot_selected_os(int argc, char * const argv[], int state, /* Stand-alone may return when 'autostart' is 'no' */ if (images->os.type == IH_TYPE_STANDALONE || + IS_ENABLED(CONFIG_SANDBOX) || state == BOOTM_STATE_OS_FAKE_GO) /* We expect to return */ return 0; bootstage_error(BOOTSTAGE_ID_BOOT_OS_RETURNED); diff --git a/common/env_common.c b/common/env_common.c index 13db7dc3f7..560cad0247 100644 --- a/common/env_common.c +++ b/common/env_common.c @@ -145,7 +145,7 @@ int set_default_vars(int nvars, char * const vars[]) * env_aes_cbc_get_key() - Get AES-128-CBC key for the environment * * This function shall return 16-byte array containing AES-128 key used - * to encrypt and decrypt the environment. This function must be overriden + * to encrypt and decrypt the environment. This function must be overridden * by the implementer as otherwise the environment encryption will not * work. */ diff --git a/common/env_sf.c b/common/env_sf.c index 273098ceb6..c53200f5c6 100644 --- a/common/env_sf.c +++ b/common/env_sf.c @@ -55,9 +55,9 @@ int saveenv(void) #ifdef CONFIG_DM_SPI_FLASH struct udevice *new; + /* speed and mode will be read from DT */ ret = spi_flash_probe_bus_cs(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS, - CONFIG_ENV_SPI_MAX_HZ, - CONFIG_ENV_SPI_MODE, &new); + 0, 0, &new); if (ret) { set_default_env("!spi_flash_probe_bus_cs() failed"); return 1; @@ -245,9 +245,9 @@ int saveenv(void) #ifdef CONFIG_DM_SPI_FLASH struct udevice *new; + /* speed and mode will be read from DT */ ret = spi_flash_probe_bus_cs(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS, - CONFIG_ENV_SPI_MAX_HZ, - CONFIG_ENV_SPI_MODE, &new); + 0, 0, &new); if (ret) { set_default_env("!spi_flash_probe_bus_cs() failed"); return 1; diff --git a/common/fb_mmc.c b/common/fb_mmc.c index c739651009..8d0524da78 100644 --- a/common/fb_mmc.c +++ b/common/fb_mmc.c @@ -191,7 +191,7 @@ void fb_mmc_erase(const char *cmd) printf("Erasing blocks " LBAFU " to " LBAFU " due to alignment\n", blks_start, blks_start + blks_size); - blks = dev_desc->block_erase(dev_desc, blks_start, blks_size); + blks = blk_derase(dev_desc, blks_start, blks_size); if (blks != blks_size) { error("failed erasing from device %d", dev_desc->devnum); fastboot_fail("failed erasing from device"); diff --git a/common/image-fit.c b/common/image-fit.c index 6f920da220..73ad34e491 100644 --- a/common/image-fit.c +++ b/common/image-fit.c @@ -1684,12 +1684,13 @@ int fit_image_load(bootm_headers_t *images, ulong addr, bootstage_mark(bootstage_id + BOOTSTAGE_SUB_CHECK_ALL); type_ok = fit_image_check_type(fit, noffset, image_type) || - (image_type == IH_TYPE_KERNEL && - fit_image_check_type(fit, noffset, - IH_TYPE_KERNEL_NOLOAD)); + fit_image_check_type(fit, noffset, IH_TYPE_FIRMWARE) || + (image_type == IH_TYPE_KERNEL && + fit_image_check_type(fit, noffset, IH_TYPE_KERNEL_NOLOAD)); os_ok = image_type == IH_TYPE_FLATDT || IH_TYPE_FPGA || fit_image_check_os(fit, noffset, IH_OS_LINUX) || + fit_image_check_os(fit, noffset, IH_OS_U_BOOT) || fit_image_check_os(fit, noffset, IH_OS_OPENRTOS); /* diff --git a/common/image.c b/common/image.c index 0be09e5c63..af155b229b 100644 --- a/common/image.c +++ b/common/image.c @@ -69,7 +69,7 @@ static const image_header_t *image_get_ramdisk(ulong rd_addr, uint8_t arch, #endif static const table_entry_t uimage_arch[] = { - { IH_ARCH_INVALID, NULL, "Invalid ARCH", }, + { IH_ARCH_INVALID, "invalid", "Invalid ARCH", }, { IH_ARCH_ALPHA, "alpha", "Alpha", }, { IH_ARCH_ARM, "arm", "ARM", }, { IH_ARCH_I386, "x86", "Intel x86", }, @@ -97,7 +97,7 @@ static const table_entry_t uimage_arch[] = { }; static const table_entry_t uimage_os[] = { - { IH_OS_INVALID, NULL, "Invalid OS", }, + { IH_OS_INVALID, "invalid", "Invalid OS", }, { IH_OS_LINUX, "linux", "Linux", }, #if defined(CONFIG_LYNXKDI) || defined(USE_HOSTCC) { IH_OS_LYNXOS, "lynxos", "LynxOS", }, @@ -144,7 +144,7 @@ static const table_entry_t uimage_type[] = { { IH_TYPE_KERNEL_NOLOAD, "kernel_noload", "Kernel Image (no loading done)", }, { IH_TYPE_KWBIMAGE, "kwbimage", "Kirkwood Boot Image",}, { IH_TYPE_IMXIMAGE, "imximage", "Freescale i.MX Boot Image",}, - { IH_TYPE_INVALID, NULL, "Invalid Image", }, + { IH_TYPE_INVALID, "invalid", "Invalid Image", }, { IH_TYPE_MULTI, "multi", "Multi-File Image", }, { IH_TYPE_OMAPIMAGE, "omapimage", "TI OMAP SPL With GP CH",}, { IH_TYPE_PBLIMAGE, "pblimage", "Freescale PBL Boot Image",}, @@ -176,6 +176,19 @@ static const table_entry_t uimage_comp[] = { { -1, "", "", }, }; +struct table_info { + const char *desc; + int count; + const table_entry_t *table; +}; + +static const struct table_info table_info[IH_COUNT] = { + { "architecture", IH_ARCH_COUNT, uimage_arch }, + { "compression", IH_COMP_COUNT, uimage_comp }, + { "operating system", IH_OS_COUNT, uimage_os }, + { "image type", IH_TYPE_COUNT, uimage_type }, +}; + /*****************************************************************************/ /* Legacy format routines */ /*****************************************************************************/ @@ -570,6 +583,74 @@ const table_entry_t *get_table_entry(const table_entry_t *table, int id) return NULL; } +static const char *unknown_msg(enum ih_category category) +{ + static char msg[30]; + + strcpy(msg, "Unknown "); + strcat(msg, table_info[category].desc); + + return msg; +} + +/** + * get_cat_table_entry_name - translate entry id to long name + * @category: category to look up (enum ih_category) + * @id: entry id to be translated + * + * This will scan the translation table trying to find the entry that matches + * the given id. + * + * @retur long entry name if translation succeeds; error string on failure + */ +const char *genimg_get_cat_name(enum ih_category category, uint id) +{ + const table_entry_t *entry; + + entry = get_table_entry(table_info[category].table, id); + if (!entry) + return unknown_msg(category); +#if defined(USE_HOSTCC) || !defined(CONFIG_NEEDS_MANUAL_RELOC) + return entry->lname; +#else + return entry->lname + gd->reloc_off; +#endif +} + +/** + * get_cat_table_entry_short_name - translate entry id to short name + * @category: category to look up (enum ih_category) + * @id: entry id to be translated + * + * This will scan the translation table trying to find the entry that matches + * the given id. + * + * @retur short entry name if translation succeeds; error string on failure + */ +const char *genimg_get_cat_short_name(enum ih_category category, uint id) +{ + const table_entry_t *entry; + + entry = get_table_entry(table_info[category].table, id); + if (!entry) + return unknown_msg(category); +#if defined(USE_HOSTCC) || !defined(CONFIG_NEEDS_MANUAL_RELOC) + return entry->sname; +#else + return entry->sname + gd->reloc_off; +#endif +} + +int genimg_get_cat_count(enum ih_category category) +{ + return table_info[category].count; +} + +const char *genimg_get_cat_desc(enum ih_category category) +{ + return table_info[category].desc; +} + /** * get_table_entry_name - translate entry id to long name * @table: pointer to a translation table for entries of a specific type diff --git a/common/spl/Makefile b/common/spl/Makefile index 2e0f695e46..b15f0f6dcd 100644 --- a/common/spl/Makefile +++ b/common/spl/Makefile @@ -13,8 +13,11 @@ obj-$(CONFIG_SPL_FRAMEWORK) += spl.o obj-$(CONFIG_SPL_LOAD_FIT) += spl_fit.o obj-$(CONFIG_SPL_NOR_SUPPORT) += spl_nor.o obj-$(CONFIG_SPL_YMODEM_SUPPORT) += spl_ymodem.o +ifndef CONFIG_SPL_UBI obj-$(CONFIG_SPL_NAND_SUPPORT) += spl_nand.o obj-$(CONFIG_SPL_ONENAND_SUPPORT) += spl_onenand.o +endif +obj-$(CONFIG_SPL_UBI) += spl_ubi.o obj-$(CONFIG_SPL_NET_SUPPORT) += spl_net.o obj-$(CONFIG_SPL_MMC_SUPPORT) += spl_mmc.o obj-$(CONFIG_SPL_USB_SUPPORT) += spl_usb.o diff --git a/common/spl/spl.c b/common/spl/spl.c index 840910a684..b7ec333c8a 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -13,7 +13,6 @@ #include <nand.h> #include <fat.h> #include <version.h> -#include <i2c.h> #include <image.h> #include <malloc.h> #include <dm/root.h> @@ -57,6 +56,15 @@ __weak int spl_start_uboot(void) puts("SPL: Direct Linux boot not active!\n"); return 1; } + +/* + * Weak default function for arch specific zImage check. Return zero + * and fill start and end address if image is recognized. + */ +int __weak bootz_setup(ulong image, ulong *start, ulong *end) +{ + return 1; +} #endif /* @@ -125,6 +133,20 @@ int spl_parse_image_header(const struct image_header *header) /* Signature not found, proceed to other boot methods. */ return -EINVAL; #else +#ifdef CONFIG_SPL_OS_BOOT + ulong start, end; + + if (!bootz_setup((ulong)header, &start, &end)) { + spl_image.name = "Linux"; + spl_image.os = IH_OS_LINUX; + spl_image.load_addr = CONFIG_SYS_LOAD_ADDR; + spl_image.entry_point = CONFIG_SYS_LOAD_ADDR; + spl_image.size = end - start; + debug("spl: payload zImage, load addr: 0x%x size: %d\n", + spl_image.load_addr, spl_image.size); + return 0; + } +#endif /* Signature not found - assume u-boot.bin */ debug("mkimage signature not found - ih_magic = %x\n", header->ih_magic); @@ -203,7 +225,7 @@ int spl_init(void) gd->malloc_limit = CONFIG_SYS_MALLOC_F_LEN; gd->malloc_ptr = 0; #endif - if (CONFIG_IS_ENABLED(OF_CONTROL)) { + if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) { ret = fdtdec_setup(); if (ret) { debug("fdtdec_setup() returned error %d\n", ret); @@ -211,7 +233,8 @@ int spl_init(void) } } if (IS_ENABLED(CONFIG_SPL_DM)) { - ret = dm_init_and_scan(true); + /* With CONFIG_OF_PLATDATA, bring in all devices */ + ret = dm_init_and_scan(!CONFIG_IS_ENABLED(OF_PLATDATA)); if (ret) { debug("dm_init_and_scan() returned error %d\n", ret); return ret; @@ -270,7 +293,7 @@ struct boot_device_name boot_name_table[] = { #ifdef CONFIG_SPL_YMODEM_SUPPORT { BOOT_DEVICE_UART, "UART" }, #endif -#ifdef CONFIG_SPL_SPI_SUPPORT +#if defined(CONFIG_SPL_SPI_SUPPORT) || defined(CONFIG_SPL_SPI_FLASH_SUPPORT) { BOOT_DEVICE_SPI, "SPI" }, #endif #ifdef CONFIG_SPL_ETH_SUPPORT @@ -330,6 +353,11 @@ static int spl_load_image(u32 boot_device) case BOOT_DEVICE_MMC2_2: return spl_mmc_load_image(boot_device); #endif +#ifdef CONFIG_SPL_UBI + case BOOT_DEVICE_NAND: + case BOOT_DEVICE_ONENAND: + return spl_ubi_load_image(boot_device); +#else #ifdef CONFIG_SPL_NAND_SUPPORT case BOOT_DEVICE_NAND: return spl_nand_load_image(); @@ -338,6 +366,7 @@ static int spl_load_image(u32 boot_device) case BOOT_DEVICE_ONENAND: return spl_onenand_load_image(); #endif +#endif #ifdef CONFIG_SPL_NOR_SUPPORT case BOOT_DEVICE_NOR: return spl_nor_load_image(); @@ -346,7 +375,7 @@ static int spl_load_image(u32 boot_device) case BOOT_DEVICE_UART: return spl_ymodem_load_image(); #endif -#ifdef CONFIG_SPL_SPI_SUPPORT +#if defined(CONFIG_SPL_SPI_SUPPORT) || defined(CONFIG_SPL_SPI_FLASH_SUPPORT) case BOOT_DEVICE_SPI: return spl_spi_load_image(); #endif diff --git a/common/spl/spl_fat.c b/common/spl/spl_fat.c index db676186d3..73d33f54fc 100644 --- a/common/spl/spl_fat.c +++ b/common/spl/spl_fat.c @@ -88,7 +88,8 @@ int spl_load_image_fat(struct blk_desc *block_dev, if (err) goto end; - err = file_fat_read(filename, (u8 *)spl_image.load_addr, 0); + err = file_fat_read(filename, + (u8 *)(uintptr_t)spl_image.load_addr, 0); } end: diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 987470896c..be86072c24 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -115,8 +115,10 @@ static int get_aligned_image_overhead(struct spl_load_info *info, int offset) static int get_aligned_image_size(struct spl_load_info *info, int data_size, int offset) { + data_size = data_size + get_aligned_image_overhead(info, offset); + if (info->filename) - return data_size + get_aligned_image_overhead(info, offset); + return data_size; return (data_size + info->bl_len - 1) / info->bl_len; } @@ -132,7 +134,7 @@ int spl_load_simple_fit(struct spl_load_info *info, ulong sector, void *fit) int data_offset, data_size; int base_offset, align_len = ARCH_DMA_MINALIGN - 1; int src_sector; - void *dst; + void *dst, *src; /* * Figure out where the external images start. This is the base for the @@ -206,8 +208,13 @@ int spl_load_simple_fit(struct spl_load_info *info, ulong sector, void *fit) return -EIO; debug("image: dst=%p, data_offset=%x, size=%x\n", dst, data_offset, data_size); - memcpy(dst, dst + get_aligned_image_overhead(info, data_offset), - data_size); + src = dst + get_aligned_image_overhead(info, data_offset); + +#ifdef CONFIG_SPL_FIT_IMAGE_POST_PROCESS + board_fit_image_post_process((void **)&src, (size_t *)&data_size); +#endif + + memcpy(dst, src, data_size); /* Figure out which device tree the board wants to use */ fdt_len = spl_fit_select_fdt(fit, images, &fdt_offset); @@ -236,8 +243,14 @@ int spl_load_simple_fit(struct spl_load_info *info, ulong sector, void *fit) */ debug("fdt: dst=%p, data_offset=%x, size=%x\n", dst, fdt_offset, fdt_len); - memcpy(load_ptr + data_size, - dst + get_aligned_image_overhead(info, fdt_offset), fdt_len); + src = dst + get_aligned_image_overhead(info, fdt_offset); + dst = load_ptr + data_size; + +#ifdef CONFIG_SPL_FIT_IMAGE_POST_PROCESS + board_fit_image_post_process((void **)&src, (size_t *)&fdt_len); +#endif + + memcpy(dst, src, fdt_len); return 0; } diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index c44f1b5dc8..6b3e9e4a17 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -184,7 +184,7 @@ static int mmc_load_image_raw_os(struct mmc *mmc) unsigned long count; int ret; - count = mmc->block_dev.block_read(&mmc->block_dev, + count = blk_dread(mmc_get_blk_desc(mmc), CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR, CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS, (void *) CONFIG_SYS_SPL_ARGS_ADDR); @@ -225,13 +225,13 @@ int spl_mmc_do_fs_boot(struct mmc *mmc) #ifdef CONFIG_SPL_FAT_SUPPORT if (!spl_start_uboot()) { - err = spl_load_image_fat_os(&mmc->block_dev, + err = spl_load_image_fat_os(mmc_get_blk_desc(mmc), CONFIG_SYS_MMCSD_FS_BOOT_PARTITION); if (!err) return err; } #ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME - err = spl_load_image_fat(&mmc->block_dev, + err = spl_load_image_fat(mmc_get_blk_desc(mmc), CONFIG_SYS_MMCSD_FS_BOOT_PARTITION, CONFIG_SPL_FS_LOAD_PAYLOAD_NAME); if (!err) diff --git a/common/spl/spl_ubi.c b/common/spl/spl_ubi.c new file mode 100644 index 0000000000..f97e1ef680 --- /dev/null +++ b/common/spl/spl_ubi.c @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2016 + * Ladislav Michl <ladis@linux-mips.org> + * + * SPDX-License-Identifier: GPL 2.0+ BSD-3-Clause + */ + +#include <common.h> +#include <config.h> +#include <nand.h> +#include <onenand_uboot.h> +#include <ubispl.h> +#include <spl.h> + +int spl_ubi_load_image(u32 boot_device) +{ + struct image_header *header; + struct ubispl_info info; + struct ubispl_load volumes[2]; + int ret = 1; + + switch (boot_device) { +#ifdef CONFIG_SPL_NAND_SUPPORT + case BOOT_DEVICE_NAND: + nand_init(); + info.read = nand_spl_read_block; + info.peb_size = CONFIG_SYS_NAND_BLOCK_SIZE; + break; +#endif +#ifdef CONFIG_SPL_ONENAND_SUPPORT + case BOOT_DEVICE_ONENAND: + info.read = onenand_spl_read_block; + info.peb_size = CONFIG_SYS_ONENAND_BLOCK_SIZE; + break; +#endif + default: + goto out; + } + info.ubi = (struct ubi_scan_info *)CONFIG_SPL_UBI_INFO_ADDR; + info.fastmap = 1; + + info.peb_offset = CONFIG_SPL_UBI_PEB_OFFSET; + info.vid_offset = CONFIG_SPL_UBI_VID_OFFSET; + info.leb_start = CONFIG_SPL_UBI_LEB_START; + info.peb_count = CONFIG_SPL_UBI_MAX_PEBS - info.peb_offset; + +#ifdef CONFIG_SPL_OS_BOOT + if (!spl_start_uboot()) { + volumes[0].vol_id = CONFIG_SPL_UBI_LOAD_KERNEL_ID; + volumes[0].load_addr = (void *)CONFIG_SYS_LOAD_ADDR; + volumes[1].vol_id = CONFIG_SPL_UBI_LOAD_ARGS_ID; + volumes[1].load_addr = (void *)CONFIG_SYS_SPL_ARGS_ADDR; + + ret = ubispl_load_volumes(&info, volumes, 2); + if (!ret) { + header = (struct image_header *)volumes[0].load_addr; + spl_parse_image_header(header); + puts("Linux loaded.\n"); + goto out; + } + puts("Loading Linux failed, falling back to U-Boot.\n"); + } +#endif + header = (struct image_header *) + (CONFIG_SYS_TEXT_BASE - sizeof(struct image_header)); + volumes[0].vol_id = CONFIG_SPL_UBI_LOAD_MONITOR_ID; + volumes[0].load_addr = (void *)header; + + ret = ubispl_load_volumes(&info, volumes, 1); + if (!ret) + spl_parse_image_header(header); +out: +#ifdef CONFIG_SPL_NAND_SUPPORT + if (boot_device == BOOT_DEVICE_NAND) + nand_deselect(); +#endif + return ret; +} |