diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/Kconfig.boot | 2 | ||||
-rw-r--r-- | common/Makefile | 2 | ||||
-rw-r--r-- | common/board_f.c | 4 | ||||
-rw-r--r-- | common/spl/Kconfig | 36 | ||||
-rw-r--r-- | common/spl/spl.c | 11 | ||||
-rw-r--r-- | common/spl/spl_mmc.c | 16 | ||||
-rw-r--r-- | common/spl/spl_net.c | 4 | ||||
-rw-r--r-- | common/spl/spl_sata.c | 12 | ||||
-rw-r--r-- | common/spl/spl_spi.c | 2 | ||||
-rw-r--r-- | common/stdio.c | 2 |
10 files changed, 63 insertions, 28 deletions
diff --git a/common/Kconfig.boot b/common/Kconfig.boot index 642dd9bcfbe..f39df04bbfa 100644 --- a/common/Kconfig.boot +++ b/common/Kconfig.boot @@ -184,7 +184,7 @@ config SPL_FIT_SIGNATURE depends on SPL_LOAD_FIT || SPL_LOAD_FIT_FULL select FIT_SIGNATURE select SPL_FIT - select SPL_CRYPTO_SUPPORT + select SPL_CRYPTO select SPL_HASH_SUPPORT select SPL_RSA select SPL_RSA_VERIFY diff --git a/common/Makefile b/common/Makefile index 829ea5fb426..9063ed93910 100644 --- a/common/Makefile +++ b/common/Makefile @@ -72,7 +72,7 @@ obj-$(CONFIG_SPL_LOAD_FIT) += common_fit.o obj-$(CONFIG_SPL_NET_SUPPORT) += miiphyutil.o obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += fdt_support.o -ifdef CONFIG_SPL_USB_HOST_SUPPORT +ifdef CONFIG_SPL_USB_HOST obj-y += usb.o obj-y += usb_hub.o obj-$(CONFIG_SPL_USB_STORAGE) += usb_storage.o diff --git a/common/board_f.c b/common/board_f.c index c1b8e63e560..f2746537c96 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -244,7 +244,7 @@ __weak int dram_init_banksize(void) return 0; } -#if defined(CONFIG_SYS_I2C) +#if defined(CONFIG_SYS_I2C_LEGACY) static int init_func_i2c(void) { puts("I2C: "); @@ -871,7 +871,7 @@ static const init_fnc_t init_sequence_f[] = { misc_init_f, #endif INIT_FUNC_WATCHDOG_RESET -#if defined(CONFIG_SYS_I2C) +#if defined(CONFIG_SYS_I2C_LEGACY) init_func_i2c, #endif #if defined(CONFIG_VID) && !defined(CONFIG_SPL) diff --git a/common/spl/Kconfig b/common/spl/Kconfig index c0183521d20..c155a3b5fcc 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -344,7 +344,7 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR default 0x75 if ARCH_DAVINCI default 0x8a if ARCH_MX6 || ARCH_MX7 default 0x100 if ARCH_UNIPHIER - default 0x140 if ARCH_MVEBU + default 0x0 if ARCH_MVEBU default 0x200 if ARCH_SOCFPGA || ARCH_AT91 default 0x300 if ARCH_ZYNQ || ARCH_KEYSTONE || OMAP34XX || OMAP44XX || \ OMAP54XX || AM33XX || AM43XX || ARCH_K3 @@ -511,7 +511,7 @@ config SPL_CPU may improve boot performance. Enable this option to build the drivers in drivers/cpu as part of an SPL build. -config SPL_CRYPTO_SUPPORT +config SPL_CRYPTO bool "Support crypto drivers" help Enable crypto drivers in SPL. These drivers can be used to @@ -548,7 +548,7 @@ config SPL_DMA the CPU moving the data. Enable this option to build the drivers in drivers/dma as part of an SPL build. -config SPL_DRIVERS_MISC_SUPPORT +config SPL_DRIVERS_MISC bool "Support misc drivers" help Enable miscellaneous drivers in SPL. These drivers perform various @@ -582,7 +582,7 @@ config SPL_SAVEENV "reboot_image" and act accordingly and change the reboot_image to default mode using setenv and save the environment. -config SPL_ETH_SUPPORT +config SPL_ETH bool "Support Ethernet" depends on SPL_ENV_SUPPORT help @@ -636,7 +636,7 @@ config SPL_FPGA as early as possible during boot, and this option can enable that within SPL. -config SPL_GPIO_SUPPORT +config SPL_GPIO bool "Support GPIO in SPL" help Enable support for GPIOs (General-purpose Input/Output) in SPL. @@ -647,7 +647,7 @@ config SPL_GPIO_SUPPORT for example. Enable this option to build the drivers in drivers/gpio as part of an SPL build. -config SPL_I2C_SUPPORT +config SPL_I2C bool "Support I2C" help Enable support for the I2C (Inter-Integrated Circuit) bus in SPL. @@ -761,7 +761,7 @@ config SPL_MTD_SUPPORT devices. See SPL_NAND_SUPPORT and SPL_ONENAND_SUPPORT for how to enable specific MTD drivers. -config SPL_MUSB_NEW_SUPPORT +config SPL_MUSB_NEW bool "Support new Mentor Graphics USB" help Enable support for Mentor Graphics USB in SPL. This is a new @@ -926,7 +926,7 @@ config SPL_NET_SUPPORT This permits SPL to load U-Boot over a network link rather than from an on-board peripheral. Environment support is required since the network stack uses a number of environment variables. See also - SPL_ETH_SUPPORT. + SPL_ETH. if SPL_NET_SUPPORT config SPL_NET_VCI_STRING @@ -1034,7 +1034,7 @@ config SPL_DM_RESET by using the generic reset API provided by driver model. This enables the drivers in drivers/reset as part of an SPL build. -config SPL_POWER_SUPPORT +config SPL_POWER bool "Support power drivers" help Enable support for power control in SPL. This includes support @@ -1099,6 +1099,7 @@ config SPL_SATA_SUPPORT config SPL_SATA_RAW_U_BOOT_USE_SECTOR bool "SATA raw mode: by sector" depends on SPL_SATA_SUPPORT + default y if ARCH_MVEBU help Use sector number for specifying U-Boot location on SATA disk in raw mode. @@ -1106,6 +1107,7 @@ config SPL_SATA_RAW_U_BOOT_USE_SECTOR config SPL_SATA_RAW_U_BOOT_SECTOR hex "Sector on the SATA disk to load U-Boot from" depends on SPL_SATA_RAW_U_BOOT_USE_SECTOR + default 0x1 if ARCH_MVEBU help Sector on the SATA disk to load U-Boot from, when the SATA disk is being used in raw mode. Units: SATA disk sectors (1 sector = 512 bytes). @@ -1192,7 +1194,7 @@ config SPL_THERMAL automatic power-off when the temperature gets too high or low. Other devices may be discrete but connected on a suitable bus. -config SPL_USB_HOST_SUPPORT +config SPL_USB_HOST bool "Support USB host drivers" select HAVE_BLOCK_DEVICE help @@ -1205,7 +1207,7 @@ config SPL_USB_HOST_SUPPORT config SPL_USB_STORAGE bool "Support loading from USB" - depends on SPL_USB_HOST_SUPPORT && !(BLK && !DM_USB) + depends on SPL_USB_HOST && !(BLK && !DM_USB) help Enable support for USB devices in SPL. This allows use of USB devices such as hard drives and flash drivers for loading U-Boot. @@ -1229,7 +1231,7 @@ config SPL_USB_ETHER USB-connected Ethernet link (such as a USB Ethernet dongle) rather than from an onboard peripheral. Environment support is required since the network stack uses a number of environment variables. - See also SPL_NET_SUPPORT and SPL_ETH_SUPPORT. + See also SPL_NET_SUPPORT and SPL_ETH. config SPL_DFU bool "Support DFU (Device Firmware Upgrade)" @@ -1275,7 +1277,7 @@ config SPL_SDP_USB_DEV so it can be used in compiled environment. endif -config SPL_WATCHDOG_SUPPORT +config SPL_WATCHDOG bool "Support watchdog drivers" imply SPL_WDT if !HW_WATCHDOG help @@ -1477,7 +1479,7 @@ config TPL_BOOTROM_SUPPORT BOOT_DEVICE_BOOTROM (or fall-through to the next boot device in the boot device list, if not implemented for a given board) -config TPL_DRIVERS_MISC_SUPPORT +config TPL_DRIVERS_MISC bool "Support misc drivers in TPL" help Enable miscellaneous drivers in TPL. These drivers perform various @@ -1490,7 +1492,7 @@ config TPL_ENV_SUPPORT help Enable environment support in TPL. See SPL_ENV_SUPPORT for details. -config TPL_GPIO_SUPPORT +config TPL_GPIO bool "Support GPIO in TPL" help Enable support for GPIOs (General-purpose Input/Output) in TPL. @@ -1501,10 +1503,10 @@ config TPL_GPIO_SUPPORT for example. Enable this option to build the drivers in drivers/gpio as part of an TPL build. -config TPL_I2C_SUPPORT +config TPL_I2C bool "Support I2C" help - Enable support for the I2C bus in TPL. See SPL_I2C_SUPPORT for + Enable support for the I2C bus in TPL. See SPL_I2C for details. config TPL_LIBCOMMON_SUPPORT diff --git a/common/spl/spl.c b/common/spl/spl.c index d1b072d82c2..d55d3c28485 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -300,6 +300,12 @@ static int spl_load_fit_image(struct spl_image_info *spl_image, } #endif +__weak int spl_parse_board_header(struct spl_image_info *spl_image, + const void *image_header, size_t size) +{ + return -EINVAL; +} + __weak int spl_parse_legacy_header(struct spl_image_info *spl_image, const struct image_header *header) { @@ -352,6 +358,9 @@ int spl_parse_image_header(struct spl_image_info *spl_image, } #endif + if (!spl_parse_board_header(spl_image, (const void *)header, sizeof(*header))) + return 0; + #ifdef CONFIG_SPL_RAW_IMAGE_SUPPORT /* Signature not found - assume u-boot.bin */ debug("mkimage signature not found - ih_magic = %x\n", @@ -707,7 +716,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2) spl_board_init(); #endif -#if defined(CONFIG_SPL_WATCHDOG_SUPPORT) && CONFIG_IS_ENABLED(WDT) +#if defined(CONFIG_SPL_WATCHDOG) && CONFIG_IS_ENABLED(WDT) initr_watchdog(); #endif diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index 4dff9bfd6e8..212a2b09928 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -20,26 +20,40 @@ static int mmc_load_legacy(struct spl_image_info *spl_image, struct mmc *mmc, ulong sector, struct image_header *header) { + u32 image_offset_sectors; u32 image_size_sectors; unsigned long count; + u32 image_offset; int ret; ret = spl_parse_image_header(spl_image, header); if (ret) return ret; + /* convert offset to sectors - round down */ + image_offset_sectors = spl_image->offset / mmc->read_bl_len; + /* calculate remaining offset */ + image_offset = spl_image->offset % mmc->read_bl_len; + /* convert size to sectors - round up */ image_size_sectors = (spl_image->size + mmc->read_bl_len - 1) / mmc->read_bl_len; /* Read the header too to avoid extra memcpy */ - count = blk_dread(mmc_get_blk_desc(mmc), sector, image_size_sectors, + count = blk_dread(mmc_get_blk_desc(mmc), + sector + image_offset_sectors, + image_size_sectors, (void *)(ulong)spl_image->load_addr); debug("read %x sectors to %lx\n", image_size_sectors, spl_image->load_addr); if (count != image_size_sectors) return -EIO; + if (image_offset) + memmove((void *)(ulong)spl_image->load_addr, + (void *)(ulong)spl_image->load_addr + image_offset, + spl_image->size); + return 0; } diff --git a/common/spl/spl_net.c b/common/spl/spl_net.c index e140a6306ff..d23b395ab96 100644 --- a/common/spl/spl_net.c +++ b/common/spl/spl_net.c @@ -15,7 +15,7 @@ #include <net.h> #include <linux/libfdt.h> -#if defined(CONFIG_SPL_ETH_SUPPORT) || defined(CONFIG_SPL_USB_ETHER) +#if defined(CONFIG_SPL_ETH) || defined(CONFIG_SPL_USB_ETHER) static ulong spl_net_load_read(struct spl_load_info *load, ulong sector, ulong count, void *buf) { @@ -69,7 +69,7 @@ static int spl_net_load_image(struct spl_image_info *spl_image, } #endif -#ifdef CONFIG_SPL_ETH_SUPPORT +#ifdef CONFIG_SPL_ETH int spl_net_load_image_cpgmac(struct spl_image_info *spl_image, struct spl_boot_device *bootdev) { diff --git a/common/spl/spl_sata.c b/common/spl/spl_sata.c index e108af0576a..535a9219efa 100644 --- a/common/spl/spl_sata.c +++ b/common/spl/spl_sata.c @@ -36,6 +36,8 @@ static int spl_sata_load_image_raw(struct spl_image_info *spl_image, struct image_header *header; unsigned long count; u32 image_size_sectors; + u32 image_offset_sectors; + u32 image_offset; int ret; header = spl_get_load_buffer(-sizeof(*header), stor_dev->blksz); @@ -48,11 +50,19 @@ static int spl_sata_load_image_raw(struct spl_image_info *spl_image, return ret; image_size_sectors = DIV_ROUND_UP(spl_image->size, stor_dev->blksz); - count = blk_dread(stor_dev, sector, image_size_sectors, + image_offset_sectors = spl_image->offset / stor_dev->blksz; + image_offset = spl_image->offset % stor_dev->blksz; + count = blk_dread(stor_dev, sector + image_offset_sectors, + image_size_sectors, (void *)spl_image->load_addr); if (count != image_size_sectors) return -EIO; + if (image_offset) + memmove((void *)spl_image->load_addr, + (void *)spl_image->load_addr + image_offset, + spl_image->size); + return 0; } diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c index 6a4e0332870..9884e7c1850 100644 --- a/common/spl/spl_spi.c +++ b/common/spl/spl_spi.c @@ -159,7 +159,7 @@ static int spl_spi_load_image(struct spl_image_info *spl_image, err = spl_parse_image_header(spl_image, header); if (err) return err; - err = spi_flash_read(flash, payload_offs, + err = spi_flash_read(flash, payload_offs + spl_image->offset, spl_image->size, (void *)spl_image->load_addr); } diff --git a/common/stdio.c b/common/stdio.c index d4acc5256c1..4083e4edb8f 100644 --- a/common/stdio.c +++ b/common/stdio.c @@ -336,7 +336,7 @@ int stdio_add_devices(void) dev->name); } } -#ifdef CONFIG_SYS_I2C +#ifdef CONFIG_SYS_I2C_LEGACY i2c_init_all(); #endif if (IS_ENABLED(CONFIG_DM_VIDEO)) { |