X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=common%2Fspl%2Fspl_fat.c;h=0403016bb433c7bdb2299bdcc215204c6cb6bcec;hb=8b1531f7bc66fae7e5c155d6ae5fa2e7aa77ade2;hp=e2bb00029c24757662550662d423688c897e3c17;hpb=710e9ca5795c9762b09028f1e151981c9052d012;p=u-boot diff --git a/common/spl/spl_fat.c b/common/spl/spl_fat.c index e2bb00029c..0403016bb4 100644 --- a/common/spl/spl_fat.c +++ b/common/spl/spl_fat.c @@ -1,11 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * (C) Copyright 2014 * Texas Instruments, * * Dan Murphy * - * SPDX-License-Identifier: GPL-2.0+ - * * FAT Image Functions copied from spl_mmc.c */ @@ -15,11 +14,10 @@ #include #include #include -#include +#include static int fat_registered; -#ifdef CONFIG_SPL_FAT_SUPPORT static int spl_register_fat_device(struct blk_desc *block_dev, int partition) { int err = 0; @@ -72,7 +70,18 @@ int spl_load_image_fat(struct spl_image_info *spl_image, if (err <= 0) goto end; - if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) && + if (IS_ENABLED(CONFIG_SPL_LOAD_FIT_FULL) && + image_get_magic(header) == FDT_MAGIC) { + err = file_fat_read(filename, (void *)CONFIG_SYS_LOAD_ADDR, 0); + if (err <= 0) + goto end; + err = spl_parse_image_header(spl_image, + (struct image_header *)CONFIG_SYS_LOAD_ADDR); + if (err == -EAGAIN) + return err; + if (err == 0) + err = 1; + } else if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) && image_get_magic(header) == FDT_MAGIC) { struct spl_load_info load; @@ -82,7 +91,7 @@ int spl_load_image_fat(struct spl_image_info *spl_image, load.filename = (void *)filename; load.priv = NULL; - return spl_load_simple_fit(&load, 0, header); + return spl_load_simple_fit(spl_image, &load, 0, header); } else { err = spl_parse_image_header(spl_image, header); if (err) @@ -114,7 +123,7 @@ int spl_load_image_fat_os(struct spl_image_info *spl_image, return err; #if defined(CONFIG_SPL_ENV_SUPPORT) && defined(CONFIG_SPL_OS_BOOT) - file = getenv("falcon_args_file"); + file = env_get("falcon_args_file"); if (file) { err = file_fat_read(file, (void *)CONFIG_SYS_SPL_ARGS_ADDR, 0); if (err <= 0) { @@ -122,7 +131,7 @@ int spl_load_image_fat_os(struct spl_image_info *spl_image, file, err); goto defaults; } - file = getenv("falcon_image_file"); + file = env_get("falcon_image_file"); if (file) { err = spl_load_image_fat(spl_image, block_dev, partition, file); @@ -160,4 +169,3 @@ int spl_load_image_fat_os(struct spl_image_info *spl_image, return -ENOSYS; } #endif -#endif