diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/Kconfig | 20 | ||||
-rw-r--r-- | common/bloblist.c | 3 | ||||
-rw-r--r-- | common/exports.c | 11 | ||||
-rw-r--r-- | common/memsize.c | 5 | ||||
-rw-r--r-- | common/spl/Kconfig | 2 | ||||
-rw-r--r-- | common/spl/spl_ext.c | 64 | ||||
-rw-r--r-- | common/spl/spl_fat.c | 47 | ||||
-rw-r--r-- | common/spl/spl_fit.c | 2 | ||||
-rw-r--r-- | common/spl/spl_mmc.c | 20 | ||||
-rw-r--r-- | common/spl/spl_sata.c | 8 | ||||
-rw-r--r-- | common/usb_onboard_hub.c | 7 |
11 files changed, 105 insertions, 84 deletions
diff --git a/common/Kconfig b/common/Kconfig index a2f653f7e72..30bf225362e 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -280,6 +280,7 @@ config SYS_CONSOLE_IS_IN_ENV config SYS_CONSOLE_OVERWRITE_ROUTINE bool "Allow board control over console overwriting" + depends on !COMPILE_TEST help If this is enabled, and the board-specific function overwrite_console() returns 1, the stdin, stderr and stdout are @@ -714,6 +715,7 @@ config ARCH_MISC_INIT config BOARD_EARLY_INIT_F bool "Call board-specific init before relocation" + depends on !COMPILE_TEST help Some boards need to perform initialisation as soon as possible after boot. With this option, U-Boot calls board_early_init_f() @@ -723,6 +725,7 @@ config BOARD_EARLY_INIT_F config BOARD_EARLY_INIT_R bool "Call board-specific init after relocation" + depends on !COMPILE_TEST help Some boards need to perform initialisation as directly after relocation. With this option, U-Boot calls board_early_init_r() @@ -730,6 +733,7 @@ config BOARD_EARLY_INIT_R config BOARD_INIT bool "Call board-specific init board_init() during init-calls" + depends on !COMPILE_TEST default y if ARM || RISCV || SANDBOX help Some boards need an board_init() function called during the initcall @@ -737,6 +741,7 @@ config BOARD_INIT config BOARD_POSTCLK_INIT bool "Call board_postclk_init" + depends on !COMPILE_TEST help Some boards need this to initialize select items, after clocks / timebase and before env / serial. @@ -780,6 +785,7 @@ config LAST_STAGE_INIT config MISC_INIT_R bool "Execute Misc Init" + depends on !COMPILE_TEST default y if ARCH_KEYSTONE || ARCH_SUNXI || MPC85xx default y if ARCH_OMAP2PLUS && !AM33XX help @@ -833,8 +839,16 @@ config PCI_INIT_R case of DM PCI-based Ethernet devices, which will not be detected without having the enumeration performed earlier. +config SYS_EARLY_PCI_INIT + bool "Enumerate PCI buses early during init" + depends on PCI + help + Do early PCI configuration before the eMMC gets initialised, + because PCI resources are crucial for eMMC access on some boards. + config RESET_PHY_R bool "Reset ethernet PHY during init" + depends on !COMPILE_TEST help Implement reset_phy() in board code if required to reset the ethernet PHY. @@ -924,6 +938,7 @@ config STACKPROTECTOR config MMU_PGPROT bool "Enable RO, RW and RX mappings" + depends on !SANDBOX help U-Boot maps all pages as RWX. If selected pages will be marked as RO(.rodata), RX(.text), RW(.data) right after @@ -945,6 +960,7 @@ config TPL_STACKPROTECTOR config BOARD_RNG_SEED bool "Provide /chosen/rng-seed property to the linux kernel" + depends on !COMPILE_TEST help Selecting this option requires the board to define a board_rng_seed() function, which should return a buffer @@ -1121,8 +1137,8 @@ config BLOBLIST_SIZE config BLOBLIST_SIZE_RELOC hex "Size of bloblist after relocation" - default BLOBLIST_SIZE if BLOBLIST_FIXED || BLOBLIST_ALLOC - default 0x20000 if (ARM && EFI_LOADER && GENERATE_ACPI_TABLE) + default BLOBLIST_SIZE if BLOBLIST_FIXED + default 0x20000 help Sets the size of the bloblist in bytes after relocation. Since U-Boot has a lot more memory available then, it is possible to use a larger diff --git a/common/bloblist.c b/common/bloblist.c index 6e4f020d7c4..d5fa62249a9 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -149,7 +149,8 @@ static int bloblist_addrec(uint tag, int size, int align_log2, { struct bloblist_hdr *hdr = gd->bloblist; struct bloblist_rec *rec; - int data_start, aligned_start, new_alloced; + phys_addr_t data_start, aligned_start; + phys_size_t new_alloced; if (!align_log2) align_log2 = BLOBLIST_BLOB_ALIGN_LOG2; diff --git a/common/exports.c b/common/exports.c index 48b084c3861..1b7fec685b1 100644 --- a/common/exports.c +++ b/common/exports.c @@ -7,10 +7,6 @@ DECLARE_GLOBAL_DATA_PTR; -__attribute__((unused)) static void dummy(void) -{ -} - unsigned long get_version(void) { return XF_VERSION; @@ -18,13 +14,6 @@ unsigned long get_version(void) #define EXPORT_FUNC(f, a, x, ...) gd->jt->x = f; -#ifndef CONFIG_PHY_AQUANTIA -# define mdio_get_current_dev dummy -# define phy_find_by_mask dummy -# define mdio_phydev_for_ethname dummy -# define miiphy_set_current_dev dummy -#endif - int jumptable_init(void) { gd->jt = malloc(sizeof(struct jt_funcs)); diff --git a/common/memsize.c b/common/memsize.c index 86109579c95..3c3ae6f1eba 100644 --- a/common/memsize.c +++ b/common/memsize.c @@ -52,7 +52,10 @@ long get_ram_size(long *base, long maxsize) long val; long size; int i = 0; - int dcache_en = dcache_status(); + int dcache_en = 0; + + if (!CONFIG_IS_ENABLED(SYS_DCACHE_OFF)) + dcache_en = dcache_status(); for (cnt = (maxsize / sizeof(long)) >> 1; cnt > 0; cnt >>= 1) { addr = base + cnt; /* pointer arith! */ diff --git a/common/spl/Kconfig b/common/spl/Kconfig index f34b96efc02..cb7b4179384 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -176,7 +176,7 @@ config SPL_SYS_STACK_F_CHECK_BYTE Constant used to check the stack config SPL_SYS_REPORT_STACK_F_USAGE - depends on SPL_SIZE_LIMIT_PROVIDE_STACK != 0 + depends on SPL_SIZE_LIMIT_PROVIDE_STACK > 0 bool "Check and report stack usage in SPL before relocation" help If this option is enabled, the initial SPL stack is filled with 0xaa diff --git a/common/spl/spl_ext.c b/common/spl/spl_ext.c index 7e0274a3058..c66ba03feb2 100644 --- a/common/spl/spl_ext.c +++ b/common/spl/spl_ext.c @@ -47,9 +47,7 @@ int spl_load_image_ext(struct spl_image_info *spl_image, err = ext4fs_mount(); if (!err) { -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf("%s: ext4fs mount err - %d\n", __func__, err); -#endif return -1; } @@ -63,11 +61,9 @@ int spl_load_image_ext(struct spl_image_info *spl_image, err = spl_load(spl_image, bootdev, &load, filelen, 0); end: -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT if (err < 0) printf("%s: error reading image %s, err - %d\n", __func__, filename, err); -#endif return err < 0; } @@ -91,60 +87,68 @@ int spl_load_image_ext_os(struct spl_image_info *spl_image, err = ext4fs_mount(); if (!err) { -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf("%s: ext4fs mount err - %d\n", __func__, err); -#endif return -1; } -#if defined(CONFIG_SPL_ENV_SUPPORT) - file = env_get("falcon_args_file"); + + if (!CONFIG_IS_ENABLED(ENV_SUPPORT)) + goto defaults; + + file = env_get("falcon_image_file"); if (file) { - err = ext4fs_open(file, &filelen); - if (err < 0) { - puts("spl: ext4fs_open failed\n"); - goto defaults; - } - err = ext4fs_read((void *)CONFIG_SPL_PAYLOAD_ARGS_ADDR, 0, filelen, &actlen); - if (err < 0) { - printf("spl: error reading image %s, err - %d, falling back to default\n", - file, err); + err = spl_load_image_ext(spl_image, bootdev, block_dev, + partition, file); + if (err != 0) { + puts("spl: falling back to default\n"); goto defaults; } - file = env_get("falcon_image_file"); + + ext4fs_set_blk_dev(block_dev, &part_info); + ext4fs_mount(); + file = env_get("falcon_args_file"); if (file) { - err = spl_load_image_ext(spl_image, bootdev, block_dev, - partition, file); - if (err != 0) { - puts("spl: falling back to default\n"); + err = ext4fs_open(file, &filelen); + if (err < 0) { + puts("spl: ext4fs_open failed\n"); + goto defaults; + } + err = ext4fs_read((void *)CONFIG_SPL_PAYLOAD_ARGS_ADDR, + 0, filelen, &actlen); + if (err < 0) { + printf("spl: error reading args %s, err - %d, falling back to default\n", + file, err); goto defaults; } - return 0; } else { - puts("spl: falcon_image_file not set in environment, falling back to default\n"); + puts("spl: falcon_args_file not set in environment, falling back to default\n"); } } else { - puts("spl: falcon_args_file not set in environment, falling back to default\n"); + puts("spl: falcon_image_file not set in environment, falling back to default\n"); } defaults: -#endif + err = spl_load_image_ext(spl_image, bootdev, block_dev, partition, + CONFIG_SPL_FS_LOAD_KERNEL_NAME); + + if (err) + return err; + + ext4fs_set_blk_dev(block_dev, &part_info); + ext4fs_mount(); err = ext4fs_open(CONFIG_SPL_FS_LOAD_ARGS_NAME, &filelen); if (err < 0) puts("spl: ext4fs_open failed\n"); err = ext4fs_read((void *)CONFIG_SPL_PAYLOAD_ARGS_ADDR, 0, filelen, &actlen); if (err < 0) { -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf("%s: error reading image %s, err - %d\n", __func__, CONFIG_SPL_FS_LOAD_ARGS_NAME, err); -#endif return -1; } - return spl_load_image_ext(spl_image, bootdev, block_dev, partition, - CONFIG_SPL_FS_LOAD_KERNEL_NAME); + return 0; } #else int spl_load_image_ext_os(struct spl_image_info *spl_image, diff --git a/common/spl/spl_fat.c b/common/spl/spl_fat.c index 8b7cafa7291..dc52bd13cec 100644 --- a/common/spl/spl_fat.c +++ b/common/spl/spl_fat.c @@ -34,9 +34,7 @@ static int spl_register_fat_device(struct blk_desc *block_dev, int partition) err = fat_register_device(block_dev, partition); if (err) { -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf("%s: fat register err - %d\n", __func__, err); -#endif return err; } @@ -98,11 +96,9 @@ int spl_load_image_fat(struct spl_image_info *spl_image, err = spl_load(spl_image, bootdev, &load, size, 0); end: -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT if (err < 0) printf("%s: error reading image %s, err - %d\n", __func__, filename, err); -#endif return err; } @@ -119,45 +115,50 @@ int spl_load_image_fat_os(struct spl_image_info *spl_image, if (err) return err; -#if defined(CONFIG_SPL_ENV_SUPPORT) && defined(CONFIG_SPL_OS_BOOT) - file = env_get("falcon_args_file"); + if (!CONFIG_IS_ENABLED(ENV_SUPPORT)) + goto defaults; + + file = env_get("falcon_image_file"); if (file) { - err = file_fat_read(file, (void *)CONFIG_SPL_PAYLOAD_ARGS_ADDR, 0); - if (err <= 0) { - printf("spl: error reading image %s, err - %d, falling back to default\n", - file, err); + err = spl_load_image_fat(spl_image, bootdev, block_dev, + partition, file); + if (err != 0) { + puts("spl: falling back to default\n"); goto defaults; } - file = env_get("falcon_image_file"); + + file = env_get("falcon_args_file"); if (file) { - err = spl_load_image_fat(spl_image, bootdev, block_dev, - partition, file); - if (err != 0) { - puts("spl: falling back to default\n"); + err = file_fat_read( + file, (void *)CONFIG_SPL_PAYLOAD_ARGS_ADDR, 0); + if (err <= 0) { + printf("spl: error reading args %s, err - %d, falling back to default\n", + file, err); goto defaults; } - return 0; } else - puts("spl: falcon_image_file not set in environment, falling back to default\n"); + puts("spl: falcon_args_file not set in environment, falling back to default\n"); } else - puts("spl: falcon_args_file not set in environment, falling back to default\n"); + puts("spl: falcon_image_file not set in environment, falling back to default\n"); defaults: -#endif + + err = spl_load_image_fat(spl_image, bootdev, block_dev, partition, + CONFIG_SPL_FS_LOAD_KERNEL_NAME); + + if (err) + return err; err = file_fat_read(CONFIG_SPL_FS_LOAD_ARGS_NAME, (void *)CONFIG_SPL_PAYLOAD_ARGS_ADDR, 0); if (err <= 0) { -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf("%s: error reading image %s, err - %d\n", __func__, CONFIG_SPL_FS_LOAD_ARGS_NAME, err); -#endif return -1; } - return spl_load_image_fat(spl_image, bootdev, block_dev, partition, - CONFIG_SPL_FS_LOAD_KERNEL_NAME); + return 0; } #else int spl_load_image_fat_os(struct spl_image_info *spl_image, diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 25f3c822a49..746c3d2fa28 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -353,7 +353,7 @@ static int load_simple_fit(struct spl_load_info *info, ulong fit_offset, } length = loadEnd - CONFIG_SYS_LOAD_ADDR; } else { - memcpy(load_ptr, src, length); + memmove(load_ptr, src, length); } if (image_info) { diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index d06f9f0dee6..cd56cf71055 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -152,6 +152,16 @@ static int mmc_load_image_raw_os(struct spl_image_info *spl_image, { int ret; + ret = mmc_load_image_raw_sector(spl_image, bootdev, mmc, + CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR); + if (ret) + return ret; + + if (spl_image->os != IH_OS_LINUX && spl_image->os != IH_OS_TEE) { + puts("Expected image is not found. Trying to start U-Boot\n"); + return -ENOENT; + } + #if defined(CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR) unsigned long count; @@ -165,16 +175,6 @@ static int mmc_load_image_raw_os(struct spl_image_info *spl_image, } #endif /* CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR */ - ret = mmc_load_image_raw_sector(spl_image, bootdev, mmc, - CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR); - if (ret) - return ret; - - if (spl_image->os != IH_OS_LINUX && spl_image->os != IH_OS_TEE) { - puts("Expected image is not found. Trying to start U-Boot\n"); - return -ENOENT; - } - return 0; } #else diff --git a/common/spl/spl_sata.c b/common/spl/spl_sata.c index 67fc620d9be..09f94e662fc 100644 --- a/common/spl/spl_sata.c +++ b/common/spl/spl_sata.c @@ -14,10 +14,12 @@ #include <errno.h> #include <fat.h> #include <image.h> +#include <linux/compiler.h> -static int spl_sata_load_image_raw(struct spl_image_info *spl_image, - struct spl_boot_device *bootdev, - struct blk_desc *stor_dev, unsigned long sector) +static int __maybe_unused spl_sata_load_image_raw(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, + struct blk_desc *stor_dev, + unsigned long sector) { struct legacy_img_hdr *header; unsigned long count; diff --git a/common/usb_onboard_hub.c b/common/usb_onboard_hub.c index 805b2ccbc00..6fc34489a98 100644 --- a/common/usb_onboard_hub.c +++ b/common/usb_onboard_hub.c @@ -61,8 +61,13 @@ static int usb5744_i2c_init(struct udevice *dev) int ret, slave_addr; ret = dev_read_phandle_with_args(dev, "i2c-bus", NULL, 0, 0, &phandle); + if (ret == -ENOENT) { + dev_dbg(dev, "i2c-bus not specified\n"); + return 0; + } + if (ret) { - dev_err(dev, "i2c-bus not specified\n"); + dev_err(dev, "i2c-bus read failed\n"); return ret; } |