diff options
Diffstat (limited to 'common/spl/spl.c')
-rw-r--r-- | common/spl/spl.c | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/common/spl/spl.c b/common/spl/spl.c index 840910a..b7ec333 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 |