[PATCH v2 1/1] Allow last block to be read
From: Jesper Schmitz Mouridsen The last block is of size media->block_size Signed-off-by: Jesper Schmitz Mouridsen Simplify expression. Apply same change to efi_disk_write_blocks(). Reviewed-by: Heinrich Schuchardt --- v2: Add missing signed-off lign. Simplify expression. Apply same change to efi_disk_write_blocks(). --- lib/efi_loader/efi_disk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c index 1f6b817dea..307d5d759b 100644 --- a/lib/efi_loader/efi_disk.c +++ b/lib/efi_loader/efi_disk.c @@ -148,7 +148,7 @@ static efi_status_t EFIAPI efi_disk_read_blocks(struct efi_block_io *this, (uintptr_t)buffer & (this->media->io_align - 1)) return EFI_INVALID_PARAMETER; if (lba * this->media->block_size + buffer_size > - this->media->last_block * this->media->block_size) + (this->media->last_block + 1) * this->media->block_size) return EFI_INVALID_PARAMETER; #ifdef CONFIG_EFI_LOADER_BOUNCE_BUFFER @@ -216,7 +216,7 @@ static efi_status_t EFIAPI efi_disk_write_blocks(struct efi_block_io *this, (uintptr_t)buffer & (this->media->io_align - 1)) return EFI_INVALID_PARAMETER; if (lba * this->media->block_size + buffer_size > - this->media->last_block * this->media->block_size) + (this->media->last_block + 1) * this->media->block_size) return EFI_INVALID_PARAMETER; #ifdef CONFIG_EFI_LOADER_BOUNCE_BUFFER -- 2.30.0
[ANN] U-Boot v2021.04-rc2 released
Hey all, It's release day, and here's v2021.04-rc2. It's later in the day than I like to do these, but as you can also see from the patches I just applied, there's a security issue we need to patch as well. I hope these patches are easily backportable as needed, and there is a testcase for them included. Aside from that, there are a few other outstanding things in my patchwork queue I do want to get to, as well as likely pushing more board removals, prior to v2021.04 release itself. In terms of a changelog, git log --merges v2021.04-rc1..v2021.04-rc2 contains what I've pulled but as always, better PR messages and tags will provide better results here. I do have my reminders setup for doing -rc releases every other Monday from here on out and final release on April 5th, 2021. Thanks all! -- Tom signature.asc Description: PGP signature
Re: [PATCH 8/8] image: Check for unit addresses in FITs
On Mon, Feb 15, 2021 at 05:08:12PM -0700, Simon Glass wrote: > Using unit addresses in a FIT is a security risk. Add a check for this > and disallow it. > > CVE-2021-27138 > > Signed-off-by: Simon Glass > Reported-by: Bruce Monroe > Reported-by: Arie Haenel > Reported-by: Julien Lenoir Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 7/8] libfdt: Check for multiple/invalid root nodes
On Mon, Feb 15, 2021 at 05:08:11PM -0700, Simon Glass wrote: > It is possible to construct a devicetree blob with multiple root nodes. > Update fdt_check_full() to check for this, along with a root node with an > invalid name. > > CVE-2021-27097 > > Signed-off-by: Simon Glass > Reported-by: Bruce Monroe > Reported-by: Arie Haenel > Reported-by: Julien Lenoir Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 6/8] image: Add an option to do a full check of the FIT
On Mon, Feb 15, 2021 at 05:08:10PM -0700, Simon Glass wrote: > Some strange modifications of the FIT can introduce security risks. Add an > option to check it thoroughly, using libfdt's fdt_check_full() function. > > Enable this by default if signature verification is enabled. > > CVE-2021-27097 > > Signed-off-by: Simon Glass > Reported-by: Bruce Monroe > Reported-by: Arie Haenel > Reported-by: Julien Lenoir Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 5/8] image: Adjust the workings of fit_check_format()
On Mon, Feb 15, 2021 at 05:08:09PM -0700, Simon Glass wrote: > At present this function does not accept a size for the FIT. This means > that it must be read from the FIT itself, introducing potential security > risk. Update the function to include a size parameter, which can be > invalid, in which case fit_check_format() calculates it. > > For now no callers pass the size, but this can be updated later. > > Also adjust the return value to an error code so that all the different > types of problems can be distinguished by the user. > > Signed-off-by: Simon Glass > Reported-by: Bruce Monroe > Reported-by: Arie Haenel > Reported-by: Julien Lenoir Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 4/8] test: Add tests for the 'evil' vboot attacks
On Mon, Feb 15, 2021 at 05:08:08PM -0700, Simon Glass wrote: > Add tests to check that these two attacks are mitigated by recent patches. > > Signed-off-by: Simon Glass > Reported-by: Bruce Monroe > Reported-by: Arie Haenel > Reported-by: Julien Lenoir Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 3/8] test: Add vboot_evil implementation
On Mon, Feb 15, 2021 at 05:08:07PM -0700, Simon Glass wrote: > Add a library which performs two different attacks on a FIT. > > Signed-off-by: Julien Lenoir > Signed-off-by: Bruce Monroe > Signed-off-by: Arie Haenel > Signed-off-by: Simon Glass Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 2/8] fit: Don't allow verification of images with @ nodes
On Mon, Feb 15, 2021 at 05:08:06PM -0700, Simon Glass wrote: > When searching for a node called 'fred', any unit address appended to the > name is ignored by libfdt, meaning that 'fred' can match 'fred@1'. This > means that we cannot be sure that the node originally intended is the one > that is used. > > Disallow use of nodes with unit addresses. > > Update the forge test also, since it uses @ addresses. > > CVE-2021-27138 > > Signed-off-by: Simon Glass > Reported-by: Bruce Monroe > Reported-by: Arie Haenel > Reported-by: Julien Lenoir Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 1/8] fdt_region: Check for a single root node of the correct name
On Mon, Feb 15, 2021 at 05:08:05PM -0700, Simon Glass wrote: > At present fdt_find_regions() assumes that the FIT is a valid devicetree. > If the FIT has two root nodes this is currently not detected in this > function, nor does libfdt's fdt_check_full() notice. Also it is possible > for the root node to have a name even though it should not. > > Add checks for these and return -FDT_ERR_BADSTRUCTURE if a problem is > detected. > > CVE-2021-27097 > > Signed-off-by: Simon Glass > Reported-by: Bruce Monroe > Reported-by: Arie Haenel > Reported-by: Julien Lenoir Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH v2 1/3] cmd: mvebu: Implement the Marvell hw_info command
On Mon, Feb 15, 2021 at 08:59:32PM +0100, Luka Kovacic wrote: > The hw_info command is implemented to enable parsing Marvell hw_info > formatted environments. This format is often used on Marvell Armada A37XX > based devices to store parameters like the board serial number, factory > MAC addresses and some other information. > These parameters are usually written to the flash in the factory. > > Currently the command supports reading/writing parameters and dumping the > current hw_info parameters. > EEPROM config pattern and checksum aren't supported. > > This functionality has been tested on the GST ESPRESSOBin-Ultra board > successfully, both reading the stock U-Boot parameters in mainline U-Boot > and reading the parameters written by this command in the stock U-Boot. > > Usage example: > => hw_info load > => saveenv > > Signed-off-by: Luka Kovacic > Cc: Luka Perkov > Cc: Robert Marko Reviewed-by: Tom Rini -- Tom signature.asc Description: PGP signature
[PATCH V2 2/5] mmc: meson_gx_mmc: use mmc_pwrseq instead of meson_mmc_pwrseq
Use mmc_pwrseq instead of meson_mmc_pwrseq. Signed-off-by: Jaehoon Chung Acked-by: Neil Armstrong --- Changelog on V2: - Add Neil's Acked-tag - Remove unused variable --- drivers/mmc/meson_gx_mmc.c | 45 +++--- 1 file changed, 3 insertions(+), 42 deletions(-) diff --git a/drivers/mmc/meson_gx_mmc.c b/drivers/mmc/meson_gx_mmc.c index 8b6dfa3b9603..fcf4f03d1e24 100644 --- a/drivers/mmc/meson_gx_mmc.c +++ b/drivers/mmc/meson_gx_mmc.c @@ -265,10 +265,6 @@ static int meson_mmc_probe(struct udevice *dev) uint32_t val; int ret; -#ifdef CONFIG_PWRSEQ - struct udevice *pwr_dev; -#endif - /* Enable the clocks feeding the MMC controller */ ret = clk_get_bulk(dev, ); if (ret) @@ -292,12 +288,11 @@ static int meson_mmc_probe(struct udevice *dev) mmc_set_clock(mmc, cfg->f_min, MMC_CLK_ENABLE); -#ifdef CONFIG_PWRSEQ +#ifdef CONFIG_MMC_PWRSEQ /* Enable power if needed */ - ret = uclass_get_device_by_phandle(UCLASS_PWRSEQ, dev, "mmc-pwrseq", - _dev); + ret = mmc_pwrseq_get_power(dev, cfg); if (!ret) { - ret = pwrseq_set_power(pwr_dev, true); + ret = pwrseq_set_power(cfg->pwr_dev, true); if (ret) return ret; } @@ -342,37 +337,3 @@ U_BOOT_DRIVER(meson_mmc) = { .of_to_plat = meson_mmc_of_to_plat, .plat_auto = sizeof(struct meson_mmc_plat), }; - -#ifdef CONFIG_PWRSEQ -static int meson_mmc_pwrseq_set_power(struct udevice *dev, bool enable) -{ - struct gpio_desc reset; - int ret; - - ret = gpio_request_by_name(dev, "reset-gpios", 0, , GPIOD_IS_OUT); - if (ret) - return ret; - dm_gpio_set_value(, 1); - udelay(1); - dm_gpio_set_value(, 0); - udelay(200); - - return 0; -} - -static const struct pwrseq_ops meson_mmc_pwrseq_ops = { - .set_power = meson_mmc_pwrseq_set_power, -}; - -static const struct udevice_id meson_mmc_pwrseq_ids[] = { - { .compatible = "mmc-pwrseq-emmc" }, - { } -}; - -U_BOOT_DRIVER(meson_mmc_pwrseq_drv) = { - .name = "mmc_pwrseq_emmc", - .id = UCLASS_PWRSEQ, - .of_match = meson_mmc_pwrseq_ids, - .ops= _mmc_pwrseq_ops, -}; -#endif -- 2.29.0
[PATCH V2 1/5] mmc: pwrseq: add mmc-pwrseq file to provide a generic interface
Add mmc-pwrseq file to provide a generic interface. Signed-off-by: Jaehoon Chung --- Changelog on V2: - Remove "default y" in Kconfig --- drivers/mmc/Kconfig | 7 ++ drivers/mmc/Makefile | 1 + drivers/mmc/mmc-pwrseq.c | 51 include/mmc.h| 14 +++ 4 files changed, 73 insertions(+) create mode 100644 drivers/mmc/mmc-pwrseq.c diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig index f8ea92172e44..f8ca52efb6b7 100644 --- a/drivers/mmc/Kconfig +++ b/drivers/mmc/Kconfig @@ -18,6 +18,13 @@ config MMC_WRITE help Enable write access to MMC and SD Cards +config MMC_PWRSEQ + bool "HW reset support for eMMC" + depends on PWRSEQ + help + Ths select Hardware reset support aka pwrseq-emmc for eMMC + devices. + config MMC_BROKEN_CD bool "Poll for broken card detection case" help diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile index 1c849cbab2f1..89d6af3db30b 100644 --- a/drivers/mmc/Makefile +++ b/drivers/mmc/Makefile @@ -6,6 +6,7 @@ obj-y += mmc.o obj-$(CONFIG_$(SPL_)DM_MMC) += mmc-uclass.o obj-$(CONFIG_$(SPL_)MMC_WRITE) += mmc_write.o +obj-$(CONFIG_MMC_PWRSEQ) += mmc-pwrseq.o obj-$(CONFIG_MMC_SDHCI_ADMA_HELPERS) += sdhci-adma.o ifndef CONFIG_$(SPL_)BLK diff --git a/drivers/mmc/mmc-pwrseq.c b/drivers/mmc/mmc-pwrseq.c new file mode 100644 index ..2539f61323d1 --- /dev/null +++ b/drivers/mmc/mmc-pwrseq.c @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * (C) Copyright 2021 SAMSUNG Electronics + * Jaehoon Chung + */ + +#include +#include +#include +#include +#include +#include + +int mmc_pwrseq_get_power(struct udevice *dev, struct mmc_config *cfg) +{ + /* Enable power if needed */ + return uclass_get_device_by_phandle(UCLASS_PWRSEQ, dev, "mmc-pwrseq", + >pwr_dev); +} + +static int mmc_pwrseq_set_power(struct udevice *dev, bool enable) +{ + struct gpio_desc reset; + int ret; + + ret = gpio_request_by_name(dev, "reset-gpios", 0, , GPIOD_IS_OUT); + if (ret) + return ret; + dm_gpio_set_value(, 1); + udelay(1); + dm_gpio_set_value(, 0); + udelay(200); + + return 0; +} + +static const struct pwrseq_ops mmc_pwrseq_ops = { + .set_power = mmc_pwrseq_set_power, +}; + +static const struct udevice_id mmc_pwrseq_ids[] = { + { .compatible = "mmc-pwrseq-emmc" }, + { } +}; + +U_BOOT_DRIVER(mmc_pwrseq_drv) = { + .name = "mmc_pwrseq_emmc", + .id = UCLASS_PWRSEQ, + .of_match = mmc_pwrseq_ids, + .ops= _pwrseq_ops, +}; diff --git a/include/mmc.h b/include/mmc.h index 1d377e0281f1..637081415430 100644 --- a/include/mmc.h +++ b/include/mmc.h @@ -591,6 +591,9 @@ struct mmc_config { uint f_max; uint b_max; unsigned char part_type; +#ifdef CONFIG_MMC_PWRSEQ + struct udevice *pwr_dev; +#endif }; struct sd_ssr { @@ -801,6 +804,17 @@ int mmc_deinit(struct mmc *mmc); */ int mmc_of_parse(struct udevice *dev, struct mmc_config *cfg); +#ifdef CONFIG_MMC_PWRSEQ +/** + * mmc_pwrseq_get_power() - get a power device from device tree + * + * @dev: MMC device + * @cfg: MMC configuration + * @return 0 if OK, -ve on error + */ +int mmc_pwrseq_get_power(struct udevice *dev, struct mmc_config *cfg); +#endif + int mmc_read(struct mmc *mmc, u64 src, uchar *dst, int size); /** -- 2.29.0
[PATCH V2 0/5] Add mmc-pwrseq file to use common function
Some Socs need to use H/W power-reset before probing eMMC. Its function can be resued with same behavior. Changelog on V2: - Not enable CONFIG_MMC_PWRSEQ by default when CONFIG_PWRSEQ is enabled. - Remove unused variable in each drivers. Jaehoon Chung (5): mmc: pwrseq: add mmc-pwrseq file to provide a generic interface mmc: meson_gx_mmc: use mmc_pwrseq instead of meson_mmc_pwrseq mmc: rockchip_dw_mmc: use mmc_pwrseq instead of rockchip_mmc_pwrseq ARM: mach-meson: select MMC_PWRSEQ config configs: enable CONFIG_MMC_PWRSEQ configuration arch/arm/mach-meson/Kconfig | 1 + configs/chromebit_mickey_defconfig | 1 + configs/chromebook_bob_defconfig| 1 + configs/chromebook_jerry_defconfig | 1 + configs/chromebook_minnie_defconfig | 1 + configs/chromebook_speedy_defconfig | 1 + drivers/mmc/Kconfig | 7 drivers/mmc/Makefile| 1 + drivers/mmc/meson_gx_mmc.c | 45 ++--- drivers/mmc/mmc-pwrseq.c| 51 + drivers/mmc/rockchip_dw_mmc.c | 42 ++-- include/mmc.h | 14 12 files changed, 85 insertions(+), 81 deletions(-) create mode 100644 drivers/mmc/mmc-pwrseq.c -- 2.29.0
[PATCH V2 3/5] mmc: rockchip_dw_mmc: use mmc_pwrseq instead of rockchip_mmc_pwrseq
Use mmc_pwrseq instead of rockchip_mmc_pwrseq. Signed-off-by: Jaehoon Chung --- Changelog on V2: - Remove unused variable - Fix build error --- drivers/mmc/rockchip_dw_mmc.c | 42 +++ 1 file changed, 3 insertions(+), 39 deletions(-) diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c index 1be3c1741fd4..36a00bb2bf55 100644 --- a/drivers/mmc/rockchip_dw_mmc.c +++ b/drivers/mmc/rockchip_dw_mmc.c @@ -105,7 +105,6 @@ static int rockchip_dwmmc_probe(struct udevice *dev) struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); struct rockchip_dwmmc_priv *priv = dev_get_priv(dev); struct dwmci_host *host = >host; - struct udevice *pwr_dev __maybe_unused; int ret; #if CONFIG_IS_ENABLED(OF_PLATDATA) @@ -136,12 +135,11 @@ static int rockchip_dwmmc_probe(struct udevice *dev) host->fifo_mode = priv->fifo_mode; -#ifdef CONFIG_PWRSEQ +#ifdef CONFIG_MMC_PWRSEQ /* Enable power if needed */ - ret = uclass_get_device_by_phandle(UCLASS_PWRSEQ, dev, "mmc-pwrseq", - _dev); + ret = mmc_pwrseq_get_power(dev, >cfg); if (!ret) { - ret = pwrseq_set_power(pwr_dev, true); + ret = pwrseq_set_power(plat->cfg.pwr_dev, true); if (ret) return ret; } @@ -182,37 +180,3 @@ U_BOOT_DRIVER(rockchip_rk3288_dw_mshc) = { DM_DRIVER_ALIAS(rockchip_rk3288_dw_mshc, rockchip_rk3328_dw_mshc) DM_DRIVER_ALIAS(rockchip_rk3288_dw_mshc, rockchip_rk3368_dw_mshc) - -#ifdef CONFIG_PWRSEQ -static int rockchip_dwmmc_pwrseq_set_power(struct udevice *dev, bool enable) -{ - struct gpio_desc reset; - int ret; - - ret = gpio_request_by_name(dev, "reset-gpios", 0, , GPIOD_IS_OUT); - if (ret) - return ret; - dm_gpio_set_value(, 1); - udelay(1); - dm_gpio_set_value(, 0); - udelay(200); - - return 0; -} - -static const struct pwrseq_ops rockchip_dwmmc_pwrseq_ops = { - .set_power = rockchip_dwmmc_pwrseq_set_power, -}; - -static const struct udevice_id rockchip_dwmmc_pwrseq_ids[] = { - { .compatible = "mmc-pwrseq-emmc" }, - { } -}; - -U_BOOT_DRIVER(rockchip_dwmmc_pwrseq_drv) = { - .name = "mmc_pwrseq_emmc", - .id = UCLASS_PWRSEQ, - .of_match = rockchip_dwmmc_pwrseq_ids, - .ops= _dwmmc_pwrseq_ops, -}; -#endif -- 2.29.0
[PATCH V2 4/5] ARM: mach-meson: select MMC_PWRSEQ config
Before time, PWRSEQ is selected since below commit. commit 262d34363373 ("board: amlogic: select PWRSEQ for all amlogic platform") Select MMC_PWRSEQ config because of introducing CONFIG_MMC_PWRSEQ for only eMMC module. Signed-off-by: Jaehoon Chung --- arch/arm/mach-meson/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-meson/Kconfig b/arch/arm/mach-meson/Kconfig index 513a33dae204..6cba2c40ddaa 100644 --- a/arch/arm/mach-meson/Kconfig +++ b/arch/arm/mach-meson/Kconfig @@ -9,6 +9,7 @@ config MESON64_COMMON select SYSCON select REGMAP select PWRSEQ + select MMC_PWRSEQ select BOARD_LATE_INIT imply CMD_DM -- 2.29.0
[PATCH V2 5/5] configs: enable CONFIG_MMC_PWRSEQ configuration
Enable CONFIG_MMC_PWRSEQ configuration about boards that is using rockchip_dw_mmc driver. Signed-off-by: Jaehoon Chung --- configs/chromebit_mickey_defconfig | 1 + configs/chromebook_bob_defconfig| 1 + configs/chromebook_jerry_defconfig | 1 + configs/chromebook_minnie_defconfig | 1 + configs/chromebook_speedy_defconfig | 1 + 5 files changed, 5 insertions(+) diff --git a/configs/chromebit_mickey_defconfig b/configs/chromebit_mickey_defconfig index ba1215bca699..c09b63b94626 100644 --- a/configs/chromebit_mickey_defconfig +++ b/configs/chromebit_mickey_defconfig @@ -63,6 +63,7 @@ CONFIG_CROS_EC_KEYB=y CONFIG_CROS_EC=y CONFIG_CROS_EC_SPI=y CONFIG_PWRSEQ=y +CONFIG_MMC_PWRSEQ=y # CONFIG_SPL_DM_MMC is not set CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y diff --git a/configs/chromebook_bob_defconfig b/configs/chromebook_bob_defconfig index 73635f0d13f1..a846b6470fef 100644 --- a/configs/chromebook_bob_defconfig +++ b/configs/chromebook_bob_defconfig @@ -55,6 +55,7 @@ CONFIG_CROS_EC_KEYB=y CONFIG_CROS_EC=y CONFIG_CROS_EC_SPI=y CONFIG_PWRSEQ=y +CONFIG_MMC_PWRSEQ=y CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y CONFIG_MMC_SDHCI=y diff --git a/configs/chromebook_jerry_defconfig b/configs/chromebook_jerry_defconfig index dada5579526b..692b630174d2 100644 --- a/configs/chromebook_jerry_defconfig +++ b/configs/chromebook_jerry_defconfig @@ -65,6 +65,7 @@ CONFIG_CROS_EC_KEYB=y CONFIG_CROS_EC=y CONFIG_CROS_EC_SPI=y CONFIG_PWRSEQ=y +CONFIG_MMC_PWRSEQ=y # CONFIG_SPL_DM_MMC is not set CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y diff --git a/configs/chromebook_minnie_defconfig b/configs/chromebook_minnie_defconfig index 985ca9477069..ae55842e3bfd 100644 --- a/configs/chromebook_minnie_defconfig +++ b/configs/chromebook_minnie_defconfig @@ -65,6 +65,7 @@ CONFIG_CROS_EC_KEYB=y CONFIG_CROS_EC=y CONFIG_CROS_EC_SPI=y CONFIG_PWRSEQ=y +CONFIG_MMC_PWRSEQ=y # CONFIG_SPL_DM_MMC is not set CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y diff --git a/configs/chromebook_speedy_defconfig b/configs/chromebook_speedy_defconfig index e3d4c30739ee..4b460ee6a9e6 100644 --- a/configs/chromebook_speedy_defconfig +++ b/configs/chromebook_speedy_defconfig @@ -64,6 +64,7 @@ CONFIG_CROS_EC_KEYB=y CONFIG_CROS_EC=y CONFIG_CROS_EC_SPI=y CONFIG_PWRSEQ=y +CONFIG_MMC_PWRSEQ=y # CONFIG_SPL_DM_MMC is not set CONFIG_MMC_DW=y CONFIG_MMC_DW_ROCKCHIP=y -- 2.29.0
Re: [PATCH V2] nvme: Fix cache alignment
Hi Marek, On Tue, Feb 16, 2021 at 3:16 AM Marek Vasut wrote: > > The various structures in the driver are already correctly padded and > cache aligned in memory, however the cache operations are called on > the structure sizes, which themselves might not be cache aligned. Add > the necessary rounding to fix this, which permits the nvme to work on > arm64. > > Signed-off-by: Marek Vasut > Cc: Bin Meng > --- > V2: Fix typo in the bugfix description > --- > drivers/nvme/nvme.c | 50 + > 1 file changed, 32 insertions(+), 18 deletions(-) > Would you give a chance to test Andre's patch? http://patchwork.ozlabs.org/project/uboot/patch/20210208133154.12645-1-andre.przyw...@arm.com/ Cc some people who have looked at Andre's patch Regards, Bin
[PATCH 7/8] libfdt: Check for multiple/invalid root nodes
It is possible to construct a devicetree blob with multiple root nodes. Update fdt_check_full() to check for this, along with a root node with an invalid name. CVE-2021-27097 Signed-off-by: Simon Glass Reported-by: Bruce Monroe Reported-by: Arie Haenel Reported-by: Julien Lenoir --- scripts/dtc/libfdt/fdt_ro.c | 17 + test/py/tests/test_vboot.py | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/scripts/dtc/libfdt/fdt_ro.c b/scripts/dtc/libfdt/fdt_ro.c index d984bab036b..efe7efe9211 100644 --- a/scripts/dtc/libfdt/fdt_ro.c +++ b/scripts/dtc/libfdt/fdt_ro.c @@ -867,6 +867,7 @@ int fdt_check_full(const void *fdt, size_t bufsize) unsigned depth = 0; const void *prop; const char *propname; + bool expect_end = false; if (bufsize < FDT_V1_SIZE) return -FDT_ERR_TRUNCATED; @@ -887,6 +888,10 @@ int fdt_check_full(const void *fdt, size_t bufsize) if (nextoffset < 0) return nextoffset; + /* If we see two root nodes, something is wrong */ + if (expect_end && tag != FDT_END) + return -FDT_ERR_BADLAYOUT; + switch (tag) { case FDT_NOP: break; @@ -900,12 +905,24 @@ int fdt_check_full(const void *fdt, size_t bufsize) depth++; if (depth > INT_MAX) return -FDT_ERR_BADSTRUCTURE; + + /* The root node must have an empty name */ + if (depth == 1) { + const char *name; + int len; + + name = fdt_get_name(fdt, offset, ); + if (*name || len) + return -FDT_ERR_BADLAYOUT; + } break; case FDT_END_NODE: if (depth == 0) return -FDT_ERR_BADSTRUCTURE; depth--; + if (depth == 0) + expect_end = true; break; case FDT_PROP: diff --git a/test/py/tests/test_vboot.py b/test/py/tests/test_vboot.py index 9cdc290b9fc..22e8fc10d83 100644 --- a/test/py/tests/test_vboot.py +++ b/test/py/tests/test_vboot.py @@ -255,7 +255,8 @@ def test_vboot(u_boot_console, sha_algo, padding, sign_options, required, util.run_and_log_expect_exception( cons, [fit_check_sign, '-f', efit, '-k', dtb], 1, 'Failed to verify required signature') -run_bootm(sha_algo, 'evil fakeroot', 'Bad Data Hash', False, efit) +run_bootm(sha_algo, 'evil fakeroot', 'Bad FIT kernel image format', + False, efit) # Try adding an @ to the kernel node name. This should be detected. efit = '%stest.evilk.fit' % tmpdir -- 2.30.0.478.g8a0d178c01-goog
[PATCH 8/8] image: Check for unit addresses in FITs
Using unit addresses in a FIT is a security risk. Add a check for this and disallow it. CVE-2021-27138 Signed-off-by: Simon Glass Reported-by: Bruce Monroe Reported-by: Arie Haenel Reported-by: Julien Lenoir --- common/image-fit.c | 56 ++--- test/py/tests/test_vboot.py | 9 +++--- 2 files changed, 57 insertions(+), 8 deletions(-) diff --git a/common/image-fit.c b/common/image-fit.c index bcf395f6a18..28b3d2b1911 100644 --- a/common/image-fit.c +++ b/common/image-fit.c @@ -1568,6 +1568,34 @@ int fit_image_check_comp(const void *fit, int noffset, uint8_t comp) return (comp == image_comp); } +/** + * fdt_check_no_at() - Check for nodes whose names contain '@' + * + * This checks the parent node and all subnodes recursively + * + * @fit: FIT to check + * @parent: Parent node to check + * @return 0 if OK, -EADDRNOTAVAIL is a node has a name containing '@' + */ +static int fdt_check_no_at(const void *fit, int parent) +{ + const char *name; + int node; + int ret; + + name = fdt_get_name(fit, parent, NULL); + if (!name || strchr(name, '@')) + return -EADDRNOTAVAIL; + + fdt_for_each_subnode(node, fit, parent) { + ret = fdt_check_no_at(fit, node); + if (ret) + return ret; + } + + return 0; +} + int fit_check_format(const void *fit, ulong size) { int ret; @@ -1589,10 +1617,27 @@ int fit_check_format(const void *fit, ulong size) if (size == IMAGE_SIZE_INVAL) size = fdt_totalsize(fit); ret = fdt_check_full(fit, size); + if (ret) + ret = -EINVAL; + + /* +* U-Boot stopped using unit addressed in 2017. Since libfdt +* can match nodes ignoring any unit address, signature +* verification can see the wrong node if one is inserted with +* the same name as a valid node but with a unit address +* attached. Protect against this by disallowing unit addresses. +*/ + if (!ret && CONFIG_IS_ENABLED(FIT_SIGNATURE)) { + ret = fdt_check_no_at(fit, 0); + if (ret) { + log_debug("FIT check error %d\n", ret); + return ret; + } + } if (ret) { log_debug("FIT check error %d\n", ret); - return -EINVAL; + return ret; } } @@ -1955,10 +2000,13 @@ int fit_image_load(bootm_headers_t *images, ulong addr, printf("## Loading %s from FIT Image at %08lx ...\n", prop_name, addr); bootstage_mark(bootstage_id + BOOTSTAGE_SUB_FORMAT); - if (fit_check_format(fit, IMAGE_SIZE_INVAL)) { - printf("Bad FIT %s image format!\n", prop_name); + ret = fit_check_format(fit, IMAGE_SIZE_INVAL); + if (ret) { + printf("Bad FIT %s image format! (err=%d)\n", prop_name, ret); + if (CONFIG_IS_ENABLED(FIT_SIGNATURE) && ret == -EADDRNOTAVAIL) + printf("Signature checking prevents use of unit addresses (@) in nodes\n"); bootstage_error(bootstage_id + BOOTSTAGE_SUB_FORMAT); - return -ENOEXEC; + return ret; } bootstage_mark(bootstage_id + BOOTSTAGE_SUB_FORMAT_OK); if (fit_uname) { diff --git a/test/py/tests/test_vboot.py b/test/py/tests/test_vboot.py index 22e8fc10d83..6dff6779d17 100644 --- a/test/py/tests/test_vboot.py +++ b/test/py/tests/test_vboot.py @@ -232,8 +232,8 @@ def test_vboot(u_boot_console, sha_algo, padding, sign_options, required, util.run_and_log(cons, [fit_check_sign, '-f', fit, '-k', dtb]) if full_test: -# Make sure that U-Boot checks that the config is in the list of hashed -# nodes. If it isn't, a security bypass is possible. +# Make sure that U-Boot checks that the config is in the list of +# hashed nodes. If it isn't, a security bypass is possible. ffit = '%stest.forged.fit' % tmpdir shutil.copyfile(fit, ffit) with open(ffit, 'rb') as fd: @@ -263,10 +263,11 @@ def test_vboot(u_boot_console, sha_algo, padding, sign_options, required, shutil.copyfile(fit, efit) vboot_evil.add_evil_node(fit, efit, evil_kernel, 'kernel@') +msg = 'Signature checking prevents use of unit addresses (@) in nodes' util.run_and_log_expect_exception( cons, [fit_check_sign, '-f', efit, '-k', dtb], -1, 'Node name contains @') -run_bootm(sha_algo, 'evil kernel@', 'Bad Data Hash', False, efit) +1, msg) +run_bootm(sha_algo, 'evil kernel@', msg, False,
[PATCH 4/8] test: Add tests for the 'evil' vboot attacks
Add tests to check that these two attacks are mitigated by recent patches. Signed-off-by: Simon Glass Reported-by: Bruce Monroe Reported-by: Arie Haenel Reported-by: Julien Lenoir --- test/py/tests/test_vboot.py | 93 ++--- 1 file changed, 65 insertions(+), 28 deletions(-) diff --git a/test/py/tests/test_vboot.py b/test/py/tests/test_vboot.py index e45800d94c0..9cdc290b9fc 100644 --- a/test/py/tests/test_vboot.py +++ b/test/py/tests/test_vboot.py @@ -24,22 +24,26 @@ For configuration verification: Tests run with both SHA1 and SHA256 hashing. """ +import shutil import struct import pytest import u_boot_utils as util import vboot_forge +import vboot_evil +# Only run the full suite on a few combinations, since it doesn't add any more +# test coverage. TESTDATA = [ -['sha1', '', None, False], -['sha1', '', '-E -p 0x1', False], -['sha1', '-pss', None, False], -['sha1', '-pss', '-E -p 0x1', False], -['sha256', '', None, False], -['sha256', '', '-E -p 0x1', False], -['sha256', '-pss', None, False], -['sha256', '-pss', '-E -p 0x1', False], -['sha256', '-pss', None, True], -['sha256', '-pss', '-E -p 0x1', True], +['sha1', '', None, False, True], +['sha1', '', '-E -p 0x1', False, False], +['sha1', '-pss', None, False, False], +['sha1', '-pss', '-E -p 0x1', False, False], +['sha256', '', None, False, False], +['sha256', '', '-E -p 0x1', False, False], +['sha256', '-pss', None, False, False], +['sha256', '-pss', '-E -p 0x1', False, False], +['sha256', '-pss', None, True, False], +['sha256', '-pss', '-E -p 0x1', True, True], ] @pytest.mark.boardspec('sandbox') @@ -48,8 +52,10 @@ TESTDATA = [ @pytest.mark.requiredtool('fdtget') @pytest.mark.requiredtool('fdtput') @pytest.mark.requiredtool('openssl') -@pytest.mark.parametrize("sha_algo,padding,sign_options,required", TESTDATA) -def test_vboot(u_boot_console, sha_algo, padding, sign_options, required): +@pytest.mark.parametrize("sha_algo,padding,sign_options,required,full_test", + TESTDATA) +def test_vboot(u_boot_console, sha_algo, padding, sign_options, required, + full_test): """Test verified boot signing with mkimage and verification with 'bootm'. This works using sandbox only as it needs to update the device tree used @@ -71,7 +77,7 @@ def test_vboot(u_boot_console, sha_algo, padding, sign_options, required): util.run_and_log(cons, 'dtc %s %s%s -O dtb ' '-o %s%s' % (dtc_args, datadir, dts, tmpdir, dtb)) -def run_bootm(sha_algo, test_type, expect_string, boots): +def run_bootm(sha_algo, test_type, expect_string, boots, fit=None): """Run a 'bootm' command U-Boot. This always starts a fresh U-Boot instance since the device tree may @@ -84,11 +90,14 @@ def test_vboot(u_boot_console, sha_algo, padding, sign_options, required): use. boots: A boolean that is True if Linux should boot and False if we are expected to not boot +fit: FIT filename to load and verify """ +if not fit: +fit = '%stest.fit' % tmpdir cons.restart_uboot() with cons.log.section('Verified boot %s %s' % (sha_algo, test_type)): output = cons.run_command_list( -['host load hostfs - 100 %stest.fit' % tmpdir, +['host load hostfs - 100 %s' % fit, 'fdt addr 100', 'bootm 100']) assert expect_string in ''.join(output) @@ -222,18 +231,41 @@ def test_vboot(u_boot_console, sha_algo, padding, sign_options, required): util.run_and_log(cons, [fit_check_sign, '-f', fit, '-k', dtb]) -# Make sure that U-Boot checks that the config is in the list of hashed -# nodes. If it isn't, a security bypass is possible. -with open(fit, 'rb') as fd: -root, strblock = vboot_forge.read_fdt(fd) -root, strblock = vboot_forge.manipulate(root, strblock) -with open(fit, 'w+b') as fd: -vboot_forge.write_fdt(root, strblock, fd) -util.run_and_log_expect_exception( -cons, [fit_check_sign, '-f', fit, '-k', dtb], -1, 'Failed to verify required signature') - -run_bootm(sha_algo, 'forged config', 'Bad Data Hash', False) +if full_test: +# Make sure that U-Boot checks that the config is in the list of hashed +# nodes. If it isn't, a security bypass is possible. +ffit = '%stest.forged.fit' % tmpdir +shutil.copyfile(fit, ffit) +with open(ffit, 'rb') as fd: +root, strblock = vboot_forge.read_fdt(fd) +root, strblock = vboot_forge.manipulate(root, strblock) +with open(ffit, 'w+b') as fd: +vboot_forge.write_fdt(root, strblock,
[PATCH 3/8] test: Add vboot_evil implementation
Add a library which performs two different attacks on a FIT. Signed-off-by: Julien Lenoir Signed-off-by: Bruce Monroe Signed-off-by: Arie Haenel Signed-off-by: Simon Glass --- test/py/tests/vboot_evil.py | 485 1 file changed, 485 insertions(+) create mode 100644 test/py/tests/vboot_evil.py diff --git a/test/py/tests/vboot_evil.py b/test/py/tests/vboot_evil.py new file mode 100644 index 000..9825c21716b --- /dev/null +++ b/test/py/tests/vboot_evil.py @@ -0,0 +1,485 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2020, Intel Corporation + +"""Modifies a devicetree to add a fake root node, for testing purposes""" + +import hashlib +import struct +import sys + +FDT_PROP = 0x3 +FDT_BEGIN_NODE = 0x1 +FDT_END_NODE = 0x2 +FDT_END = 0x9 + +FAKE_ROOT_ATTACK = 0 +KERNEL_AT = 1 + +MAGIC = 0xd00dfeed + +EVIL_KERNEL_NAME = b'evil_kernel' +FAKE_ROOT_NAME = b'f@keroot' + + +def getstr(dt_strings, off): +"""Get a string from the devicetree string table + +Args: +dt_strings (bytes): Devicetree strings section +off (int): Offset of string to read + +Returns: +str: String read from the table +""" +output = '' +while dt_strings[off]: +output += chr(dt_strings[off]) +off += 1 + +return output + + +def align(offset): +"""Align an offset to a multiple of 4 + +Args: +offset (int): Offset to align + +Returns: +int: Resulting aligned offset (rounds up to nearest multiple) +""" +return (offset + 3) & ~3 + + +def determine_offset(dt_struct, dt_strings, searched_node_name): +"""Determines the offset of an element, either a node or a property + +Args: +dt_struct (bytes): Devicetree struct section +dt_strings (bytes): Devicetree strings section +searched_node_name (str): element path, ex: /images/kernel@1/data + +Returns: +tuple: (node start offset, node end offset) +if element is not found, returns (None, None) +""" +offset = 0 +depth = -1 + +path = '/' + +object_start_offset = None +object_end_offset = None +object_depth = None + +while offset < len(dt_struct): +(tag,) = struct.unpack('>I', dt_struct[offset:offset + 4]) + +if tag == FDT_BEGIN_NODE: +depth += 1 + +begin_node_offset = offset +offset += 4 + +node_name = getstr(dt_struct, offset) +offset += len(node_name) + 1 +offset = align(offset) + +if path[-1] != '/': +path += '/' + +path += str(node_name) + +if path == searched_node_name: +object_start_offset = begin_node_offset +object_depth = depth + +elif tag == FDT_PROP: +begin_prop_offset = offset + +offset += 4 +len_tag, nameoff = struct.unpack('>II', + dt_struct[offset:offset + 8]) +offset += 8 +prop_name = getstr(dt_strings, nameoff) + +len_tag = align(len_tag) + +offset += len_tag + +node_path = path + '/' + str(prop_name) + +if node_path == searched_node_name: +object_start_offset = begin_prop_offset + +elif tag == FDT_END_NODE: +offset += 4 + +path = path[:path.rfind('/')] +if not path: +path = '/' + +if depth == object_depth: +object_end_offset = offset +break +depth -= 1 +elif tag == FDT_END: +break + +else: +print('unknown tag=0x%x, offset=0x%x found!' % (tag, offset)) +break + +return object_start_offset, object_end_offset + + +def modify_node_name(dt_struct, node_offset, replcd_name): +"""Change the name of a node + +Args: +dt_struct (bytes): Devicetree struct section +node_offset (int): Offset of node +replcd_name (str): New name for node + +Returns: +bytes: New dt_struct contents +""" + +# skip 4 bytes for the FDT_BEGIN_NODE +node_offset += 4 + +node_name = getstr(dt_struct, node_offset) +node_name_len = len(node_name) + 1 + +node_name_len = align(node_name_len) + +replcd_name += b'\0' + +# align on 4 bytes +while len(replcd_name) % 4: +replcd_name += b'\0' + +dt_struct = (dt_struct[:node_offset] + replcd_name + + dt_struct[node_offset + node_name_len:]) + +return dt_struct + + +def modify_prop_content(dt_struct, prop_offset, content): +"""Overwrite the value of a property + +Args: +dt_struct (bytes): Devicetree struct section +prop_offset (int): Offset of property (FDT_PROP tag) +content (bytes): New content for the property + +Returns: +bytes: New dt_struct contents +""" +# skip FDT_PROP +
[PATCH 2/8] fit: Don't allow verification of images with @ nodes
When searching for a node called 'fred', any unit address appended to the name is ignored by libfdt, meaning that 'fred' can match 'fred@1'. This means that we cannot be sure that the node originally intended is the one that is used. Disallow use of nodes with unit addresses. Update the forge test also, since it uses @ addresses. CVE-2021-27138 Signed-off-by: Simon Glass Reported-by: Bruce Monroe Reported-by: Arie Haenel Reported-by: Julien Lenoir --- common/image-fit-sig.c | 22 -- common/image-fit.c | 20 +++- test/py/tests/test_fit.py| 24 test/py/tests/vboot_forge.py | 12 ++-- 4 files changed, 53 insertions(+), 25 deletions(-) diff --git a/common/image-fit-sig.c b/common/image-fit-sig.c index 897e04c7a38..34ebb8edfe2 100644 --- a/common/image-fit-sig.c +++ b/common/image-fit-sig.c @@ -149,6 +149,14 @@ static int fit_image_verify_sig(const void *fit, int image_noffset, fdt_for_each_subnode(noffset, fit, image_noffset) { const char *name = fit_get_name(fit, noffset, NULL); + /* +* We don't support this since libfdt considers names with the +* name root but different @ suffix to be equal +*/ + if (strchr(name, '@')) { + err_msg = "Node name contains @"; + goto error; + } if (!strncmp(name, FIT_SIG_NODENAME, strlen(FIT_SIG_NODENAME))) { ret = fit_image_check_sig(fit, noffset, data, @@ -398,9 +406,10 @@ error: return -EPERM; } -int fit_config_verify_required_sigs(const void *fit, int conf_noffset, - const void *sig_blob) +static int fit_config_verify_required_sigs(const void *fit, int conf_noffset, + const void *sig_blob) { + const char *name = fit_get_name(fit, conf_noffset, NULL); int noffset; int sig_node; int verified = 0; @@ -408,6 +417,15 @@ int fit_config_verify_required_sigs(const void *fit, int conf_noffset, bool reqd_policy_all = true; const char *reqd_mode; + /* +* We don't support this since libfdt considers names with the +* name root but different @ suffix to be equal +*/ + if (strchr(name, '@')) { + printf("Configuration node '%s' contains '@'\n", name); + return -EPERM; + } + /* Work out what we need to verify */ sig_node = fdt_subnode_offset(sig_blob, 0, FIT_SIG_NODENAME); if (sig_node < 0) { diff --git a/common/image-fit.c b/common/image-fit.c index adc3e551de9..c3dc814115f 100644 --- a/common/image-fit.c +++ b/common/image-fit.c @@ -1369,21 +1369,31 @@ error: */ int fit_image_verify(const void *fit, int image_noffset) { + const char *name = fit_get_name(fit, image_noffset, NULL); const void *data; size_t size; - int noffset = 0; char*err_msg = ""; + if (strchr(name, '@')) { + /* +* We don't support this since libfdt considers names with the +* name root but different @ suffix to be equal +*/ + err_msg = "Node name contains @"; + goto err; + } /* Get image data and data length */ if (fit_image_get_data_and_size(fit, image_noffset, , )) { err_msg = "Can't get image data/size"; - printf("error!\n%s for '%s' hash node in '%s' image node\n", - err_msg, fit_get_name(fit, noffset, NULL), - fit_get_name(fit, image_noffset, NULL)); - return 0; + goto err; } return fit_image_verify_with_data(fit, image_noffset, data, size); + +err: + printf("error!\n%s in '%s' image node\n", err_msg, + fit_get_name(fit, image_noffset, NULL)); + return 0; } /** diff --git a/test/py/tests/test_fit.py b/test/py/tests/test_fit.py index 84b3f958505..6d5b43c3bab 100755 --- a/test/py/tests/test_fit.py +++ b/test/py/tests/test_fit.py @@ -17,7 +17,7 @@ base_its = ''' #address-cells = <1>; images { -kernel@1 { +kernel-1 { data = /incbin/("%(kernel)s"); type = "kernel"; arch = "sandbox"; @@ -26,7 +26,7 @@ base_its = ''' load = <0x4>; entry = <0x8>; }; -kernel@2 { +kernel-2 { data = /incbin/("%(loadables1)s"); type = "kernel"; arch = "sandbox"; @@ -35,19 +35,19 @@ base_its = ''' %(loadables1_load)s
[PATCH 6/8] image: Add an option to do a full check of the FIT
Some strange modifications of the FIT can introduce security risks. Add an option to check it thoroughly, using libfdt's fdt_check_full() function. Enable this by default if signature verification is enabled. CVE-2021-27097 Signed-off-by: Simon Glass Reported-by: Bruce Monroe Reported-by: Arie Haenel Reported-by: Julien Lenoir --- common/Kconfig.boot | 20 common/image-fit.c | 16 2 files changed, 36 insertions(+) diff --git a/common/Kconfig.boot b/common/Kconfig.boot index 5eaabdfc27f..7532e55edb8 100644 --- a/common/Kconfig.boot +++ b/common/Kconfig.boot @@ -63,6 +63,15 @@ config FIT_ENABLE_SHA512_SUPPORT SHA512 checksum is a 512-bit (64-byte) hash value used to check that the image contents have not been corrupted. +config FIT_FULL_CHECK + bool "Do a full check of the FIT before using it" + default y + help + Enable this do a full check of the FIT to make sure it is valid. This + helps to protect against carefully crafted FITs which take advantage + of bugs or omissions in the code. This includes a bad structure, + multiple root nodes and the like. + config FIT_SIGNATURE bool "Enable signature verification of FIT uImages" depends on DM @@ -70,6 +79,7 @@ config FIT_SIGNATURE select RSA select RSA_VERIFY select IMAGE_SIGN_INFO + select FIT_FULL_CHECK help This option enables signature verification of FIT uImages, using a hash signed and verified using RSA. If @@ -159,6 +169,15 @@ config SPL_FIT_PRINT help Support printing the content of the fitImage in a verbose manner in SPL. +config SPL_FIT_FULL_CHECK + bool "Do a full check of the FIT before using it" + help + Enable this do a full check of the FIT to make sure it is valid. This + helps to protect against carefully crafted FITs which take advantage + of bugs or omissions in the code. This includes a bad structure, + multiple root nodes and the like. + + config SPL_FIT_SIGNATURE bool "Enable signature verification of FIT firmware within SPL" depends on SPL_DM @@ -168,6 +187,7 @@ config SPL_FIT_SIGNATURE select SPL_RSA select SPL_RSA_VERIFY select SPL_IMAGE_SIGN_INFO + select SPL_FIT_FULL_CHECK config SPL_LOAD_FIT bool "Enable SPL loading U-Boot as a FIT (basic fitImage features)" diff --git a/common/image-fit.c b/common/image-fit.c index f6c0428a96b..bcf395f6a18 100644 --- a/common/image-fit.c +++ b/common/image-fit.c @@ -1580,6 +1580,22 @@ int fit_check_format(const void *fit, ulong size) return -ENOEXEC; } + if (CONFIG_IS_ENABLED(FIT_FULL_CHECK)) { + /* +* If we are not given the size, make do wtih calculating it. +* This is not as secure, so we should consider a flag to +* control this. +*/ + if (size == IMAGE_SIZE_INVAL) + size = fdt_totalsize(fit); + ret = fdt_check_full(fit, size); + + if (ret) { + log_debug("FIT check error %d\n", ret); + return -EINVAL; + } + } + /* mandatory / node 'description' property */ if (!fdt_getprop(fit, 0, FIT_DESC_PROP, NULL)) { log_debug("Wrong FIT format: no description\n"); -- 2.30.0.478.g8a0d178c01-goog
[PATCH 5/8] image: Adjust the workings of fit_check_format()
At present this function does not accept a size for the FIT. This means that it must be read from the FIT itself, introducing potential security risk. Update the function to include a size parameter, which can be invalid, in which case fit_check_format() calculates it. For now no callers pass the size, but this can be updated later. Also adjust the return value to an error code so that all the different types of problems can be distinguished by the user. Signed-off-by: Simon Glass Reported-by: Bruce Monroe Reported-by: Arie Haenel Reported-by: Julien Lenoir --- arch/arm/cpu/armv8/sec_firmware.c | 2 +- cmd/bootefi.c | 2 +- cmd/bootm.c| 6 ++-- cmd/disk.c | 2 +- cmd/fpga.c | 2 +- cmd/nand.c | 2 +- cmd/source.c | 2 +- cmd/ximg.c | 2 +- common/image-fdt.c | 2 +- common/image-fit.c | 46 +- common/splash_source.c | 6 ++-- common/update.c| 4 +-- drivers/fpga/socfpga_arria10.c | 6 ++-- drivers/net/fsl-mc/mc.c| 2 +- drivers/net/pfe_eth/pfe_firmware.c | 2 +- include/image.h| 21 +- tools/fit_common.c | 3 +- tools/fit_image.c | 2 +- tools/mkimage.h| 2 ++ 19 files changed, 66 insertions(+), 50 deletions(-) diff --git a/arch/arm/cpu/armv8/sec_firmware.c b/arch/arm/cpu/armv8/sec_firmware.c index c6c4fcc7e07..267894fbcb3 100644 --- a/arch/arm/cpu/armv8/sec_firmware.c +++ b/arch/arm/cpu/armv8/sec_firmware.c @@ -317,7 +317,7 @@ __weak bool sec_firmware_is_valid(const void *sec_firmware_img) return false; } - if (!fit_check_format(sec_firmware_img)) { + if (fit_check_format(sec_firmware_img, IMAGE_SIZE_INVAL)) { printf("SEC Firmware: Bad firmware image (bad FIT header)\n"); return false; } diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 1583a96be14..271b385edea 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -73,7 +73,7 @@ void efi_set_bootdev(const char *dev, const char *devnr, const char *path, /* Remember only PE-COFF and FIT images */ if (efi_check_pe(buffer, buffer_size, NULL) != EFI_SUCCESS) { #ifdef CONFIG_FIT - if (!fit_check_format(buffer)) + if (fit_check_format(buffer, IMAGE_SIZE_INVAL)) return; /* * FIT images of type EFI_OS are started via command bootm. diff --git a/cmd/bootm.c b/cmd/bootm.c index 7732b97f635..81c6b939781 100644 --- a/cmd/bootm.c +++ b/cmd/bootm.c @@ -292,7 +292,7 @@ static int image_info(ulong addr) case IMAGE_FORMAT_FIT: puts(" FIT image found\n"); - if (!fit_check_format(hdr)) { + if (fit_check_format(hdr, IMAGE_SIZE_INVAL)) { puts("Bad FIT image format!\n"); unmap_sysmem(hdr); return 1; @@ -369,7 +369,7 @@ static int do_imls_nor(void) #endif #if defined(CONFIG_FIT) case IMAGE_FORMAT_FIT: - if (!fit_check_format(hdr)) + if (fit_check_format(hdr, IMAGE_SIZE_INVAL)) goto next_sector; printf("FIT Image at %08lX:\n", (ulong)hdr); @@ -449,7 +449,7 @@ static int nand_imls_fitimage(struct mtd_info *mtd, int nand_dev, loff_t off, return ret; } - if (!fit_check_format(imgdata)) { + if (fit_check_format(imgdata, IMAGE_SIZE_INVAL)) { free(imgdata); return 0; } diff --git a/cmd/disk.c b/cmd/disk.c index 0bc3808dfe2..2726115e855 100644 --- a/cmd/disk.c +++ b/cmd/disk.c @@ -114,7 +114,7 @@ int common_diskboot(struct cmd_tbl *cmdtp, const char *intf, int argc, /* This cannot be done earlier, * we need complete FIT image in RAM first */ if (genimg_get_format((void *) addr) == IMAGE_FORMAT_FIT) { - if (!fit_check_format(fit_hdr)) { + if (fit_check_format(fit_hdr, IMAGE_SIZE_INVAL)) { bootstage_error(BOOTSTAGE_ID_IDE_FIT_READ); puts("** Bad FIT image format\n"); return 1; diff --git a/cmd/fpga.c b/cmd/fpga.c index 8ae1c936fbb..51410a8e424 100644 --- a/cmd/fpga.c +++ b/cmd/fpga.c @@ -330,7 +330,7 @@ static int do_fpga_loadmk(struct cmd_tbl *cmdtp, int flag, int argc, return CMD_RET_FAILURE; } - if (!fit_check_format(fit_hdr)) { + if (fit_check_format(fit_hdr, IMAGE_SIZE_INVAL)) { puts("Bad FIT image format\n"); return
[PATCH 1/8] fdt_region: Check for a single root node of the correct name
At present fdt_find_regions() assumes that the FIT is a valid devicetree. If the FIT has two root nodes this is currently not detected in this function, nor does libfdt's fdt_check_full() notice. Also it is possible for the root node to have a name even though it should not. Add checks for these and return -FDT_ERR_BADSTRUCTURE if a problem is detected. CVE-2021-27097 Signed-off-by: Simon Glass Reported-by: Bruce Monroe Reported-by: Arie Haenel Reported-by: Julien Lenoir --- common/fdt_region.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/common/fdt_region.c b/common/fdt_region.c index ff12c518e97..e4ef0ca7703 100644 --- a/common/fdt_region.c +++ b/common/fdt_region.c @@ -43,6 +43,7 @@ int fdt_find_regions(const void *fdt, char * const inc[], int inc_count, int depth = -1; int want = 0; int base = fdt_off_dt_struct(fdt); + bool expect_end = false; end = path; *end = '\0'; @@ -59,6 +60,10 @@ int fdt_find_regions(const void *fdt, char * const inc[], int inc_count, tag = fdt_next_tag(fdt, offset, ); stop_at = nextoffset; + /* If we see two root nodes, something is wrong */ + if (expect_end && tag != FDT_END) + return -FDT_ERR_BADLAYOUT; + switch (tag) { case FDT_PROP: include = want >= 2; @@ -81,6 +86,10 @@ int fdt_find_regions(const void *fdt, char * const inc[], int inc_count, if (depth == FDT_MAX_DEPTH) return -FDT_ERR_BADSTRUCTURE; name = fdt_get_name(fdt, offset, ); + + /* The root node must have an empty name */ + if (!depth && *name) + return -FDT_ERR_BADLAYOUT; if (end - path + 2 + len >= path_len) return -FDT_ERR_NOSPACE; if (end != path + 1) @@ -108,6 +117,8 @@ int fdt_find_regions(const void *fdt, char * const inc[], int inc_count, while (end > path && *--end != '/') ; *end = '\0'; + if (depth == -1) + expect_end = true; break; case FDT_END: -- 2.30.0.478.g8a0d178c01-goog
[PATCH 0/8] vboot: Correct vulnerabilities identified by Intel
This series fixes some vulnerabilities in U-Boot identified by: Julien Lenoir Bruce Monroe Arie Haenel First problem - CVE ID - CVE-2021-27097 Reference URL - http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-27097 Note this CVE ID will so reserved until a few days after publication. CVE Description: Improper input validation in U-Boot boot loader before version 2021.04-rc2 may allow an authenticated user escalate privileges via local access. CVSS Base Score: 7.8 High CVSS Vector - https://www.first.org/cvss/calculator/3.1#CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H U-Boot fetches the signature from the "/configuration" node and later the code from the "/images" node, once signature is verified. The list of nodes to hash is stored in the 'hashed-nodes' property of the signature node: hashed-nodes = b'/\x00/configurations/conf@1\x00 /images/kernel@1\x00/images/kernel@1/hash@1\x00' Signature is computed on memory blocks fetched by the fdt_find_regions_function() function. This matches the blocks based on their 'path', based on the nodes/prop names of the tree. The problem is: the fact that the first node is the root, i.e. a node with an empty name, seems to be a convention that UBoot assumes to be true, but it does not check it explicitly. It is possible to build a FIT in which the first node has a non-empty name, for example 'f@kenode' followed by a genuine root node (with an empty name). U-Boot will then fetch the configuration and images from the fake node, thus fetching from '/f@kenode/configuration' and '/f@kenode/images". Contrarywise, the fdt_find_regions_function() function, matches nodes on their full path, without this assumption. As a result: signature is checked on the 'real' root node while code is loaded from the fake one. Second problem -- CVE ID - CVE-2021-27138 CVE Description: Improper input validation in Das U-Boot before version 2020.04-rc2 may allow an authenticated user escalate privileges via local access. CVSS Base Score: 7.8 High CVSS Vector - https://www.first.org/cvss/calculator/3.1#CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H CVE ID - CVE-2021-27138 - Reference URL - http://cve.mitre.org/cgi-bin/cvename.cgi?name= CVE-2021-27138. Note this CVE ID will so reserved until a few days after publication. A second problem is noticed when an @ symbol is added to a node that does not already have one. In 2017 U-Boot moved away from using @ in node names due to the devicetree compiler warning about them, e.g. in this commit: 838404054e4 ("doc: FIT image: fix incorrect description of DT node unit address") This means that it is possible to add a node name, like fdt-1@evil before the existing fdt-1 node, and U-Boot will use the first one, due to the way the unit-address matching works. Of course, people may still be using the older @ nodes and thus avoiding this problem, but the examples were updated to use a hyphen so this is unlikely. This series corrects the above vulnerabilities. Simon Glass (8): fdt_region: Check for a single root node of the correct name fit: Don't allow verification of images with @ nodes test: Add vboot_evil implementation test: Add tests for the 'evil' vboot attacks image: Adjust the workings of fit_check_format() image: Add an option to do a full check of the FIT libfdt: Check for multiple/invalid root nodes image: Check for unit addresses in FITs arch/arm/cpu/armv8/sec_firmware.c | 2 +- cmd/bootefi.c | 2 +- cmd/bootm.c| 6 +- cmd/disk.c | 2 +- cmd/fpga.c | 2 +- cmd/nand.c | 2 +- cmd/source.c | 2 +- cmd/ximg.c | 2 +- common/Kconfig.boot| 20 ++ common/fdt_region.c| 11 + common/image-fdt.c | 2 +- common/image-fit-sig.c | 22 +- common/image-fit.c | 126 ++-- common/splash_source.c | 6 +- common/update.c| 4 +- drivers/fpga/socfpga_arria10.c | 6 +- drivers/net/fsl-mc/mc.c| 2 +- drivers/net/pfe_eth/pfe_firmware.c | 2 +- include/image.h| 21 +- scripts/dtc/libfdt/fdt_ro.c| 17 + test/py/tests/test_fit.py | 24 +- test/py/tests/test_vboot.py| 95 -- test/py/tests/vboot_evil.py| 485 + test/py/tests/vboot_forge.py | 12 +- tools/fit_common.c | 3 +- tools/fit_image.c | 2 +- tools/mkimage.h| 2 + 27 files changed, 781 insertions(+), 101 deletions(-) create mode 100644 test/py/tests/vboot_evil.py -- 2.30.0.478.g8a0d178c01-goog
Re: [PATCH] mmc: pci: Fix Kconfig dependency
On 2/15/21 9:01 PM, Bin Meng wrote: > The PCI MMC driver depends on the generic MMC SDHCI driver, > otherwise it does not compile. > > Signed-off-by: Bin Meng Reviewed-by: Jaehoon Chung Best Regards, Jaehoon Chung > --- > > drivers/mmc/Kconfig | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig > index f8ea921..3adee0a 100644 > --- a/drivers/mmc/Kconfig > +++ b/drivers/mmc/Kconfig > @@ -304,6 +304,7 @@ config MMC_MXS > > config MMC_PCI > bool "Support for MMC controllers on PCI" > + depends on MMC_SDHCI > help > This selects PCI-based MMC controllers. > If you have an MMC controller on a PCI bus, say Y here. >
Re: [PATCH] cmd: mmc: add mmc partboot
Hi Grygorii, On 2/15/21 10:04 PM, gr embeter wrote: > Hello Jaehoon, > > On Sun, 14 Feb 2021 at 23:08 Jaehoon Chung wrote: > >> Dear Grygorii, >> >> On 2/12/21 7:32 PM, grygorii tertychnyi wrote: >>> This patch allows to determine active boot partition in boot script: >>> >>> if mmc partboot ${mmcdev} 2; then >>> echo "booted from eMMC boot1 partition" >>> fi >> >> I don't know what purpose this patch has. > > > With an eMMC as a boot source I have two boot partitions, i.e. “boot1” and > “boot2”, with two different versions of U-Boot on each partition. > > I also have two different kernels located on eMMC “user” partition, let’s > say “image1” and “image2”. > > So, I want to boot “image1” kernel if it is U-boot from “boot1” partition > is booted now, > and to boot “image2” kernel if it is U-boot from “boot2” partition is > booted. > > It is easy to do it manually. I just added possibility to do it with U-boot > script now, > because “mmc partconf ...” does not let you check the current boot > partition with hush. > > Hope, I explained the purpose. I remembered. Because i feel to see similar patch to use bootpart. At that time, i also asked same question. Sorry for not remembered yours. https://patchwork.ozlabs.org/project/uboot/patch/20201212074633.891704-1-grembe...@outlook.com/ > > > >> >> Best Regards, >> Jaehoon Chung >> >>> >>> Signed-off-by: Grygorii Tertychnyi < >> grygorii.tertych...@leica-geosystems.com> >>> --- >>> cmd/mmc.c | 39 +++ >>> 1 file changed, 39 insertions(+) >>> >>> diff --git a/cmd/mmc.c b/cmd/mmc.c >>> index 1529a3e05ddd..010d6ab9aa19 100644 >>> --- a/cmd/mmc.c >>> +++ b/cmd/mmc.c >>> @@ -771,6 +771,41 @@ static int do_mmc_boot_resize(struct cmd_tbl >> *cmdtp, int flag, >>> return CMD_RET_SUCCESS; >>> } >>> >>> +static int do_mmc_partboot(struct cmd_tbl *cmdtp, int flag, >>> +int argc, char *const argv[]) >>> +{ >>> + int dev; >>> + struct mmc *mmc; >>> + u8 part_args, part_emmc; >>> + >>> + if (argc != 3) >>> + return CMD_RET_USAGE; >>> + >>> + dev = simple_strtoul(argv[1], NULL, 10); >>> + >>> + mmc = init_mmc_device(dev, false); >>> + if (!mmc) >>> + return CMD_RET_FAILURE; >>> + >>> + if (IS_SD(mmc)) { >>> + puts("PARTITION_CONFIG only exists on eMMC\n"); >>> + return CMD_RET_FAILURE; >>> + } >>> + >>> + if (mmc->part_config == MMCPART_NOAVAILABLE) { >>> + printf("No part_config info for ver. 0x%x\n", >> mmc->version); >>> + return CMD_RET_FAILURE; >>> + } >>> + >>> + part_emmc = EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config); >>> + part_args = simple_strtoul(argv[2], NULL, 10); >>> + >>> + if (part_emmc == part_args) >>> + return CMD_RET_SUCCESS; >>> + else >>> + return CMD_RET_FAILURE; >>> +} >>> + >>> static int mmc_partconf_print(struct mmc *mmc) >>> { >>> u8 ack, access, part; >>> @@ -953,6 +988,7 @@ static struct cmd_tbl cmd_mmc[] = { >>> #ifdef CONFIG_SUPPORT_EMMC_BOOT >>> U_BOOT_CMD_MKENT(bootbus, 5, 0, do_mmc_bootbus, "", ""), >>> U_BOOT_CMD_MKENT(bootpart-resize, 4, 0, do_mmc_boot_resize, "", >> ""), >>> + U_BOOT_CMD_MKENT(partboot, 3, 0, do_mmc_partboot, "", ""), partboot can be confused. how about changing more clear name, like mmc_bootpart_check? >>> U_BOOT_CMD_MKENT(partconf, 5, 0, do_mmc_partconf, "", ""), >>> U_BOOT_CMD_MKENT(rst-function, 3, 0, do_mmc_rst_func, "", ""), >>> #endif >>> @@ -1021,6 +1057,9 @@ U_BOOT_CMD( >>> " - Set the BOOT_BUS_WIDTH field of the specified device\n" >>> "mmc bootpart-resize > MB>\n" >>> " - Change sizes of boot and RPMB partitions of specified device\n" >>> + "mmc partboot dev boot_partition\n" why it needs to pass "boot_partition"? And use more clear usage..with optional or mandatory. <> - mandatory [] - optional mmc partboot >>> + " - Return success if the given boot_partition value matches >> BOOT_PARTITION_ENABLE\n" >>> + " bit field of the specified device\n" >>> "mmc partconf dev [boot_ack boot_partition partition_access]\n" >>> " - Show or change the bits of the PARTITION_CONFIG field of the >> specified device\n" >>> "mmc rst-function dev value\n" >>> >> >> >
[PATCH v2 3/3] arm: mvebu: Initial ESPRESSOBin-Ultra board support
Add initial support for the ESPRESSOBin-Ultra board from Globalscale Technologies, Inc. The board is based on the 64-bit dual-core Marvell Armada 3720 SoC. Peripherals: - 5 Gigabit Ethernet ports (WAN has PoE, up to 30W, Topaz 6341 switch) - RTC clock (PCF8563) - USB 3.0 port - USB 2.0 port - 4x LED - UART over Micro-USB - M.2 slot (2280) - Mini PCI-E slot Additionally, automatic import of the Marvell hw_info parameters is enabled via the recently added hw_info command. The parameters stored in Marvell hw_info are usually the board serial number and MAC addresses. Signed-off-by: Luka Kovacic Cc: Luka Perkov Cc: Robert Marko --- arch/arm/dts/Makefile | 1 + .../arm/dts/armada-3720-espressobin-ultra.dts | 202 ++ board/Marvell/mvebu_armada-37xx/MAINTAINERS | 8 + board/Marvell/mvebu_armada-37xx/board.c | 92 +++- .../mvebu_espressobin-ultra-88f3720_defconfig | 92 5 files changed, 389 insertions(+), 6 deletions(-) create mode 100644 arch/arm/dts/armada-3720-espressobin-ultra.dts create mode 100644 configs/mvebu_espressobin-ultra-88f3720_defconfig diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 33e483f4fb..9f544b1caf 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -208,6 +208,7 @@ dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \ dtb-$(CONFIG_ARCH_MVEBU) +=\ armada-3720-db.dtb \ armada-3720-espressobin.dtb \ + armada-3720-espressobin-ultra.dtb \ armada-3720-turris-mox.dtb \ armada-3720-uDPU.dtb\ armada-375-db.dtb \ diff --git a/arch/arm/dts/armada-3720-espressobin-ultra.dts b/arch/arm/dts/armada-3720-espressobin-ultra.dts new file mode 100644 index 00..70f97fe239 --- /dev/null +++ b/arch/arm/dts/armada-3720-espressobin-ultra.dts @@ -0,0 +1,202 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Device Tree file for ESPRESSObin-Ultra board + * Copyright (C) 2016 Marvell + * Copyright (C) 2019 Globalscale technologies, Inc. + * Copyright (C) 2020 Sartura Ltd. + * + * Author: Jason Hung + * Author: Luka Kovacic + * Author: Vladimir Vid + */ + +/dts-v1/; + +#include "armada-372x.dtsi" + +/ { + model = "Globalscale Marvell ESPRESSOBin Ultra Board"; + compatible = "globalscale,espressobin-ultra", "marvell,armada3720", "marvell,armada3710"; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + aliases { + ethernet0 = + i2c0 = + spi0 = + }; + + memory { + device_type = "memory"; + reg = <0x 0x 0x 0x2000>; + }; + + vcc_sd_reg0: regulator@0 { + compatible = "regulator-gpio"; + regulator-name = "vcc_sd0"; + regulator-min-microvolt = <180>; + regulator-max-microvolt = <330>; + regulator-type = "voltage"; + states = <180 0x1 + 330 0x0>; + gpios = < 4 GPIO_ACTIVE_HIGH>; + }; + + gpio-leds { + pinctrl-names = "default"; + pinctrl-0 = <_pins>, <_pins>, <_pins>, <_pins>; + compatible = "gpio-leds"; + + led1 { + label = "led1"; + gpios = < 11 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + led2 { + label = "led2"; + gpios = < 12 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + led3 { + label = "led3"; + gpios = < 13 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + led4 { + label = "led4"; + gpios = < 14 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + }; +}; + +_nb { + led1_pins: led1-pins { + groups = "pwm0"; + function = "gpio"; + }; + led2_pins: led2-pins { + groups = "pwm1"; + function = "gpio"; + }; + led3_pins: led3-pins { + groups = "pwm2"; + function = "gpio"; + }; + led4_pins: led4-pins { + groups = "pwm3"; + function = "gpio"; + }; +}; + + { + max-lanes = <3>; + phy0 { + phy-type = ; + phy-speed = ; + }; + + phy1 { + phy-type = ; + phy-speed = ; + }; + + phy2 { + phy-type = ; + phy-speed = ; + }; +}; + + { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <_pins>, <_pins>; +
[PATCH v2 1/3] cmd: mvebu: Implement the Marvell hw_info command
The hw_info command is implemented to enable parsing Marvell hw_info formatted environments. This format is often used on Marvell Armada A37XX based devices to store parameters like the board serial number, factory MAC addresses and some other information. These parameters are usually written to the flash in the factory. Currently the command supports reading/writing parameters and dumping the current hw_info parameters. EEPROM config pattern and checksum aren't supported. This functionality has been tested on the GST ESPRESSOBin-Ultra board successfully, both reading the stock U-Boot parameters in mainline U-Boot and reading the parameters written by this command in the stock U-Boot. Usage example: => hw_info load => saveenv Signed-off-by: Luka Kovacic Cc: Luka Perkov Cc: Robert Marko --- cmd/mvebu/Kconfig | 23 cmd/mvebu/Makefile | 1 + cmd/mvebu/hw_info.c | 312 lib/hashtable.c | 2 +- 4 files changed, 337 insertions(+), 1 deletion(-) create mode 100644 cmd/mvebu/hw_info.c diff --git a/cmd/mvebu/Kconfig b/cmd/mvebu/Kconfig index ad10a572a3..a8e958e7c8 100644 --- a/cmd/mvebu/Kconfig +++ b/cmd/mvebu/Kconfig @@ -9,6 +9,29 @@ config CMD_MVEBU_BUBT For details about bubt command please see the documentation in doc/mvebu/cmd/bubt.txt +config CMD_MVEBU_HW_INFO + bool "hw_info" + depends on SPI_FLASH && ENV_IS_IN_SPI_FLASH && ARCH_MVEBU + default n + help + Enable loading of the Marvell hw_info parameters from the + SPI flash hw_info area. Parameters (usually the board serial + number and MAC addresses) are then imported into the + existing U-Boot environment. + Implementation of this command is compatible with the + original Marvell U-Boot command. Reading and writing is + supported. + EEPROM config pattern and checksum aren't supported. + +config CMD_MVEBU_HW_INFO_OFFSET + hex "Marvell hw_info SPI flash offset" + depends on CMD_MVEBU_HW_INFO + default 0x3E + help + This option defines the SPI flash offset of the Marvell + hw_info area. This defaults to 0x3E on most Armada + A3720 platforms. + choice prompt "Flash for image" default MVEBU_SPI_BOOT diff --git a/cmd/mvebu/Makefile b/cmd/mvebu/Makefile index 96829c48eb..2b5a8b37be 100644 --- a/cmd/mvebu/Makefile +++ b/cmd/mvebu/Makefile @@ -6,3 +6,4 @@ obj-$(CONFIG_CMD_MVEBU_BUBT) += bubt.o +obj-$(CONFIG_CMD_MVEBU_HW_INFO) += hw_info.o diff --git a/cmd/mvebu/hw_info.c b/cmd/mvebu/hw_info.c new file mode 100644 index 00..1ef49d78d4 --- /dev/null +++ b/cmd/mvebu/hw_info.c @@ -0,0 +1,312 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Marvell hw_info command + * Helper command for interfacing with the Marvell hw_info parameters + * + * Copyright (c) 2021 Sartura Ltd. + * Copyright (c) 2018 Marvell International Ltd. + * + * Author: Luka Kovacic + */ + +#include +#include +#include +#include +#include +#include + +#define HW_INFO_SPI_FLASH_OFFSET CONFIG_CMD_MVEBU_HW_INFO_OFFSET + +#define HW_INFO_MAX_ENV_SIZE 0x1F0 +#define HW_INFO_ENV_OFFSET 0xA +#define HW_INFO_ENV_SEP0x20 + +#define HW_INFO_MAX_NAME_LEN 32 + +static char hw_info_allowed_parameters[][HW_INFO_MAX_NAME_LEN] = { + "pcb_slm", + "pcb_rev", + "eco_rev", + "pcb_sn", + "ethaddr", + "eth1addr", + "eth2addr", + "eth3addr", + "eth4addr", + "eth5addr", + "eth6addr", + "eth7addr", + "eth8addr", + "eth9addr", +}; + +static int hw_info_allowed_param_count = (sizeof(hw_info_allowed_parameters) / + sizeof(hw_info_allowed_parameters[0])); + +static int hw_info_check_parameter(char *name) +{ + int idx; + + for (idx = 0; idx < hw_info_allowed_param_count; idx++) { + if (strcmp(name, hw_info_allowed_parameters[idx]) == 0) + return 0; + } + + return -EINVAL; +} + +static int read_spi_flash_offset(char *buf, int offset) +{ + struct spi_flash *flash; + int ret; + + flash = spi_flash_probe(CONFIG_SF_DEFAULT_BUS, + CONFIG_SF_DEFAULT_CS, + CONFIG_SF_DEFAULT_SPEED, + CONFIG_SF_DEFAULT_MODE); + + if (!flash) { + printf("Error - unable to probe SPI flash.\n"); + return -EIO; + } + + ret = spi_flash_read(flash, offset, HW_INFO_MAX_ENV_SIZE, buf); + if (ret) { + printf("Error - unable to read hw_info environment from SPI flash.\n"); + return ret; + } + + return ret; +} + +static int write_spi_flash_offset(char *buf, int offset, ssize_t size) +{ + ssize_t safe_size, erase_size; + struct spi_flash *flash; +
[PATCH v2 2/3] arm: mvebu: mvebu_armada-37xx: Define the loadaddr environment variable
Add the loadaddr U-Boot environment variable, as this is available in the stock Marvell U-Boot by default on Marvell Armada A37XX platforms. Signed-off-by: Luka Kovacic Cc: Luka Perkov Cc: Robert Marko --- include/configs/mvebu_armada-37xx.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/configs/mvebu_armada-37xx.h b/include/configs/mvebu_armada-37xx.h index 2ad4325eaf..1041df8d91 100644 --- a/include/configs/mvebu_armada-37xx.h +++ b/include/configs/mvebu_armada-37xx.h @@ -103,6 +103,7 @@ /* fdt_addr and kernel_addr are needed for existing distribution boot scripts */ #define CONFIG_EXTRA_ENV_SETTINGS \ + "loadaddr=0x600\0" \ "scriptaddr=0x6d0\0"\ "pxefile_addr_r=0x6e0\0"\ "fdt_addr=0x6f0\0" \ -- 2.20.1
[PATCH v2 0/3] Add support for the GST ESPRESSOBin-Ultra board
This patchset adds initial support for the ESPRESSOBin-Ultra board from Globalscale Technologies, Inc. The board is based on the 64-bit dual-core Marvell Armada 3720 SoC. Peripherals: - 5 Gigabit Ethernet ports (WAN has PoE, up to 30W, Topaz 6341 switch) - RTC clock (PCF8563) - USB 3.0 port - USB 2.0 port - 4x LED - UART over Micro-USB - M.2 slot (2280) - Mini PCI-E slot Additionally support for importing Marvell hw_info formatted environments is added to fully support the board. Luka Kovacic (3): cmd: mvebu: Implement the Marvell hw_info command arm: mvebu: mvebu_armada-37xx: Define the loadaddr environment variable arm: mvebu: Initial ESPRESSOBin-Ultra board support arch/arm/dts/Makefile | 1 + .../arm/dts/armada-3720-espressobin-ultra.dts | 202 board/Marvell/mvebu_armada-37xx/MAINTAINERS | 8 + board/Marvell/mvebu_armada-37xx/board.c | 92 +- cmd/mvebu/Kconfig | 23 ++ cmd/mvebu/Makefile| 1 + cmd/mvebu/hw_info.c | 312 ++ .../mvebu_espressobin-ultra-88f3720_defconfig | 92 ++ include/configs/mvebu_armada-37xx.h | 1 + lib/hashtable.c | 2 +- 10 files changed, 727 insertions(+), 7 deletions(-) create mode 100644 arch/arm/dts/armada-3720-espressobin-ultra.dts create mode 100644 cmd/mvebu/hw_info.c create mode 100644 configs/mvebu_espressobin-ultra-88f3720_defconfig -- 2.20.1
[PATCH V2] nvme: Fix cache alignment
The various structures in the driver are already correctly padded and cache aligned in memory, however the cache operations are called on the structure sizes, which themselves might not be cache aligned. Add the necessary rounding to fix this, which permits the nvme to work on arm64. Signed-off-by: Marek Vasut Cc: Bin Meng --- V2: Fix typo in the bugfix description --- drivers/nvme/nvme.c | 50 + 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c index 5d6331ad34..758415a53b 100644 --- a/drivers/nvme/nvme.c +++ b/drivers/nvme/nvme.c @@ -53,6 +53,27 @@ struct nvme_queue { unsigned long cmdid_data[]; }; +static void nvme_align_dcache_range(void *start, unsigned long size, + unsigned long *s, unsigned long *e) +{ + *s = rounddown((uintptr_t)start, ARCH_DMA_MINALIGN); + *e = roundup((uintptr_t)start + size, ARCH_DMA_MINALIGN); +} + +static void nvme_flush_dcache_range(void *start, unsigned long size) +{ + unsigned long s, e; + nvme_align_dcache_range(start, size, , ); + flush_dcache_range(s, e); +} + +static void nvme_invalidate_dcache_range(void *start, unsigned long size) +{ + unsigned long s, e; + nvme_align_dcache_range(start, size, , ); + invalidate_dcache_range(s, e); +} + static int nvme_wait_ready(struct nvme_dev *dev, bool enabled) { u32 bit = enabled ? NVME_CSTS_RDY : 0; @@ -129,8 +150,7 @@ static int nvme_setup_prps(struct nvme_dev *dev, u64 *prp2, } *prp2 = (ulong)dev->prp_pool; - flush_dcache_range((ulong)dev->prp_pool, (ulong)dev->prp_pool + - dev->prp_entry_num * sizeof(u64)); + nvme_flush_dcache_range(dev->prp_pool, dev->prp_entry_num * sizeof(u64)); return 0; } @@ -144,10 +164,8 @@ static __le16 nvme_get_cmd_id(void) static u16 nvme_read_completion_status(struct nvme_queue *nvmeq, u16 index) { - u64 start = (ulong)>cqes[index]; - u64 stop = start + sizeof(struct nvme_completion); - - invalidate_dcache_range(start, stop); + nvme_invalidate_dcache_range(>cqes[index], +sizeof(struct nvme_completion)); return le16_to_cpu(readw(&(nvmeq->cqes[index].status))); } @@ -163,8 +181,7 @@ static void nvme_submit_cmd(struct nvme_queue *nvmeq, struct nvme_command *cmd) u16 tail = nvmeq->sq_tail; memcpy(>sq_cmds[tail], cmd, sizeof(*cmd)); - flush_dcache_range((ulong)>sq_cmds[tail], - (ulong)>sq_cmds[tail] + sizeof(*cmd)); + nvme_flush_dcache_range(>sq_cmds[tail], sizeof(*cmd)); if (++tail == nvmeq->q_depth) tail = 0; @@ -338,8 +355,7 @@ static void nvme_init_queue(struct nvme_queue *nvmeq, u16 qid) nvmeq->cq_phase = 1; nvmeq->q_db = >dbs[qid * 2 * dev->db_stride]; memset((void *)nvmeq->cqes, 0, NVME_CQ_SIZE(nvmeq->q_depth)); - flush_dcache_range((ulong)nvmeq->cqes, - (ulong)nvmeq->cqes + NVME_CQ_SIZE(nvmeq->q_depth)); + nvme_flush_dcache_range(nvmeq->cqes, NVME_CQ_SIZE(nvmeq->q_depth)); dev->online_queues++; } @@ -466,13 +482,13 @@ int nvme_identify(struct nvme_dev *dev, unsigned nsid, c.identify.cns = cpu_to_le32(cns); - invalidate_dcache_range(dma_addr, - dma_addr + sizeof(struct nvme_id_ctrl)); + nvme_invalidate_dcache_range((void *)dma_addr, +sizeof(struct nvme_id_ctrl)); ret = nvme_submit_admin_cmd(dev, , NULL); if (!ret) - invalidate_dcache_range(dma_addr, - dma_addr + sizeof(struct nvme_id_ctrl)); + nvme_invalidate_dcache_range((void *)dma_addr, +sizeof(struct nvme_id_ctrl)); return ret; } @@ -729,8 +745,7 @@ static ulong nvme_blk_rw(struct udevice *udev, lbaint_t blknr, u16 lbas = 1 << (dev->max_transfer_shift - ns->lba_shift); u64 total_lbas = blkcnt; - flush_dcache_range((unsigned long)buffer, - (unsigned long)buffer + total_len); + nvme_flush_dcache_range(buffer, total_len); c.rw.opcode = read ? nvme_cmd_read : nvme_cmd_write; c.rw.flags = 0; @@ -767,8 +782,7 @@ static ulong nvme_blk_rw(struct udevice *udev, lbaint_t blknr, } if (read) - invalidate_dcache_range((unsigned long)buffer, - (unsigned long)buffer + total_len); + nvme_invalidate_dcache_range(buffer, total_len); return (total_len - temp_len) >> desc->log2blksz; } -- 2.30.0
RE: [PATCH v5] dm: core: Add of_match_node helper function
Hi Simon, I have a discussion with Marek and as per him this patch is wrongly assigned to him in patchwork. This patch supposed to be picked up by you. I will rebase this patch to latest master and send it you. Regards, Biju > -Original Message- > From: Biju Das > Sent: 15 February 2021 08:19 > To: Simon Glass ; Marek Vasut > ; Tom Rini > Cc: u-boot@lists.denx.de; Adam Ford ; Marek Vasut > ; Nobuhiro Iwamatsu ; > Chris Paterson ; Prabhakar Mahadev Lad > > Subject: RE: [PATCH v5] dm: core: Add of_match_node helper function > > Hi All, > > Gentle remainder. Are we happy with this patch[1]? > > Not sure who needs to merge this patch. Currently this patch has been > delegated to Marek and is reviewed by Simon. > > [1] https://patchwork.ozlabs.org/project/uboot/patch/20210116124042.24007- > 1-biju.das...@bp.renesas.com/ > > Regards, > Biju > > > -Original Message- > > From: Biju Das > > Sent: 16 January 2021 12:41 > > To: Simon Glass > > Cc: Biju Das ; u-boot@lists.denx.de; Tom > > Rini ; Adam Ford ; Marek Vasut > > ; Nobuhiro Iwamatsu > > ; Chris Paterson ; > > Prabhakar Mahadev Lad > > Subject: [PATCH v5] dm: core: Add of_match_node helper function > > > > Add of_match_node() helper function to iterate over the device tree > > and tell if a device_node has a matching of_match structure. > > > > Signed-off-by: Biju Das > > Reviewed-by: Lad Prabhakar > > Reviewed-by: Simon Glass > > --- > > v4->v5: > > * Rebased to latest master > > v3->v4: No change > > * Added Simon's Rb tag. > > v2->v3: > > * Added a test case for of_match_node helper function. > > (Ref: > > https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatc > > hwor > > k.ozlabs.org%2Fproject%2Fuboot%2Fpatch%2F20201102150959.4793-2- > > biju.das.jz%40bp.renesas.com%2Fdata=04%7C01%7Cbiju.das.jz%40bp.re > > nesa > > s.com%7C9a457b5b5cef4377a0a608d8ba1bf25f%7C53d82571da1947e49cb4625a166 > > a4a2 > > a%7C0%7C0%7C63746397665584%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjA > > wMDA > > iLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=0DB8m > > 2aLk > > J0YqTFtjqXBpOmYpQAZO7eh7omBDGzrNR4%3Dreserved=0) > > v1->v2: > > * No Change > > v1: > > * New Patch > > --- > > drivers/core/device.c | 21 + > > include/dm/device.h | 13 + > > test/dm/core.c| 31 +++ > > 3 files changed, 65 insertions(+) > > > > diff --git a/drivers/core/device.c b/drivers/core/device.c index > > aeab3836ed..4ff708fd38 100644 > > --- a/drivers/core/device.c > > +++ b/drivers/core/device.c > > @@ -1022,6 +1022,27 @@ bool of_machine_is_compatible(const char *compat) > > return !fdt_node_check_compatible(fdt, 0, compat); } > > > > +static > > +const struct udevice_id *__of_match_node(const struct udevice_id > > *matches, > > +const ofnode node) > > +{ > > + if (!matches) > > + return NULL; > > + > > + for (; matches->compatible; matches++) { > > + if (ofnode_device_is_compatible(node, matches->compatible)) > > + return matches; > > + } > > + > > + return NULL; > > +} > > + > > +const struct udevice_id *of_match_node(const struct udevice_id > *matches, > > + const ofnode node) > > +{ > > + return __of_match_node(matches, node); } > > + > > int dev_disable_by_path(const char *path) { > > struct uclass *uc; > > diff --git a/include/dm/device.h b/include/dm/device.h index > > f5b4cd6876..950fc78184 100644 > > --- a/include/dm/device.h > > +++ b/include/dm/device.h > > @@ -802,6 +802,19 @@ bool device_is_compatible(const struct udevice > > *dev, const char *compat); > > */ > > bool of_machine_is_compatible(const char *compat); > > > > +/** > > + * of_match_node() - Tell if a device_node has a matching of_match > > +structure > > + * > > + * > > + * Low level utility function used by device matching. > > + * > > + * @matches: array of of device match structures to search in > > + * @node: the of device structure to match against > > + * @return matching structure on success, NULL if the match is not > > +found */ const struct udevice_id *of_match_node(const struct > > +udevice_id *matches, > > + const ofnode node); > > + > > /** > > * dev_disable_by_path() - Disable a device given its device tree path > > * > > diff --git a/test/dm/core.c b/test/dm/core.c index > > 1f5ca570dc..aae4d8427d > > 100644 > > --- a/test/dm/core.c > > +++ b/test/dm/core.c > > @@ -11,6 +11,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -1067,6 +1068,36 @@ static int dm_test_inactive_child(struct > > unit_test_state *uts) } DM_TEST(dm_test_inactive_child, > > UT_TESTF_SCAN_PDATA); > > > > +static int dm_test_of_match_node(struct unit_test_state *uts) { > > + const ulong test_data_expected = 0x1234; > > + ofnode root_node = ofnode_path("/");
[PATCH 2/2] board: Add MT8183 pumpkin board support
Add the MT8183 pumpkin board support. Signed-off-by: Fabien Parent --- arch/arm/dts/Makefile | 1 + arch/arm/dts/mt8183-pumpkin.dts| 99 ++ arch/arm/mach-mediatek/Kconfig | 1 + board/mediatek/mt8183/Kconfig | 13 board/mediatek/mt8183/MAINTAINERS | 6 ++ board/mediatek/mt8183/Makefile | 3 + board/mediatek/mt8183/mt8183_pumpkin.c | 28 configs/mt8183_pumpkin_defconfig | 81 + include/configs/mt8183.h | 41 +++ 9 files changed, 273 insertions(+) create mode 100644 arch/arm/dts/mt8183-pumpkin.dts create mode 100644 board/mediatek/mt8183/Kconfig create mode 100644 board/mediatek/mt8183/MAINTAINERS create mode 100644 board/mediatek/mt8183/Makefile create mode 100644 board/mediatek/mt8183/mt8183_pumpkin.c create mode 100644 configs/mt8183_pumpkin_defconfig create mode 100644 include/configs/mt8183.h diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index af2842a0f8bf..782d99316424 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -1000,6 +1000,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ mt7622-bananapi-bpi-r64.dtb \ mt7623n-bananapi-bpi-r2.dtb \ mt7629-rfb.dtb \ + mt8183-pumpkin.dtb \ mt8512-bm1-emmc.dtb \ mt8516-pumpkin.dtb \ mt8518-ap1-emmc.dtb diff --git a/arch/arm/dts/mt8183-pumpkin.dts b/arch/arm/dts/mt8183-pumpkin.dts new file mode 100644 index ..470a7693997d --- /dev/null +++ b/arch/arm/dts/mt8183-pumpkin.dts @@ -0,0 +1,99 @@ +// SPDX-License-Identifier: GPL-2.0 OR MIT +/* + * Copyright (C) 2021 BayLibre SAS. + * Author: Fabien Parent + */ + +/dts-v1/; + +#include +#include "mt8183.dtsi" + +/ { + model = "MediaTek MT8183 pumpkin board"; + compatible = "mediatek,mt8183-pumpkin", "mediatek,mt8183"; + + memory@4000 { + device_type = "memory"; + reg = <0 0x4000 0 0x8000>; + }; + + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + /* 192 KiB reserved for ARM Trusted Firmware (BL31) */ + bl31_secmon_reserved: secmon@5460 { + no-map; + reg = <0 0x5460 0x0 0x3>; + }; + + /* 12 MiB reserved for OP-TEE (BL32) +* +---+ 0x43e0_ +* | SHMEM 2MiB | +* +---+ 0x43c0_ +* || TA_RAM 8MiB | +* + TZDRAM +--+ 0x4340_ +* || TEE_RAM 2MiB | +* +---+ 0x4320_ +*/ + optee_reserved: optee@4320 { + no-map; + reg = <0 0x4320 0 0x00c0>; + }; + }; + + chosen { + stdout-path = + }; + + reg_1p8v: regulator-1p8v { + compatible = "regulator-fixed"; + regulator-name = "fixed-1.8V"; + regulator-min-microvolt = <180>; + regulator-max-microvolt = <180>; + regulator-boot-on; + regulator-always-on; + }; + + reg_3p3v: regulator-3p3v { + compatible = "regulator-fixed"; + regulator-name = "fixed-3.3V"; + regulator-min-microvolt = <330>; + regulator-max-microvolt = <330>; + regulator-boot-on; + regulator-always-on; + }; +}; + + { + status = "okay"; +}; + + { + status = "okay"; +}; + + { + bus-width = <4>; + max-frequency = <2>; + cap-mmc-highspeed; + mmc-hs200-1_8v; + cap-mmc-hw-reset; + vmmc-supply = <_3p3v>; + vqmmc-supply = <_1p8v>; + non-removable; + status = "okay"; +}; + + { + status = "okay"; +}; + + { + mediatek,force-vbus; + maximum-speed = "high-speed"; + dr_mode = "peripheral"; + status = "okay"; +}; diff --git a/arch/arm/mach-mediatek/Kconfig b/arch/arm/mach-mediatek/Kconfig index a035471374b6..18b7756bdf5b 100644 --- a/arch/arm/mach-mediatek/Kconfig +++ b/arch/arm/mach-mediatek/Kconfig @@ -84,6 +84,7 @@ endchoice source "board/mediatek/mt7622/Kconfig" source "board/mediatek/mt7623/Kconfig" source "board/mediatek/mt7629/Kconfig" +source "board/mediatek/mt8183/Kconfig" source "board/mediatek/mt8512/Kconfig" source "board/mediatek/mt8516/Kconfig" source "board/mediatek/mt8518/Kconfig" diff --git a/board/mediatek/mt8183/Kconfig b/board/mediatek/mt8183/Kconfig new file mode 100644 index ..b75c3b8d8069 --- /dev/null +++ b/board/mediatek/mt8183/Kconfig @@ -0,0 +1,13 @@ +if TARGET_MT8183 + +config SYS_BOARD + default "mt8183" + +config SYS_CONFIG_NAME + default "mt8183"
[PATCH 1/2] ARM: mediatek: Add MT8183 support
Add the MT8183 SoC support. Signed-off-by: Fabien Parent --- arch/arm/dts/mt8183.dtsi | 274 + arch/arm/mach-mediatek/Kconfig | 9 + arch/arm/mach-mediatek/Makefile| 1 + arch/arm/mach-mediatek/mt8183/Makefile | 3 + arch/arm/mach-mediatek/mt8183/init.c | 80 5 files changed, 367 insertions(+) create mode 100644 arch/arm/dts/mt8183.dtsi create mode 100644 arch/arm/mach-mediatek/mt8183/Makefile create mode 100644 arch/arm/mach-mediatek/mt8183/init.c diff --git a/arch/arm/dts/mt8183.dtsi b/arch/arm/dts/mt8183.dtsi new file mode 100644 index ..294aa2b89796 --- /dev/null +++ b/arch/arm/dts/mt8183.dtsi @@ -0,0 +1,274 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2021 MediaTek Inc. + * Copyright (C) 2021 BayLibre, SAS + * Author: Ben Ho + * Erin Lo + * Fabien Parent + */ + +#include +#include +#include +#include +#include + +/ { + compatible = "mediatek,mt8183"; + interrupt-parent = <>; + #address-cells = <2>; + #size-cells = <2>; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu-map { + cluster0 { + core0 { + cpu = <>; + }; + core1 { + cpu = <>; + }; + core2 { + cpu = <>; + }; + core3 { + cpu = <>; + }; + }; + + cluster1 { + core0 { + cpu = <>; + }; + core1 { + cpu = <>; + }; + core2 { + cpu = <>; + }; + core3 { + cpu = <>; + }; + }; + }; + + cpu0: cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-a53"; + reg = <0x000>; + enable-method = "psci"; + capacity-dmips-mhz = <741>; + }; + + cpu1: cpu@1 { + device_type = "cpu"; + compatible = "arm,cortex-a53"; + reg = <0x001>; + enable-method = "psci"; + capacity-dmips-mhz = <741>; + }; + + cpu2: cpu@2 { + device_type = "cpu"; + compatible = "arm,cortex-a53"; + reg = <0x002>; + enable-method = "psci"; + capacity-dmips-mhz = <741>; + }; + + cpu3: cpu@3 { + device_type = "cpu"; + compatible = "arm,cortex-a53"; + reg = <0x003>; + enable-method = "psci"; + capacity-dmips-mhz = <741>; + }; + + cpu4: cpu@100 { + device_type = "cpu"; + compatible = "arm,cortex-a73"; + reg = <0x100>; + enable-method = "psci"; + capacity-dmips-mhz = <1024>; + }; + + cpu5: cpu@101 { + device_type = "cpu"; + compatible = "arm,cortex-a73"; + reg = <0x101>; + enable-method = "psci"; + capacity-dmips-mhz = <1024>; + }; + + cpu6: cpu@102 { + device_type = "cpu"; + compatible = "arm,cortex-a73"; + reg = <0x102>; + enable-method = "psci"; + capacity-dmips-mhz = <1024>; + }; + + cpu7: cpu@103 { + device_type = "cpu"; + compatible = "arm,cortex-a73"; + reg = <0x103>; + enable-method = "psci"; + capacity-dmips-mhz = <1024>; + }; + }; + + clk26m: oscillator { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <2600>; + clock-output-names = "clk26m"; + }; + + soc { + #address-cells = <2>; +
[PATCH 3/3] configs: mt8516: use bootcmd from config_distro_bootcmd.h
Instead of redefining our own way to boot, let's just use config_distro_bootcmd.h. Signed-off-by: Fabien Parent --- include/configs/mt8516.h | 20 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/include/configs/mt8516.h b/include/configs/mt8516.h index e809a9c7e304..a1c5d8174be7 100644 --- a/include/configs/mt8516.h +++ b/include/configs/mt8516.h @@ -31,23 +31,11 @@ /* Environment settings */ #include -#define MMCBOOT \ - "mmcdev=0\0" \ - "kernel_partition=2\0" \ - "rootfs_partition=3\0" \ - "mmc_discover_partition=" \ - "part start mmc ${mmcdev} ${kernel_partition} kernel_part_addr;" \ - "part size mmc ${mmcdev} ${kernel_partition} kernel_part_size;\0" \ - "mmcboot=" \ - "mmc dev ${mmcdev};" \ - "run mmc_discover_partition;" \ - "mmc read ${kerneladdr} ${kernel_part_addr} ${kernel_part_size};" \ - "setenv bootargs ${bootargs} root=/dev/mmcblk${mmcdev}p${rootfs_partition} rootwait; " \ - "bootm ${kerneladdr}; \0" +#define BOOT_TARGET_DEVICES(func) \ + func(MMC, mmc, 0) #define CONFIG_EXTRA_ENV_SETTINGS \ - "kerneladdr=0x4A00\0" \ - MMCBOOT \ - "bootcmd=run mmcboot;\0" + "scriptaddr=0x4000\0" \ + BOOTENV #endif -- 2.30.0
[PATCH 2/3] board: mediatek: mt8516: init USB Ether for pumpkin board
Init USB Ether if CONFIG_USB_ETHER is enabled. Signed-off-by: Fabien Parent --- board/mediatek/mt8516/mt8516_pumpkin.c | 4 1 file changed, 4 insertions(+) diff --git a/board/mediatek/mt8516/mt8516_pumpkin.c b/board/mediatek/mt8516/mt8516_pumpkin.c index 37daf1c51b92..42f3863b92c3 100644 --- a/board/mediatek/mt8516/mt8516_pumpkin.c +++ b/board/mediatek/mt8516/mt8516_pumpkin.c @@ -5,6 +5,7 @@ #include #include +#include int board_init(void) { @@ -24,5 +25,8 @@ int board_late_init(void) } } + if (CONFIG_IS_ENABLED(USB_ETHER)) + usb_ether_init(); + return 0; } -- 2.30.0
[PATCH 1/3] board: mediatek: rename pumpkin board into mt8516
More than one pumpkin board has been made with different MediaTek SoCs. Rename the pumpkin board to follow the naming convention of all other MediaTek boards and also to not be confusing when other pumpkin boards will be added in follow-up commits. Signed-off-by: Fabien Parent --- arch/arm/mach-mediatek/Kconfig | 2 +- board/mediatek/{pumpkin => mt8516}/Kconfig | 4 ++-- board/mediatek/mt8516/MAINTAINERS | 6 ++ board/mediatek/{pumpkin => mt8516}/Makefile | 2 +- .../mediatek/{pumpkin/pumpkin.c => mt8516/mt8516_pumpkin.c} | 0 board/mediatek/pumpkin/MAINTAINERS | 6 -- configs/{pumpkin_defconfig => mt8516_pumpkin_defconfig} | 0 include/configs/{pumpkin.h => mt8516.h} | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) rename board/mediatek/{pumpkin => mt8516}/Kconfig (76%) create mode 100644 board/mediatek/mt8516/MAINTAINERS rename board/mediatek/{pumpkin => mt8516}/Makefile (58%) rename board/mediatek/{pumpkin/pumpkin.c => mt8516/mt8516_pumpkin.c} (100%) delete mode 100644 board/mediatek/pumpkin/MAINTAINERS rename configs/{pumpkin_defconfig => mt8516_pumpkin_defconfig} (100%) rename include/configs/{pumpkin.h => mt8516.h} (97%) diff --git a/arch/arm/mach-mediatek/Kconfig b/arch/arm/mach-mediatek/Kconfig index 7f40ba93190b..2791b3dbda2b 100644 --- a/arch/arm/mach-mediatek/Kconfig +++ b/arch/arm/mach-mediatek/Kconfig @@ -76,7 +76,7 @@ source "board/mediatek/mt7622/Kconfig" source "board/mediatek/mt7623/Kconfig" source "board/mediatek/mt7629/Kconfig" source "board/mediatek/mt8512/Kconfig" +source "board/mediatek/mt8516/Kconfig" source "board/mediatek/mt8518/Kconfig" -source "board/mediatek/pumpkin/Kconfig" endif diff --git a/board/mediatek/pumpkin/Kconfig b/board/mediatek/mt8516/Kconfig similarity index 76% rename from board/mediatek/pumpkin/Kconfig rename to board/mediatek/mt8516/Kconfig index 34b1c0b09d47..a87d3872fe6e 100644 --- a/board/mediatek/pumpkin/Kconfig +++ b/board/mediatek/mt8516/Kconfig @@ -1,10 +1,10 @@ if TARGET_MT8516 config SYS_BOARD - default "pumpkin" + default "mt8516" config SYS_CONFIG_NAME - default "pumpkin" + default "mt8516" config MTK_BROM_HEADER_INFO string diff --git a/board/mediatek/mt8516/MAINTAINERS b/board/mediatek/mt8516/MAINTAINERS new file mode 100644 index ..2f0d8f646498 --- /dev/null +++ b/board/mediatek/mt8516/MAINTAINERS @@ -0,0 +1,6 @@ +MT8516 Pumpkin +M: Fabien Parent +S: Maintained +F: board/mediatek/mt8516 +F: include/configs/mt8516.h +F: configs/mt8516_pumpkin_defconfig diff --git a/board/mediatek/pumpkin/Makefile b/board/mediatek/mt8516/Makefile similarity index 58% rename from board/mediatek/pumpkin/Makefile rename to board/mediatek/mt8516/Makefile index 75fce4a393ab..1d4815d1370f 100644 --- a/board/mediatek/pumpkin/Makefile +++ b/board/mediatek/mt8516/Makefile @@ -1,3 +1,3 @@ # SPDX-License-Identifier: GPL-2.0 -obj-y += pumpkin.o +obj-y += mt8516_pumpkin.o diff --git a/board/mediatek/pumpkin/pumpkin.c b/board/mediatek/mt8516/mt8516_pumpkin.c similarity index 100% rename from board/mediatek/pumpkin/pumpkin.c rename to board/mediatek/mt8516/mt8516_pumpkin.c diff --git a/board/mediatek/pumpkin/MAINTAINERS b/board/mediatek/pumpkin/MAINTAINERS deleted file mode 100644 index 16beadc027a1.. --- a/board/mediatek/pumpkin/MAINTAINERS +++ /dev/null @@ -1,6 +0,0 @@ -Pumpkin -M: Fabien Parent -S: Maintained -F: board/mediatek/pumpkin -F: include/configs/pumpkin.h -F: configs/pumpkin_defconfig diff --git a/configs/pumpkin_defconfig b/configs/mt8516_pumpkin_defconfig similarity index 100% rename from configs/pumpkin_defconfig rename to configs/mt8516_pumpkin_defconfig diff --git a/include/configs/pumpkin.h b/include/configs/mt8516.h similarity index 97% rename from include/configs/pumpkin.h rename to include/configs/mt8516.h index 9c52cae41d71..e809a9c7e304 100644 --- a/include/configs/pumpkin.h +++ b/include/configs/mt8516.h @@ -6,8 +6,8 @@ * Author: Fabien Parent -- 2.30.0
[PATCH] virtio: fix off by one device id comparison
VIRTIO_ID_MAX_NUM is the largest device ID plus 1. Therefore a device id cannot be greater or equal to VIRTIO_ID_MAX_NUM. Fix the comparison accordingly. Fixes: 8fb49b4c7a82 ("dm: Add a new uclass driver for VirtIO transport devices") Signed-off-by: Vincent Stehlé Cc: Simon Glass Cc: Bin Meng --- drivers/virtio/virtio-uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/virtio/virtio-uclass.c b/drivers/virtio/virtio-uclass.c index cf2cfaef2cf..0379536c542 100644 --- a/drivers/virtio/virtio-uclass.c +++ b/drivers/virtio/virtio-uclass.c @@ -227,7 +227,7 @@ static int virtio_uclass_post_probe(struct udevice *udev) struct udevice *vdev; int ret; - if (uc_priv->device > VIRTIO_ID_MAX_NUM) { + if (uc_priv->device >= VIRTIO_ID_MAX_NUM) { debug("(%s): virtio device ID %d exceeds maximum num\n", udev->name, uc_priv->device); return 0; -- 2.29.2
[PATCH] Azure: Rework SH / Renesas job
Now that there is a single SuperH platform, rework the Azure job slightly. Azure build time limits mean that we need to split the world build up still. Make a single build job for the single Renesas SuperH platform as well as all of the ARM platforms from Renesas. Cc: Marek Vasut Signed-off-by: Tom Rini --- .azure-pipelines.yml | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index a6279427e138..42a89324aaf1 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -398,7 +398,7 @@ jobs: sun50i: BUILDMAN: "sun50i" arm_catch_all: - BUILDMAN: "arm -x arm11,arm7,arm9,aarch64,at91,bcm,freescale,kirkwood,mvebu,siemens,tegra,uniphier,mx,samsung,sunxi,am33xx,omap,rk,toradex,socfpga,k2,k3,zynq" + BUILDMAN: "arm -x arm11,arm7,arm9,aarch64,at91,bcm,freescale,kirkwood,mvebu,renesas,siemens,tegra,uniphier,mx,samsung,sunxi,am33xx,omap,rk,toradex,socfpga,k2,k3,zynq" sandbox_x86: BUILDMAN: "sandbox x86" technexion: @@ -436,11 +436,11 @@ jobs: uniphier: BUILDMAN: "uniphier" aarch64_catch_all: - BUILDMAN: "aarch64 -x bcm,k3,tegra,ls1,ls2,lx216,mvebu,uniphier,sunxi,samsung,socfpga,rk,versal,zynq" + BUILDMAN: "aarch64 -x bcm,k3,tegra,ls1,ls2,lx216,mvebu,uniphier,renesas,sunxi,samsung,socfpga,rk,versal,zynq" rockchip: BUILDMAN: "rk" -sh: - BUILDMAN: "sh -x arm" +renesas: + BUILDMAN: "renesas" zynq: BUILDMAN: "zynq" zynqmp_versal: -- 2.17.1
Re: [PATCHv2] common: Drop asm/global_data.h from common header
On Wed, Feb 03, 2021 at 09:19:51AM -0500, Tom Rini wrote: > From: Simon Glass > > Move this out of the common header and include it only where needed. In > a number of cases this requires adding "struct udevice;" to avoid adding > another large header or in other cases replacing / adding missing header > files that had been pulled in, very indirectly. Finally, we have a few > cases where we did not need to include at all, so > remove that include. > > Signed-off-by: Simon Glass > Signed-off-by: Tom Rini Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 6/6] sh: Remove sh7763rdp board
On Wed, Feb 10, 2021 at 12:51:26PM -0500, Tom Rini wrote: > This board has not been converted to CONFIG_DM by the deadline of v2020.01 > and is missing other conversions which depend on this as well. Remove it. > > Cc: Nobuhiro Iwamatsu > Signed-off-by: Tom Rini Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 5/6] sh: Remove sh7757lcr board
On Wed, Feb 10, 2021 at 12:51:25PM -0500, Tom Rini wrote: > This board has not been converted to CONFIG_DM by the deadline of v2020.01 > and is missing other conversions which depend on this as well. Remove it. > > As this is the last SH4A board, remove that support as well. > > Cc: Marek Vasut > Signed-off-by: Tom Rini Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 4/6] sh: Remove sh7753evb board
On Wed, Feb 10, 2021 at 12:51:24PM -0500, Tom Rini wrote: > This board has not been converted to CONFIG_DM by the deadline of v2020.01 > and is missing other conversions which depend on this as well. Remove it. > > Signed-off-by: Tom Rini Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 3/6] sh: Remove sh7752evb board
On Wed, Feb 10, 2021 at 12:51:23PM -0500, Tom Rini wrote: > This board has not been converted to CONFIG_DM by the deadline of v2020.01 > and is missing other conversions which depend on this as well. Remove it. > > Signed-off-by: Tom Rini Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 2/6] sh: Remove r7780mp board
On Wed, Feb 10, 2021 at 12:51:22PM -0500, Tom Rini wrote: > This board has not been converted to CONFIG_DM by the deadline of v2020.01 > and is missing other conversions which depend on this as well. Remove it. > > Patch-cc: Nobuhiro Iwamatsu > Patch-cc: Nobuhiro Iwamatsu > Signed-off-by: Tom Rini Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 1/6] sh: Remove MigoR board
On Wed, Feb 10, 2021 at 12:51:21PM -0500, Tom Rini wrote: > This board has not been converted to CONFIG_DM by the deadline of v2020.01 > and is missing other conversions which depend on this as well. Remove it. > > Signed-off-by: Tom Rini Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 13/16] ppc: Remove MPC8641HPCN board
On Tue, Feb 09, 2021 at 09:42:54PM -0500, Tom Rini wrote: > This board relies on using CONFIG_LIBATA but does not enable CONFIG_AHCI. The > deadline for this conversion was the v2019.07 release. The use of CONFIG_AHCI > requires CONFIG_DM. The deadline for this conversion was v2020.01. Remove > this board. > > Cc: Priyanka Jain > Signed-off-by: Tom Rini > Reviewed-by: Priyanka Jain Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 12/16] ppc: Remove MPC8610HPCD board
On Tue, Feb 09, 2021 at 09:42:53PM -0500, Tom Rini wrote: > This board relies on using CONFIG_LIBATA but does not enable CONFIG_AHCI. The > deadline for this conversion was the v2019.07 release. The use of CONFIG_AHCI > requires CONFIG_DM. The deadline for this conversion was v2020.01. Remove > this board. > > Cc: Priyanka Jain > Signed-off-by: Tom Rini > Reviewed-by: Priyanka Jain Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 11/16] ppc: Remove MPC8572DS board
On Tue, Feb 09, 2021 at 09:42:52PM -0500, Tom Rini wrote: > This board relies on using CONFIG_LIBATA but does not enable CONFIG_AHCI. The > deadline for this conversion was the v2019.07 release. The use of CONFIG_AHCI > requires CONFIG_DM. The deadline for this conversion was v2020.01. Remove > this board. > > Cc: Priyanka Jain > Signed-off-by: Tom Rini > Reviewed-by: Priyanka Jain Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 10/16] ppc: Remove MPC8544DS board
On Tue, Feb 09, 2021 at 09:42:51PM -0500, Tom Rini wrote: > This board relies on using CONFIG_LIBATA but does not enable CONFIG_AHCI. The > deadline for this conversion was the v2019.07 release. The use of CONFIG_AHCI > requires CONFIG_DM. The deadline for this conversion was v2020.01. Remove > this board. > > Cc: Priyanka Jain > Signed-off-by: Tom Rini > Reviewed-by: Priyanka Jain Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 24/25] arm: Remove db-88f6281-bp board
On Tue, Feb 09, 2021 at 08:03:16AM -0500, Tom Rini wrote: > This board has not been converted to CONFIG_DM_MMC by the deadline of > v2019.04, which is almost two years ago. In addition there are other DM > migrations it is also missing. Remove it. > > Cc: Chris Packham > Signed-off-by: Tom Rini > Acked-by: Chris Packham Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 18/25] arm: Remove ls2080a_simu board
On Tue, Feb 09, 2021 at 08:03:10AM -0500, Tom Rini wrote: > This board has not been converted to CONFIG_DM_MMC by the deadline of > v2019.04, which is almost two years ago. In addition there are other DM > migrations it is also missing. Remove it. > > Cc: Prabhakar Kushwaha > Cc: Priyanka Jain > Signed-off-by: Tom Rini > Reviewed-by: Priyanka Jain Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 10/25] arm: Remove mx35pdk board
On Tue, Feb 09, 2021 at 08:03:02AM -0500, Tom Rini wrote: > This board has not been converted to CONFIG_DM_MMC by the deadline of > v2019.04, which is almost two years ago. In addition there are other DM > migrations it is also missing. Remove it. > > Cc: Stefano Babic > Signed-off-by: Tom Rini > Acked-by: Stefano Babic Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH 07/25] arm: Remove apx4devkit board
On Tue, Feb 09, 2021 at 08:02:59AM -0500, Tom Rini wrote: > This board has not been converted to CONFIG_DM_MMC by the deadline of > v2019.04, which is almost two years ago. In addition there are other DM > migrations it is also missing. Remove it. > > Cc: Lauri Hintsala > Signed-off-by: Tom Rini > Acked-by: Lauri Hintsala > mailto:lauri.hints...@silabs.com>> > Signed-off-by: Tom Rini mailto:tr...@konsulko.com>> Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH] Revert "fdtdec: Use CONFIG_IS_ENABLED in board_fdt_blob_setup()"
On Sun, Feb 14, 2021 at 02:11:32PM -0500, Tom Rini wrote: > On Rockchip platforms we need this area of code in TPL, but there is no > TPL_SEPARATE_BSS symbol. > > This reverts commit 0a2aaab0b678fd1778ff2fc59d0770fc82995532. > > Reported-by: Markus Reichl > Reported-by: Jesper Schmitz Mouridsen > Reported-by: Peter Robinson > Tested-by: Peter Robinson > Signed-off-by: Tom Rini Applied to u-boot/master, thanks! -- Tom signature.asc Description: PGP signature
Re: old version of u-boot cannot read larger USB sticks
On Mon, Feb 15, 2021 at 09:07:33AM -0500, Floyd Brown wrote: > I am stuck with a 2014.04-r0 u-boot source, and have an issue where USB > flash sticks 4 GB and greater cannot be read by u-boot - the device is not > detected when "usb reset" is run. > > USB hub found > 0 Storage Device(s) found > > This platform is based on an am335x SOM, and the manufacturer has not > updated any drivers for a long while... > > > > The device can be read by the Linux running on the platform without issue > "ID 058f:6387 Alcor Micro Corp. Flash Drive" > > > Can anyone suggest if there is a way (without upgrading) to resolve this, > or just mark it as obsolete (and that is the way it stays) The am335x chip is well supported in mainline U-Boot, you should have some luck just upgrading. -- Tom signature.asc Description: PGP signature
Re: [BUG] [BISECT] rockchip: roc-pc-rk3399: TPL misses dtb
On Mon, Feb 15, 2021 at 03:05:20PM +0100, Markus Reichl wrote: > With recent U-Boot and roc-pc-mezzanine-rk3399_defconfig > and booting from SPI flash I get: > > U-Boot TPL 2021.01-00884-g0a2aaab0b6 (Feb 15 2021 - 14:36:50) > Missing DTB > ### ERROR ### Please RESET the board ### > > Bisecting points to: > > commit 0a2aaab0b678fd1778ff2fc59d0770fc82995532 > Author: Simon Glass > Date: Wed Jan 13 20:29:49 2021 -0700 > > fdtdec: Use CONFIG_IS_ENABLED in board_fdt_blob_setup() > This setting may be different in SPL and TPL. Update the code to check > the correct setting. > Signed-off-by: Simon Glass > > lib/fdtdec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > Reverting this commit fixes booting. Thanks for the report. I'm about to push a revert for this and I'll add a Reported-by from you. -- Tom signature.asc Description: PGP signature
old version of u-boot cannot read larger USB sticks
I am stuck with a 2014.04-r0 u-boot source, and have an issue where USB flash sticks 4 GB and greater cannot be read by u-boot - the device is not detected when "usb reset" is run. USB hub found 0 Storage Device(s) found This platform is based on an am335x SOM, and the manufacturer has not updated any drivers for a long while... The device can be read by the Linux running on the platform without issue "ID 058f:6387 Alcor Micro Corp. Flash Drive" Can anyone suggest if there is a way (without upgrading) to resolve this, or just mark it as obsolete (and that is the way it stays) Thanks Floyd Brown
[BUG] [BISECT] rockchip: roc-pc-rk3399: TPL misses dtb
With recent U-Boot and roc-pc-mezzanine-rk3399_defconfig and booting from SPI flash I get: U-Boot TPL 2021.01-00884-g0a2aaab0b6 (Feb 15 2021 - 14:36:50) Missing DTB ### ERROR ### Please RESET the board ### Bisecting points to: commit 0a2aaab0b678fd1778ff2fc59d0770fc82995532 Author: Simon Glass Date: Wed Jan 13 20:29:49 2021 -0700 fdtdec: Use CONFIG_IS_ENABLED in board_fdt_blob_setup() This setting may be different in SPL and TPL. Update the code to check the correct setting. Signed-off-by: Simon Glass lib/fdtdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Reverting this commit fixes booting.
Re: [PATCHv5 2/6] cmd: SCP03: enable and provision command
On Sun, Feb 14, 2021 at 5:27 PM Jorge Ramirez-Ortiz wrote: > > Enable and provision the SCP03 keys on a TEE controlled secured elemt > from the U-Boot shell. > > Executing this command will generate and program new SCP03 encryption > keys on the secure element NVM. > > Depending on the TEE implementation, the keys would then be stored in > some persistent storage or better derived from some platform secret > (so they can't be lost). > > Signed-off-by: Jorge Ramirez-Ortiz > Reviewed-by: Simon Glass > --- > cmd/Kconfig | 8 > cmd/Makefile | 3 +++ > cmd/scp03.c | 52 > 3 files changed, 63 insertions(+) > create mode 100644 cmd/scp03.c > > diff --git a/cmd/Kconfig b/cmd/Kconfig > index 928a2a0a2d..6327374f2c 100644 > --- a/cmd/Kconfig > +++ b/cmd/Kconfig > @@ -2021,6 +2021,14 @@ config HASH_VERIFY > help > Add -v option to verify data against a hash. > > +config CMD_SCP03 > + bool "scp03 - SCP03 enable and rotate/provision operations" > + depends on SCP03 > + help > + This command provides access to a Trusted Application > + running in a TEE to request Secure Channel Protocol 03 > + (SCP03) enablement and/or rotation of its SCP03 keys. > + > config CMD_TPM_V1 > bool > > diff --git a/cmd/Makefile b/cmd/Makefile > index 176bf925fd..a7017e8452 100644 > --- a/cmd/Makefile > +++ b/cmd/Makefile > @@ -193,6 +193,9 @@ obj-$(CONFIG_CMD_BLOB) += blob.o > # Android Verified Boot 2.0 > obj-$(CONFIG_CMD_AVB) += avb.o > > +# Foundries.IO SCP03 > +obj-$(CONFIG_CMD_SCP03) += scp03.o > + > obj-$(CONFIG_ARM) += arm/ > obj-$(CONFIG_RISCV) += riscv/ > obj-$(CONFIG_SANDBOX) += sandbox/ > diff --git a/cmd/scp03.c b/cmd/scp03.c > new file mode 100644 > index 00..655e0bba08 > --- /dev/null > +++ b/cmd/scp03.c > @@ -0,0 +1,52 @@ > +// SPDX-License-Identifier: GPL-2.0+ > +/* > + * (C) Copyright 2021, Foundries.IO > + * > + */ > + > +#include > +#include > +#include > +#include > + > +int do_scp03_enable(struct cmd_tbl *cmdtp, int flag, int argc, > + char *const argv[]) > +{ > + if (argc != 1) > + return CMD_RET_USAGE; > + > + if (tee_enable_scp03()) { > + printf("TEE failed to enable SCP03\n"); > + return CMD_RET_FAILURE; > + } > + > + printf("SCP03 is enabled\n"); > + > + return CMD_RET_SUCCESS; > +} > + > +int do_scp03_provision(struct cmd_tbl *cmdtp, int flag, int argc, > + char *const argv[]) > +{ > + if (argc != 1) > + return CMD_RET_USAGE; > + > + if (tee_provision_scp03()) { > + printf("TEE failed to provision SCP03 keys\n"); > + return CMD_RET_FAILURE; > + } > + > + printf("SCP03 is provisioned\n"); > + > + return CMD_RET_SUCCESS; > +} > + > +static char text[] = > + "provides a command to enable SCP03 and provision the SCP03 keys\n" > + " enable- enable SCP03 on the TEE\n" > + " provision - provision SCP03 on the TEE\n"; > + > +U_BOOT_CMD_WITH_SUBCMDS(scp03, "Secure Channel Protocol 03 control", text, > + U_BOOT_SUBCMD_MKENT(enable, 1, 1, do_scp03_enable), > + U_BOOT_SUBCMD_MKENT(provision, 1, 1, do_scp03_provision)); > + > -- > 2.30.0 > Reviewed-by: Igor Opaniuk -- Best regards - Freundliche Grüsse - Meilleures salutations Igor Opaniuk Embedded Software Engineer T: +380 938364067 E: igor.opan...@foundries.io W: www.foundries.io
Re: [PATCHv5 2/6] cmd: SCP03: enable and provision command
Hi Jorge, On Sun, Feb 14, 2021 at 5:18 PM Jorge Ramirez-Ortiz wrote: > > Enable and provision the SCP03 keys on a TEE controlled secured elemt > from the U-Boot shell. > > Executing this command will generate and program new SCP03 encryption > keys on the secure element NVM. > > Depending on the TEE implementation, the keys would then be stored in > some persistent storage or better derived from some platform secret > (so they can't be lost). > > Signed-off-by: Jorge Ramirez-Ortiz > Reviewed-by: Simon Glass > --- > cmd/Kconfig | 8 > cmd/Makefile | 3 +++ > cmd/scp03.c | 52 > 3 files changed, 63 insertions(+) > create mode 100644 cmd/scp03.c > > diff --git a/cmd/Kconfig b/cmd/Kconfig > index 928a2a0a2d..6327374f2c 100644 > --- a/cmd/Kconfig > +++ b/cmd/Kconfig > @@ -2021,6 +2021,14 @@ config HASH_VERIFY > help > Add -v option to verify data against a hash. > > +config CMD_SCP03 > + bool "scp03 - SCP03 enable and rotate/provision operations" > + depends on SCP03 > + help > + This command provides access to a Trusted Application > + running in a TEE to request Secure Channel Protocol 03 > + (SCP03) enablement and/or rotation of its SCP03 keys. > + > config CMD_TPM_V1 > bool > > diff --git a/cmd/Makefile b/cmd/Makefile > index 176bf925fd..a7017e8452 100644 > --- a/cmd/Makefile > +++ b/cmd/Makefile > @@ -193,6 +193,9 @@ obj-$(CONFIG_CMD_BLOB) += blob.o > # Android Verified Boot 2.0 > obj-$(CONFIG_CMD_AVB) += avb.o > > +# Foundries.IO SCP03 > +obj-$(CONFIG_CMD_SCP03) += scp03.o > + > obj-$(CONFIG_ARM) += arm/ > obj-$(CONFIG_RISCV) += riscv/ > obj-$(CONFIG_SANDBOX) += sandbox/ > diff --git a/cmd/scp03.c b/cmd/scp03.c > new file mode 100644 > index 00..655e0bba08 > --- /dev/null > +++ b/cmd/scp03.c > @@ -0,0 +1,52 @@ > +// SPDX-License-Identifier: GPL-2.0+ > +/* > + * (C) Copyright 2021, Foundries.IO > + * > + */ > + > +#include > +#include > +#include > +#include > + > +int do_scp03_enable(struct cmd_tbl *cmdtp, int flag, int argc, > + char *const argv[]) > +{ > + if (argc != 1) > + return CMD_RET_USAGE; > + > + if (tee_enable_scp03()) { > + printf("TEE failed to enable SCP03\n"); > + return CMD_RET_FAILURE; > + } > + > + printf("SCP03 is enabled\n"); > + > + return CMD_RET_SUCCESS; > +} > + > +int do_scp03_provision(struct cmd_tbl *cmdtp, int flag, int argc, > + char *const argv[]) > +{ > + if (argc != 1) > + return CMD_RET_USAGE; > + > + if (tee_provision_scp03()) { > + printf("TEE failed to provision SCP03 keys\n"); > + return CMD_RET_FAILURE; > + } > + > + printf("SCP03 is provisioned\n"); > + > + return CMD_RET_SUCCESS; > +} > + > +static char text[] = > + "provides a command to enable SCP03 and provision the SCP03 keys\n" > + " enable- enable SCP03 on the TEE\n" > + " provision - provision SCP03 on the TEE\n"; > + > +U_BOOT_CMD_WITH_SUBCMDS(scp03, "Secure Channel Protocol 03 control", text, > + U_BOOT_SUBCMD_MKENT(enable, 1, 1, do_scp03_enable), > + U_BOOT_SUBCMD_MKENT(provision, 1, 1, do_scp03_provision)); > + > -- > 2.30.0 > Reviewed-by: Igor Opaniuk -- Best regards - Freundliche Grüsse - Meilleures salutations Igor Opaniuk Embedded Software Engineer T: +380 938364067 E: igor.opan...@foundries.io W: www.foundries.io
Re: [PATCH 2/4] mx53loco: Convert to driver model
On Sun, Feb 14, 2021 at 03:58:56PM -0300, Fabio Estevam wrote: > On Sun, Feb 14, 2021 at 11:26 AM Tom Rini wrote: > > > Where is something missing for SATA support? With DM enabled, you can > > enable AHCI and BLK and DWC_AHSATA is already converted. Is there > > some i.MX specific work required still? Thanks! > > I have added CONFIG_AHCI=y and added: > > --- a/drivers/ata/dwc_ahsata.c > +++ b/drivers/ata/dwc_ahsata.c > @@ -1093,6 +1093,7 @@ struct ahci_ops dwc_ahsata_ahci_ops = { > > static const struct udevice_id dwc_ahsata_ahci_ids[] = { > { .compatible = "fsl,imx6q-ahci" }, > + { .compatible = "fsl,imx53-ahci" }, > { } > }; > > but after running the "sata" command I do get a data abort and the board > resets. > > I haven't gotten a chance to debug it further, but I was hoping to > proceed with the DM conversion without sata support for now and then > work on adding sata support for this board. Thanks for explaining. -- Tom signature.asc Description: PGP signature
Re: [PATCH 4/4] mx51evk: Add myself as maintainer
On Mon, Feb 15, 2021 at 08:58:18AM -0300, Fabio Estevam wrote: > I would like to help supporting this board, so add myself > as a maintainer. > > Signed-off-by: Fabio Estevam > --- > board/freescale/mx51evk/MAINTAINERS | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/board/freescale/mx51evk/MAINTAINERS > b/board/freescale/mx51evk/MAINTAINERS > index 0e5f22c26b4b..1ca55f7d14ec 100644 > --- a/board/freescale/mx51evk/MAINTAINERS > +++ b/board/freescale/mx51evk/MAINTAINERS > @@ -1,4 +1,5 @@ > MX51EVK BOARD > +M: Fabio Estevam > M: Stefano Babic > S: Maintained > F: board/freescale/mx51evk/ Please add either here or the patch that adds the new dts files, those files to the MAINTAINERS entry as well. Thanks! -- Tom signature.asc Description: PGP signature
Re: [PATCH] cmd: mmc: add mmc partboot
Hello Jaehoon, On Sun, 14 Feb 2021 at 23:08 Jaehoon Chung wrote: > Dear Grygorii, > > On 2/12/21 7:32 PM, grygorii tertychnyi wrote: > > This patch allows to determine active boot partition in boot script: > > > > if mmc partboot ${mmcdev} 2; then > > echo "booted from eMMC boot1 partition" > > fi > > I don't know what purpose this patch has. With an eMMC as a boot source I have two boot partitions, i.e. “boot1” and “boot2”, with two different versions of U-Boot on each partition. I also have two different kernels located on eMMC “user” partition, let’s say “image1” and “image2”. So, I want to boot “image1” kernel if it is U-boot from “boot1” partition is booted now, and to boot “image2” kernel if it is U-boot from “boot2” partition is booted. It is easy to do it manually. I just added possibility to do it with U-boot script now, because “mmc partconf ...” does not let you check the current boot partition with hush. Hope, I explained the purpose. > > Best Regards, > Jaehoon Chung > > > > > Signed-off-by: Grygorii Tertychnyi < > grygorii.tertych...@leica-geosystems.com> > > --- > > cmd/mmc.c | 39 +++ > > 1 file changed, 39 insertions(+) > > > > diff --git a/cmd/mmc.c b/cmd/mmc.c > > index 1529a3e05ddd..010d6ab9aa19 100644 > > --- a/cmd/mmc.c > > +++ b/cmd/mmc.c > > @@ -771,6 +771,41 @@ static int do_mmc_boot_resize(struct cmd_tbl > *cmdtp, int flag, > > return CMD_RET_SUCCESS; > > } > > > > +static int do_mmc_partboot(struct cmd_tbl *cmdtp, int flag, > > +int argc, char *const argv[]) > > +{ > > + int dev; > > + struct mmc *mmc; > > + u8 part_args, part_emmc; > > + > > + if (argc != 3) > > + return CMD_RET_USAGE; > > + > > + dev = simple_strtoul(argv[1], NULL, 10); > > + > > + mmc = init_mmc_device(dev, false); > > + if (!mmc) > > + return CMD_RET_FAILURE; > > + > > + if (IS_SD(mmc)) { > > + puts("PARTITION_CONFIG only exists on eMMC\n"); > > + return CMD_RET_FAILURE; > > + } > > + > > + if (mmc->part_config == MMCPART_NOAVAILABLE) { > > + printf("No part_config info for ver. 0x%x\n", > mmc->version); > > + return CMD_RET_FAILURE; > > + } > > + > > + part_emmc = EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config); > > + part_args = simple_strtoul(argv[2], NULL, 10); > > + > > + if (part_emmc == part_args) > > + return CMD_RET_SUCCESS; > > + else > > + return CMD_RET_FAILURE; > > +} > > + > > static int mmc_partconf_print(struct mmc *mmc) > > { > > u8 ack, access, part; > > @@ -953,6 +988,7 @@ static struct cmd_tbl cmd_mmc[] = { > > #ifdef CONFIG_SUPPORT_EMMC_BOOT > > U_BOOT_CMD_MKENT(bootbus, 5, 0, do_mmc_bootbus, "", ""), > > U_BOOT_CMD_MKENT(bootpart-resize, 4, 0, do_mmc_boot_resize, "", > ""), > > + U_BOOT_CMD_MKENT(partboot, 3, 0, do_mmc_partboot, "", ""), > > U_BOOT_CMD_MKENT(partconf, 5, 0, do_mmc_partconf, "", ""), > > U_BOOT_CMD_MKENT(rst-function, 3, 0, do_mmc_rst_func, "", ""), > > #endif > > @@ -1021,6 +1057,9 @@ U_BOOT_CMD( > > " - Set the BOOT_BUS_WIDTH field of the specified device\n" > > "mmc bootpart-resizeMB>\n" > > " - Change sizes of boot and RPMB partitions of specified device\n" > > + "mmc partboot dev boot_partition\n" > > + " - Return success if the given boot_partition value matches > BOOT_PARTITION_ENABLE\n" > > + " bit field of the specified device\n" > > "mmc partconf dev [boot_ack boot_partition partition_access]\n" > > " - Show or change the bits of the PARTITION_CONFIG field of the > specified device\n" > > "mmc rst-function dev value\n" > > > >
STM32MP157 boot from Recovery USB
Hello list! Thank you for let me adding to this Mailing List! I am designing a custom board with a STM32MP157 (as the Evaluation Board), but without any USB nor microSD connectors. My concerns are about to load FSBL and SSBL from USB (with a sort of extension cable from PCB to PC into a USB Host A Port) with Linux. (A) My goal is to write u-Boot into the internal eMMC Flash Storage (via USB Recovery mode) and let u-boot continue the loading of the kernel (TFTPBoot) and the rootfilesystem via ethernet (NFS). Is it a viable solution to you guys? (B) I would like to avoid using an extension cable for microSD/SD card, due to the high speed involved in this. The only drawback with (A) is I need a PC for every board to be programmed. Which tool is expected to work? STM32CubeProgrammer? With (B) option every board does not need anything because u-boot can be written in internal eMMC within u-boot itself... Or, are there any other option to write the internal flash? What do you use guys? Regards, Gianluca Renzi -- Eurek s.r.l. | Electronic Engineering| http://www.eurek.it via Celletta 8/B, 40026 Imola, Italy | Phone: +39-(0)542-609120 p.iva 00690621206 - c.f. 04020030377 | Fax: +39-(0)542-609212
[PATCH] vexpress64_fvp: Set DRAM to 4G to match with kernel devicetree
Currently, the kernel devicetree is setting the DRAM size to ~4G. Signed-off-by: Diego Sueiro --- configs/vexpress_aemv8a_semi_defconfig | 2 +- include/configs/vexpress_aemv8a.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/configs/vexpress_aemv8a_semi_defconfig b/configs/vexpress_aemv8a_semi_defconfig index a26137ef5d..2ecb7762ce 100644 --- a/configs/vexpress_aemv8a_semi_defconfig +++ b/configs/vexpress_aemv8a_semi_defconfig @@ -2,7 +2,7 @@ CONFIG_ARM=y CONFIG_TARGET_VEXPRESS64_BASE_FVP=y CONFIG_SYS_TEXT_BASE=0x8800 CONFIG_SYS_MALLOC_F_LEN=0x2000 -CONFIG_NR_DRAM_BANKS=1 +CONFIG_NR_DRAM_BANKS=2 CONFIG_SYS_MEMTEST_START=0x8000 CONFIG_SYS_MEMTEST_END=0xff00 CONFIG_ENV_SIZE=0x4 diff --git a/include/configs/vexpress_aemv8a.h b/include/configs/vexpress_aemv8a.h index 566bee5b87..f1490a86b9 100644 --- a/include/configs/vexpress_aemv8a.h +++ b/include/configs/vexpress_aemv8a.h @@ -117,6 +117,9 @@ #ifdef CONFIG_TARGET_VEXPRESS64_JUNO #define PHYS_SDRAM_2 (0x88000) #define PHYS_SDRAM_2_SIZE 0x18000 +#elif CONFIG_TARGET_VEXPRESS64_BASE_FVP && CONFIG_NR_DRAM_BANKS == 2 +#define PHYS_SDRAM_2 (0x88000) +#define PHYS_SDRAM_2_SIZE 0x8000 #endif /* Enable memtest */ -- 2.17.1
[PATCH] mmc: pci: Fix Kconfig dependency
The PCI MMC driver depends on the generic MMC SDHCI driver, otherwise it does not compile. Signed-off-by: Bin Meng --- drivers/mmc/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig index f8ea921..3adee0a 100644 --- a/drivers/mmc/Kconfig +++ b/drivers/mmc/Kconfig @@ -304,6 +304,7 @@ config MMC_MXS config MMC_PCI bool "Support for MMC controllers on PCI" + depends on MMC_SDHCI help This selects PCI-based MMC controllers. If you have an MMC controller on a PCI bus, say Y here. -- 2.7.4
[PATCH 2/4] imx51-babbage: Import devicetree files from Linux
Import the imx51-babbage devicetree files from Linux kernel version 5.11-rc7. This is in preparation for converting the mx51evk_defconfig target to driver model. Signed-off-by: Fabio Estevam --- arch/arm/dts/imx51-babbage.dts | 726 +++ arch/arm/dts/imx51-pinfunc.h | 768 + arch/arm/dts/imx51.dtsi| 654 3 files changed, 2148 insertions(+) create mode 100644 arch/arm/dts/imx51-babbage.dts create mode 100644 arch/arm/dts/imx51-pinfunc.h create mode 100644 arch/arm/dts/imx51.dtsi diff --git a/arch/arm/dts/imx51-babbage.dts b/arch/arm/dts/imx51-babbage.dts new file mode 100644 index ..552196d8a60a --- /dev/null +++ b/arch/arm/dts/imx51-babbage.dts @@ -0,0 +1,726 @@ +// SPDX-License-Identifier: GPL-2.0+ +// +// Copyright 2011 Freescale Semiconductor, Inc. +// Copyright 2011 Linaro Ltd. + +/dts-v1/; +#include "imx51.dtsi" + +/ { + model = "Freescale i.MX51 Babbage Board"; + compatible = "fsl,imx51-babbage", "fsl,imx51"; + + chosen { + stdout-path = + }; + + memory@9000 { + device_type = "memory"; + reg = <0x9000 0x2000>; + }; + + ckih1 { + clock-frequency = <22579200>; + }; + + clk_osc: clk-osc { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <2600>; + }; + + clk_osc_gate: clk-osc-gate { + compatible = "gpio-gate-clock"; + pinctrl-names = "default"; + pinctrl-0 = <_clk26mhz_osc>; + clocks = <_osc>; + #clock-cells = <0>; + enable-gpios = < 1 GPIO_ACTIVE_HIGH>; + }; + + clk_audio: clk-audio { + compatible = "gpio-gate-clock"; + pinctrl-names = "default"; + pinctrl-0 = <_clk26mhz_audio>; + clocks = <_osc_gate>; + #clock-cells = <0>; + enable-gpios = < 26 GPIO_ACTIVE_LOW>; + }; + + clk_usb: clk-usb { + compatible = "gpio-gate-clock"; + pinctrl-names = "default"; + pinctrl-0 = <_clk26mhz_usb>; + clocks = <_osc_gate>; + #clock-cells = <0>; + enable-gpios = < 1 GPIO_ACTIVE_LOW>; + }; + + display1: disp1 { + compatible = "fsl,imx-parallel-display"; + #address-cells = <1>; + #size-cells = <0>; + interface-pix-fmt = "rgb24"; + pinctrl-names = "default"; + pinctrl-0 = <_ipu_disp1>; + + port@0 { + reg = <0>; + + display0_in: endpoint { + remote-endpoint = <_di0_disp1>; + }; + }; + + port@1 { + reg = <1>; + + parallel_display_out: endpoint { + remote-endpoint = <_in>; + }; + }; + }; + + display2: disp2 { + compatible = "fsl,imx-parallel-display"; + interface-pix-fmt = "rgb565"; + pinctrl-names = "default"; + pinctrl-0 = <_ipu_disp2>; + status = "disabled"; + display-timings { + native-mode = <>; + timing1: claawvga { + clock-frequency = <2700>; + hactive = <800>; + vactive = <480>; + hback-porch = <40>; + hfront-porch = <60>; + vback-porch = <10>; + vfront-porch = <10>; + hsync-len = <20>; + vsync-len = <10>; + hsync-active = <0>; + vsync-active = <0>; + de-active = <1>; + pixelclk-active = <0>; + }; + }; + + port { + display1_in: endpoint { + remote-endpoint = <_di1_disp2>; + }; + }; + }; + + dvi-connector { + compatible = "dvi-connector"; + digital; + + port { + dvi_connector_in: endpoint { + remote-endpoint = <_out>; + }; + }; + }; + + dvi-encoder { + compatible = "ti,tfp410"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + +
[PATCH 4/4] mx51evk: Add myself as maintainer
I would like to help supporting this board, so add myself as a maintainer. Signed-off-by: Fabio Estevam --- board/freescale/mx51evk/MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/board/freescale/mx51evk/MAINTAINERS b/board/freescale/mx51evk/MAINTAINERS index 0e5f22c26b4b..1ca55f7d14ec 100644 --- a/board/freescale/mx51evk/MAINTAINERS +++ b/board/freescale/mx51evk/MAINTAINERS @@ -1,4 +1,5 @@ MX51EVK BOARD +M: Fabio Estevam M: Stefano Babic S: Maintained F: board/freescale/mx51evk/ -- 2.25.1
[PATCH 3/4] mx51evk: Convert to driver model
Make the conversion to driver model as it is mandatory. Tested booting the Linux kernel from the SD card. Signed-off-by: Fabio Estevam --- arch/arm/dts/Makefile | 3 + board/freescale/mx51evk/mx51evk.c | 186 +- configs/mx51evk_defconfig | 19 ++- include/configs/mx51evk.h | 8 -- 4 files changed, 22 insertions(+), 194 deletions(-) diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 4fd3eabd6e8f..88f23e4ef41e 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -653,6 +653,9 @@ dtb-$(CONFIG_VF610) += vf500-colibri.dtb \ dtb-$(CONFIG_MX28) += \ imx28-xea.dtb +dtb-$(CONFIG_MX51) += \ + imx51-babbage.dtb + dtb-$(CONFIG_MX53) += imx53-cx9020.dtb \ imx53-qsb.dtb \ imx53-kp.dtb \ diff --git a/board/freescale/mx51evk/mx51evk.c b/board/freescale/mx51evk/mx51evk.c index 4250efddde77..b1a5c6b5f8bd 100644 --- a/board/freescale/mx51evk/mx51evk.c +++ b/board/freescale/mx51evk/mx51evk.c @@ -26,13 +26,6 @@ DECLARE_GLOBAL_DATA_PTR; -#ifdef CONFIG_FSL_ESDHC_IMX -struct fsl_esdhc_cfg esdhc_cfg[2] = { - {MMC_SDHC1_BASE_ADDR}, - {MMC_SDHC2_BASE_ADDR}, -}; -#endif - int dram_init(void) { /* dram_init must store complete ramsize in gd->ram_size */ @@ -63,34 +56,6 @@ static void setup_iomux_uart(void) imx_iomux_v3_setup_multiple_pads(uart_pads, ARRAY_SIZE(uart_pads)); } -static void setup_iomux_fec(void) -{ - static const iomux_v3_cfg_t fec_pads[] = { - NEW_PAD_CTRL(MX51_PAD_EIM_EB2__FEC_MDIO, PAD_CTL_HYS | - PAD_CTL_PUS_22K_UP | PAD_CTL_ODE | - PAD_CTL_DSE_HIGH | PAD_CTL_SRE_FAST), - MX51_PAD_NANDF_CS3__FEC_MDC, - NEW_PAD_CTRL(MX51_PAD_EIM_CS3__FEC_RDATA3, MX51_PAD_CTRL_2), - NEW_PAD_CTRL(MX51_PAD_EIM_CS2__FEC_RDATA2, MX51_PAD_CTRL_2), - NEW_PAD_CTRL(MX51_PAD_EIM_EB3__FEC_RDATA1, MX51_PAD_CTRL_2), - MX51_PAD_NANDF_D9__FEC_RDATA0, - MX51_PAD_NANDF_CS6__FEC_TDATA3, - MX51_PAD_NANDF_CS5__FEC_TDATA2, - MX51_PAD_NANDF_CS4__FEC_TDATA1, - MX51_PAD_NANDF_D8__FEC_TDATA0, - MX51_PAD_NANDF_CS7__FEC_TX_EN, - MX51_PAD_NANDF_CS2__FEC_TX_ER, - MX51_PAD_NANDF_RDY_INT__FEC_TX_CLK, - NEW_PAD_CTRL(MX51_PAD_NANDF_RB2__FEC_COL, MX51_PAD_CTRL_4), - NEW_PAD_CTRL(MX51_PAD_NANDF_RB3__FEC_RX_CLK, MX51_PAD_CTRL_4), - MX51_PAD_EIM_CS5__FEC_CRS, - MX51_PAD_EIM_CS4__FEC_RX_ER, - NEW_PAD_CTRL(MX51_PAD_NANDF_D11__FEC_RX_DV, MX51_PAD_CTRL_4), - }; - - imx_iomux_v3_setup_multiple_pads(fec_pads, ARRAY_SIZE(fec_pads)); -} - #ifdef CONFIG_MXC_SPI static void setup_iomux_spi(void) { @@ -111,64 +76,6 @@ static void setup_iomux_spi(void) } #endif -#ifdef CONFIG_USB_EHCI_MX5 -#define MX51EVK_USBH1_HUB_RST IMX_GPIO_NR(1, 7) -#define MX51EVK_USBH1_STP IMX_GPIO_NR(1, 27) -#define MX51EVK_USB_CLK_EN_B IMX_GPIO_NR(2, 1) -#define MX51EVK_USB_PHY_RESET IMX_GPIO_NR(2, 5) - -static void setup_usb_h1(void) -{ - static const iomux_v3_cfg_t usb_h1_pads[] = { - MX51_PAD_USBH1_CLK__USBH1_CLK, - MX51_PAD_USBH1_DIR__USBH1_DIR, - MX51_PAD_USBH1_STP__USBH1_STP, - MX51_PAD_USBH1_NXT__USBH1_NXT, - MX51_PAD_USBH1_DATA0__USBH1_DATA0, - MX51_PAD_USBH1_DATA1__USBH1_DATA1, - MX51_PAD_USBH1_DATA2__USBH1_DATA2, - MX51_PAD_USBH1_DATA3__USBH1_DATA3, - MX51_PAD_USBH1_DATA4__USBH1_DATA4, - MX51_PAD_USBH1_DATA5__USBH1_DATA5, - MX51_PAD_USBH1_DATA6__USBH1_DATA6, - MX51_PAD_USBH1_DATA7__USBH1_DATA7, - - NEW_PAD_CTRL(MX51_PAD_GPIO1_7__GPIO1_7, 0), /* H1 hub reset */ - MX51_PAD_EIM_D17__GPIO2_1, - MX51_PAD_EIM_D21__GPIO2_5, /* PHY reset */ - }; - - imx_iomux_v3_setup_multiple_pads(usb_h1_pads, ARRAY_SIZE(usb_h1_pads)); -} - -int board_ehci_hcd_init(int port) -{ - /* Set USBH1_STP to GPIO and toggle it */ - imx_iomux_v3_setup_pad(NEW_PAD_CTRL(MX51_PAD_USBH1_STP__GPIO1_27, - MX51_USBH_PAD_CTRL)); - - gpio_direction_output(MX51EVK_USBH1_STP, 0); - gpio_direction_output(MX51EVK_USB_PHY_RESET, 0); - mdelay(10); - gpio_set_value(MX51EVK_USBH1_STP, 1); - - /* Set back USBH1_STP to be function */ - imx_iomux_v3_setup_pad(MX51_PAD_USBH1_STP__USBH1_STP); - - /* De-assert USB PHY RESETB */ - gpio_set_value(MX51EVK_USB_PHY_RESET, 1); - - /* Drive USB_CLK_EN_B line low */ - gpio_direction_output(MX51EVK_USB_CLK_EN_B, 0); - - /* Reset USB hub */ - gpio_direction_output(MX51EVK_USBH1_HUB_RST, 0); - mdelay(2); - gpio_set_value(MX51EVK_USBH1_HUB_RST, 1);
[PATCH 1/4] mmc: fsl_esdhc_imx: Add a compatible for i.MX51
Add a compatible for i.MX51 so that i.MX51 can use this driver via driver model. Signed-off-by: Fabio Estevam --- drivers/mmc/fsl_esdhc_imx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c index 8ac859797f04..827a6f113f3b 100644 --- a/drivers/mmc/fsl_esdhc_imx.c +++ b/drivers/mmc/fsl_esdhc_imx.c @@ -1705,6 +1705,7 @@ static struct esdhc_soc_data usdhc_imx8qm_data = { }; static const struct udevice_id fsl_esdhc_ids[] = { + { .compatible = "fsl,imx51-esdhc", }, { .compatible = "fsl,imx53-esdhc", }, { .compatible = "fsl,imx6ul-usdhc", }, { .compatible = "fsl,imx6sx-usdhc", }, -- 2.25.1
Re: [PATCH v2] sunxi: support boot console on uart1 for sun8i
On Mon, 15 Feb 2021 00:19:58 +0100 Tobias Schramm wrote: Hi, > The A23, A33, H3, H5, A83T, V3 and Sochip S3 sun8i SoCs can mux uart1 on > GPIOs PG6 and PG7. This patch adds support for using uart1 on those pins > as boot console. > > Signed-off-by: Tobias Schramm Thanks for the changes! Reviewed-by: Andre Przywara Cheers, Andre P.S. Will queue this for a pull request later this week. > --- > arch/arm/include/asm/arch-sunxi/gpio.h | 1 + > arch/arm/mach-sunxi/board.c| 5 + > 2 files changed, 6 insertions(+) > > diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h > b/arch/arm/include/asm/arch-sunxi/gpio.h > index de77bf638e..2969a530ae 100644 > --- a/arch/arm/include/asm/arch-sunxi/gpio.h > +++ b/arch/arm/include/asm/arch-sunxi/gpio.h > @@ -190,6 +190,7 @@ enum sunxi_gpio_number { > #define SUN5I_GPG_SDC1 2 > #define SUN6I_GPG_SDC1 2 > #define SUN8I_GPG_SDC1 2 > +#define SUN8I_GPG_UART1 2 > #define SUN6I_GPG_TWI3 2 > #define SUN5I_GPG_UART1 4 > > diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c > index ae6bc656d9..d25081c92f 100644 > --- a/arch/arm/mach-sunxi/board.c > +++ b/arch/arm/mach-sunxi/board.c > @@ -144,6 +144,11 @@ static int gpio_init(void) > sunxi_gpio_set_cfgpin(SUNXI_GPL(2), SUN8I_GPL_R_UART); > sunxi_gpio_set_cfgpin(SUNXI_GPL(3), SUN8I_GPL_R_UART); > sunxi_gpio_set_pull(SUNXI_GPL(3), SUNXI_GPIO_PULL_UP); > +#elif CONFIG_CONS_INDEX == 2 && defined(CONFIG_MACH_SUN8I) && \ > + !defined(CONFIG_MACH_SUN8I_R40) > + sunxi_gpio_set_cfgpin(SUNXI_GPG(6), SUN8I_GPG_UART1); > + sunxi_gpio_set_cfgpin(SUNXI_GPG(7), SUN8I_GPG_UART1); > + sunxi_gpio_set_pull(SUNXI_GPG(7), SUNXI_GPIO_PULL_UP); > #else > #error Unsupported console port number. Please fix pin mux settings in > board.c > #endif
Re: [PATCH] virtio: fix off by one device id comparison
On Mon, Feb 15, 2021 at 4:24 PM Vincent Stehlé wrote: > > VIRTIO_ID_MAX_NUM is the largest device ID plus 1. Therefore a device id > cannot be greater or equal to VIRTIO_ID_MAX_NUM. Fix the comparison > accordingly. > > Fixes: 8fb49b4c7a82 ("dm: Add a new uclass driver for VirtIO transport > devices") > Signed-off-by: Vincent Stehlé > Cc: Simon Glass > Cc: Bin Meng > --- > drivers/virtio/virtio-uclass.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > Reviewed-by: Bin Meng
[PATCH v3 5/5] net: gem: Enable ethernet rx clock for versal
From: T Karthik Reddy Enable rx clock along with tx clock for versal platform. Use compatible data to enable/disable clocks in the driver. Signed-off-by: T Karthik Reddy Signed-off-by: Michal Simek Reviewed-by: Ramon Fried --- Changes in v3: - Fix Ramon's tag Changes in v2: - Use compatible data instead of CONFIG_ drivers/net/zynq_gem.c | 33 +++-- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c index a2a01112018f..9ed013ee5124 100644 --- a/drivers/net/zynq_gem.c +++ b/drivers/net/zynq_gem.c @@ -129,6 +129,8 @@ #define ZYNQ_GEM_FREQUENCY_100 2500UL #define ZYNQ_GEM_FREQUENCY_100012500UL +#define RXCLK_EN BIT(0) + /* Device registers */ struct zynq_gem_regs { u32 nwctrl; /* 0x0 - Network Control reg */ @@ -205,10 +207,12 @@ struct zynq_gem_priv { struct phy_device *phydev; ofnode phy_of_node; struct mii_dev *bus; - struct clk clk; + struct clk rx_clk; + struct clk tx_clk; u32 max_speed; bool int_pcs; bool dma_64bit; + u32 clk_en_info; }; static int phy_setup_op(struct zynq_gem_priv *priv, u32 phy_addr, u32 regnum, @@ -476,18 +480,25 @@ static int zynq_gem_init(struct udevice *dev) break; } - ret = clk_set_rate(>clk, clk_rate); + ret = clk_set_rate(>tx_clk, clk_rate); if (IS_ERR_VALUE(ret)) { dev_err(dev, "failed to set tx clock rate\n"); return ret; } - ret = clk_enable(>clk); + ret = clk_enable(>tx_clk); if (ret) { dev_err(dev, "failed to enable tx clock\n"); return ret; } + if (priv->clk_en_info & RXCLK_EN) { + ret = clk_enable(>rx_clk); + if (ret) { + dev_err(dev, "failed to enable rx clock\n"); + return ret; + } + } setbits_le32(>nwctrl, ZYNQ_GEM_NWCTRL_RXEN_MASK | ZYNQ_GEM_NWCTRL_TXEN_MASK); @@ -694,12 +705,20 @@ static int zynq_gem_probe(struct udevice *dev) priv->tx_bd = (struct emac_bd *)bd_space; priv->rx_bd = (struct emac_bd *)((ulong)bd_space + BD_SEPRN_SPACE); - ret = clk_get_by_name(dev, "tx_clk", >clk); + ret = clk_get_by_name(dev, "tx_clk", >tx_clk); if (ret < 0) { - dev_err(dev, "failed to get clock\n"); + dev_err(dev, "failed to get tx_clock\n"); goto err1; } + if (priv->clk_en_info & RXCLK_EN) { + ret = clk_get_by_name(dev, "rx_clk", >rx_clk); + if (ret < 0) { + dev_err(dev, "failed to get rx_clock\n"); + goto err1; + } + } + priv->bus = mdio_alloc(); priv->bus->read = zynq_gem_miiphy_read; priv->bus->write = zynq_gem_miiphy_write; @@ -794,11 +813,13 @@ static int zynq_gem_of_to_plat(struct udevice *dev) (ulong)priv->iobase, (ulong)priv->mdiobase, priv->phyaddr, phy_string_for_interface(priv->interface)); + priv->clk_en_info = dev_get_driver_data(dev); + return 0; } static const struct udevice_id zynq_gem_ids[] = { - { .compatible = "cdns,versal-gem" }, + { .compatible = "cdns,versal-gem", .data = RXCLK_EN }, { .compatible = "cdns,zynqmp-gem" }, { .compatible = "cdns,zynq-gem" }, { .compatible = "cdns,gem" }, -- 2.30.0
[PATCH v3 4/5] i2c: i2c_cdns: Enable i2c clock
From: T Karthik Reddy Enable i2c controller clock from driver probe function by calling clk_enable(). Signed-off-by: T Karthik Reddy Signed-off-by: Michal Simek Reviewed-by: Heiko Schocher --- (no changes since v1) drivers/i2c/i2c-cdns.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/i2c/i2c-cdns.c b/drivers/i2c/i2c-cdns.c index db3c04fa6e75..a650dd69b89f 100644 --- a/drivers/i2c/i2c-cdns.c +++ b/drivers/i2c/i2c-cdns.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -481,6 +482,12 @@ static int cdns_i2c_of_to_plat(struct udevice *dev) i2c_bus->input_freq = clk_get_rate(); + ret = clk_enable(); + if (ret) { + dev_err(dev, "failed to enable clock\n"); + return ret; + } + return 0; } -- 2.30.0
[PATCH v3 3/5] clk: versal: Add support to enable clocks
From: T Karthik Reddy Add clock enable functionality in versal clock driver to enable clocks from peripheral drivers using clk_ops. Signed-off-by: T Karthik Reddy Signed-off-by: Michal Simek --- (no changes since v2) Changes in v2: - change patch possition drivers/clk/clk_versal.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/drivers/clk/clk_versal.c b/drivers/clk/clk_versal.c index 908bc7519c42..62523d290999 100644 --- a/drivers/clk/clk_versal.c +++ b/drivers/clk/clk_versal.c @@ -718,9 +718,20 @@ static ulong versal_clk_set_rate(struct clk *clk, ulong rate) return clk_rate; } +static int versal_clk_enable(struct clk *clk) +{ + struct versal_clk_priv *priv = dev_get_priv(clk->dev); + u32 clk_id; + + clk_id = priv->clk[clk->id].clk_id; + + return xilinx_pm_request(PM_CLOCK_ENABLE, clk_id, 0, 0, 0, NULL); +} + static struct clk_ops versal_clk_ops = { .set_rate = versal_clk_set_rate, .get_rate = versal_clk_get_rate, + .enable = versal_clk_enable, }; static const struct udevice_id versal_clk_ids[] = { -- 2.30.0
[PATCH v3 2/5] clk: zynqmp: Add support to enable clocks
From: T Karthik Reddy Add clock enable functionality in zynqmp clock driver to enable clocks from peripheral drivers using clk_ops. Signed-off-by: T Karthik Reddy Signed-off-by: Michal Simek --- (no changes since v1) drivers/clk/clk_zynqmp.c | 49 1 file changed, 49 insertions(+) diff --git a/drivers/clk/clk_zynqmp.c b/drivers/clk/clk_zynqmp.c index e8acca00660d..609d8e3b2fff 100644 --- a/drivers/clk/clk_zynqmp.c +++ b/drivers/clk/clk_zynqmp.c @@ -199,6 +199,8 @@ static u32 zynqmp_clk_get_register(enum zynqmp_clk id) return CRF_APB_DDR_CTRL; case qspi_ref: return CRL_APB_QSPI_REF_CTRL; + case usb3_dual_ref: + return CRL_APB_USB3_DUAL_REF_CTRL; case gem0_ref: return CRL_APB_GEM0_REF_CTRL; case gem1_ref: @@ -207,6 +209,10 @@ static u32 zynqmp_clk_get_register(enum zynqmp_clk id) return CRL_APB_GEM2_REF_CTRL; case gem3_ref: return CRL_APB_GEM3_REF_CTRL; + case usb0_bus_ref: + return CRL_APB_USB0_BUS_REF_CTRL; + case usb1_bus_ref: + return CRL_APB_USB1_BUS_REF_CTRL; case uart0_ref: return CRL_APB_UART0_REF_CTRL; case uart1_ref: @@ -699,9 +705,52 @@ static int zynqmp_clk_probe(struct udevice *dev) return 0; } +static int zynqmp_clk_enable(struct clk *clk) +{ + enum zynqmp_clk id = clk->id; + u32 reg, clk_ctrl, clkact_shift, mask; + int ret; + + reg = zynqmp_clk_get_register(id); + debug("%s, clk_id:%x, clk_base:0x%x\n", __func__, id, reg); + + switch (id) { + case usb0_bus_ref ... usb1: + clkact_shift = 25; + mask = 0x1; + break; + case gem0_ref ... gem3_ref: + clkact_shift = 25; + mask = 0x3; + break; + case qspi_ref ... can1_ref: + clkact_shift = 24; + mask = 0x1; + break; + default: + return -ENXIO; + } + + ret = zynqmp_mmio_read(reg, _ctrl); + if (ret) { + printf("%s mio read fail\n", __func__); + return -EIO; + } + + clk_ctrl |= (mask << clkact_shift); + ret = zynqmp_mmio_write(reg, mask << clkact_shift, clk_ctrl); + if (ret) { + printf("%s mio write fail\n", __func__); + return -EIO; + } + + return ret; +} + static struct clk_ops zynqmp_clk_ops = { .set_rate = zynqmp_clk_set_rate, .get_rate = zynqmp_clk_get_rate, + .enable = zynqmp_clk_enable, }; static const struct udevice_id zynqmp_clk_ids[] = { -- 2.30.0
[PATCH v3 1/5] clk: zynq: Add dummy clock enable function
A lot of Xilinx drivers are checking -ENOSYS which means that clock driver doesn't have enable function. Remove this checking from drivers and create dummy enable function as was done for clk_fixed_rate driver by commit 6bf6d81c1112 ("clk: fixed_rate: add dummy enable() function"). Signed-off-by: Michal Simek --- Changes in v3: - Enable it for SPL too. Changes in v2: - New patch is series drivers/clk/clk_zynq.c | 10 ++ drivers/mmc/zynq_sdhci.c | 2 +- drivers/net/zynq_gem.c | 4 ++-- drivers/serial/serial_zynq.c | 2 +- drivers/spi/zynq_qspi.c| 2 +- drivers/spi/zynq_spi.c | 2 +- drivers/spi/zynqmp_gqspi.c | 2 +- drivers/watchdog/xilinx_wwdt.c | 3 +-- 8 files changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/clk/clk_zynq.c b/drivers/clk/clk_zynq.c index bf32d8317ab2..1f71b7d1e4f6 100644 --- a/drivers/clk/clk_zynq.c +++ b/drivers/clk/clk_zynq.c @@ -444,11 +444,21 @@ static ulong zynq_clk_get_rate(struct clk *clk) } #endif +static int dummy_enable(struct clk *clk) +{ + /* +* Add implementation but by default all clocks are enabled +* after power up which is only one supported case now. +*/ + return 0; +} + static struct clk_ops zynq_clk_ops = { .get_rate = zynq_clk_get_rate, #ifndef CONFIG_SPL_BUILD .set_rate = zynq_clk_set_rate, #endif + .enable = dummy_enable, }; static int zynq_clk_probe(struct udevice *dev) diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c index d9ad0ff199d7..b79c4021b6a5 100644 --- a/drivers/mmc/zynq_sdhci.c +++ b/drivers/mmc/zynq_sdhci.c @@ -577,7 +577,7 @@ static int arasan_sdhci_probe(struct udevice *dev) debug("%s: CLK %ld\n", __func__, clock); ret = clk_enable(); - if (ret && ret != -ENOSYS) { + if (ret) { dev_err(dev, "failed to enable clock\n"); return ret; } diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c index 585c06d6bd87..a2a01112018f 100644 --- a/drivers/net/zynq_gem.c +++ b/drivers/net/zynq_gem.c @@ -477,13 +477,13 @@ static int zynq_gem_init(struct udevice *dev) } ret = clk_set_rate(>clk, clk_rate); - if (IS_ERR_VALUE(ret) && ret != (unsigned long)-ENOSYS) { + if (IS_ERR_VALUE(ret)) { dev_err(dev, "failed to set tx clock rate\n"); return ret; } ret = clk_enable(>clk); - if (ret && ret != -ENOSYS) { + if (ret) { dev_err(dev, "failed to enable tx clock\n"); return ret; } diff --git a/drivers/serial/serial_zynq.c b/drivers/serial/serial_zynq.c index 2883e2466f8b..799d5240473c 100644 --- a/drivers/serial/serial_zynq.c +++ b/drivers/serial/serial_zynq.c @@ -127,7 +127,7 @@ static int zynq_serial_setbrg(struct udevice *dev, int baudrate) debug("%s: CLK %ld\n", __func__, clock); ret = clk_enable(); - if (ret && ret != -ENOSYS) { + if (ret) { dev_err(dev, "failed to enable clock\n"); return ret; } diff --git a/drivers/spi/zynq_qspi.c b/drivers/spi/zynq_qspi.c index 845f2d2f5f41..29dbbf555776 100644 --- a/drivers/spi/zynq_qspi.c +++ b/drivers/spi/zynq_qspi.c @@ -193,7 +193,7 @@ static int zynq_qspi_probe(struct udevice *bus) } ret = clk_enable(); - if (ret && ret != -ENOSYS) { + if (ret) { dev_err(bus, "failed to enable clock\n"); return ret; } diff --git a/drivers/spi/zynq_spi.c b/drivers/spi/zynq_spi.c index 2971e55f41b1..650d4d71d925 100644 --- a/drivers/spi/zynq_spi.c +++ b/drivers/spi/zynq_spi.c @@ -143,7 +143,7 @@ static int zynq_spi_probe(struct udevice *bus) } ret = clk_enable(); - if (ret && ret != -ENOSYS) { + if (ret) { dev_err(bus, "failed to enable clock\n"); return ret; } diff --git a/drivers/spi/zynqmp_gqspi.c b/drivers/spi/zynqmp_gqspi.c index c7db43a09a52..bd25511aae6a 100644 --- a/drivers/spi/zynqmp_gqspi.c +++ b/drivers/spi/zynqmp_gqspi.c @@ -373,7 +373,7 @@ static int zynqmp_qspi_probe(struct udevice *bus) debug("%s: CLK %ld\n", __func__, clock); ret = clk_enable(); - if (ret && ret != -ENOSYS) { + if (ret) { dev_err(bus, "failed to enable clock\n"); return ret; } diff --git a/drivers/watchdog/xilinx_wwdt.c b/drivers/watchdog/xilinx_wwdt.c index 9137d87697d4..11b30ae85df0 100644 --- a/drivers/watchdog/xilinx_wwdt.c +++ b/drivers/watchdog/xilinx_wwdt.c @@ -90,9 +90,8 @@ static int xlnx_wwdt_start(struct udevice *dev, u64 timeout, ulong flags) /* Calculate timeout count */ count = timeout * clock_f; - /* clk_enable will return -ENOSYS when it is not implemented */ ret = clk_enable(>clk); - if (ret && ret != -ENOSYS) { + if (ret) { dev_err(dev, "failed
[PATCH v3 0/5] clk: Add support to enable clocks
Hi, Add support to enable clocks using clock subsystem ops for zynqmp & versal platforms. Enable rx clock in ethernet driver for versal platform. Add clock enable feature in i2c-cdns driver. Thanks, Karthik, Michal Changes in v3: - Enable it for SPL too. - Fix Ramon's tag Changes in v2: - New patch is series - change patch possition - Use compatible data instead of CONFIG_ Michal Simek (1): clk: zynq: Add dummy clock enable function T Karthik Reddy (4): clk: zynqmp: Add support to enable clocks clk: versal: Add support to enable clocks i2c: i2c_cdns: Enable i2c clock net: gem: Enable ethernet rx clock for versal drivers/clk/clk_versal.c | 11 drivers/clk/clk_zynq.c | 10 +++ drivers/clk/clk_zynqmp.c | 49 ++ drivers/i2c/i2c-cdns.c | 7 + drivers/mmc/zynq_sdhci.c | 2 +- drivers/net/zynq_gem.c | 37 +++-- drivers/serial/serial_zynq.c | 2 +- drivers/spi/zynq_qspi.c| 2 +- drivers/spi/zynq_spi.c | 2 +- drivers/spi/zynqmp_gqspi.c | 2 +- drivers/watchdog/xilinx_wwdt.c | 3 +-- 11 files changed, 112 insertions(+), 15 deletions(-) -- 2.30.0
[PATCH] configs: fsl: move via specific defines to Kconfig
Moves below via specific defines to Kconfig: CONFIG_FSL_VIA Signed-off-by: Rajesh Bhagat --- arch/powerpc/cpu/mpc85xx/Kconfig | 6 ++ include/configs/MPC8541CDS.h | 2 -- include/configs/MPC8548CDS.h | 2 -- include/configs/MPC8555CDS.h | 2 -- scripts/config_whitelist.txt | 1 - 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/cpu/mpc85xx/Kconfig b/arch/powerpc/cpu/mpc85xx/Kconfig index c1a3770671..47e7e4b7d2 100644 --- a/arch/powerpc/cpu/mpc85xx/Kconfig +++ b/arch/powerpc/cpu/mpc85xx/Kconfig @@ -51,6 +51,7 @@ config TARGET_P5040DS config TARGET_MPC8541CDS bool "Support MPC8541CDS" select ARCH_MPC8541 + select FSL_VIA config TARGET_MPC8544DS bool "Support MPC8544DS" @@ -60,10 +61,12 @@ config TARGET_MPC8544DS config TARGET_MPC8548CDS bool "Support MPC8548CDS" select ARCH_MPC8548 + select FSL_VIA config TARGET_MPC8555CDS bool "Support MPC8555CDS" select ARCH_MPC8555 + select FSL_VIA config TARGET_MPC8568MDS bool "Support MPC8568MDS" @@ -1441,6 +1444,9 @@ config SYS_FSL_LBC_CLK_DIV Defines divider of platform clock(clock input to eLBC controller). +config FSL_VIA + bool + source "board/freescale/corenet_ds/Kconfig" source "board/freescale/mpc8541cds/Kconfig" source "board/freescale/mpc8544ds/Kconfig" diff --git a/include/configs/MPC8541CDS.h b/include/configs/MPC8541CDS.h index b1c8917f21..ea4da6a5fe 100644 --- a/include/configs/MPC8541CDS.h +++ b/include/configs/MPC8541CDS.h @@ -18,8 +18,6 @@ #define CONFIG_PCI_INDIRECT_BRIDGE #define CONFIG_SYS_PCI_64BIT 1 /* enable 64-bit PCI resources */ -#define CONFIG_FSL_VIA - #ifndef __ASSEMBLY__ extern unsigned long get_clock_freq(void); #endif diff --git a/include/configs/MPC8548CDS.h b/include/configs/MPC8548CDS.h index 4efc182ef8..a4504fbdb2 100644 --- a/include/configs/MPC8548CDS.h +++ b/include/configs/MPC8548CDS.h @@ -23,8 +23,6 @@ #define CONFIG_INTERRUPTS /* enable pci, srio, ddr interrupts */ -#define CONFIG_FSL_VIA - #ifndef __ASSEMBLY__ #include extern unsigned long get_clock_freq(void); diff --git a/include/configs/MPC8555CDS.h b/include/configs/MPC8555CDS.h index 88999ef2b8..79e309c95c 100644 --- a/include/configs/MPC8555CDS.h +++ b/include/configs/MPC8555CDS.h @@ -18,8 +18,6 @@ #define CONFIG_PCI_INDIRECT_BRIDGE #define CONFIG_SYS_PCI_64BIT 1 /* enable 64-bit PCI resources */ -#define CONFIG_FSL_VIA - #ifndef __ASSEMBLY__ extern unsigned long get_clock_freq(void); #endif diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 6934c7ed2e..d76ea0333b 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -562,7 +562,6 @@ CONFIG_FSL_SERDES2 CONFIG_FSL_SGMII_RISER CONFIG_FSL_TBCLK_EXTRA_DIV CONFIG_FSL_TRUST_ARCH_v1 -CONFIG_FSL_VIA CONFIG_FSMC_NAND_BASE CONFIG_FSMTDBLK CONFIG_FSNOTIFY -- 2.17.1
RE: [PATCH v2] doc: board: freescale: imx8mp_evk: update to newer versions and change ATF_LOAD_ADDR
Hello Peter, > -Original Message- > From: Peter Bergin > Sent: Sunday, February 14, 2021 8:19 PM > To: u-boot@lists.denx.de > Cc: Peter Bergin ; ZHIZHIKIN Andrey > > Subject: [PATCH v2] doc: board: freescale: imx8mp_evk: update to newer > versions and change ATF_LOAD_ADDR > > > Update imx-atf and firmware-imx to latest released versions. > > Update address of ATF_LOAD_ADDR that has changed to 0x97 in imx-atf > commit 48733cb4e773a7584ced601de9d717efa3d73815. > > Add 'O=' to make and build in separate directory as one issue has been noticed > where it was trouble building directly inside u-boot source dir. Restructure > the > workflow > and copy binaries after defconfig to ensure that build directory is created. > > Signed-off-by: Peter Bergin > Cc: Andrey Zhizhikin > --- > v2: > - Corrected ATF_LOAD_ADDR in commit message > - Changed workflow to copy binaries after build directory is created > > doc/board/freescale/imx8mp_evk.rst | 27 +-- > 1 file changed, 13 insertions(+), 14 deletions(-) > > diff --git a/doc/board/freescale/imx8mp_evk.rst > b/doc/board/freescale/imx8mp_evk.rst > index ccffcf7257..796a7611d0 100644 > --- a/doc/board/freescale/imx8mp_evk.rst > +++ b/doc/board/freescale/imx8mp_evk.rst > @@ -16,27 +16,21 @@ Quick Start > Get and Build the ARM Trusted firmware > -- > > -Note: $(srctree) is the U-Boot source directory > Get ATF from: https://source.codeaurora.org/external/imx/imx-atf > -branch: imx_5.4.47_2.2.0 > +branch: imx_5.4.70_2.3.0 > > .. code-block:: bash > > $ make PLAT=imx8mp bl31 > - $ cp build/imx8mp/release/bl31.bin $(srctree) > > Get the ddr firmware > > > .. code-block:: bash > > - $ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.9.bin > - $ chmod +x firmware-imx-8.9.bin > - $ ./firmware-imx-8.9.bin > - $ cp > firmware-imx-8.9/firmware/ddr/synopsys/lpddr4_pmu_train_1d_dmem_201904.bin > $(srctree)/lpddr4_pmu_train_1d_dmem.bin > - $ cp > firmware-imx-8.9/firmware/ddr/synopsys/lpddr4_pmu_train_1d_imem_201904.bin > $(srctree)/lpddr4_pmu_train_1d_imem.bin > - $ cp > firmware-imx-8.9/firmware/ddr/synopsys/lpddr4_pmu_train_2d_dmem_201904.bin > $(srctree)/lpddr4_pmu_train_2d_dmem.bin > - $ cp > firmware-imx-8.9/firmware/ddr/synopsys/lpddr4_pmu_train_2d_imem_201904.bin > $(srctree)/lpddr4_pmu_train_2d_imem.bin > + $ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.10.bin > + $ chmod +x firmware-imx-8.10.bin > + $ ./firmware-imx-8.10.bin > > Build U-Boot > > @@ -44,15 +38,20 @@ Build U-Boot > .. code-block:: bash > > $ export CROSS_COMPILE=aarch64-poky-linux- > - $ make imx8mp_evk_defconfig > - $ export ATF_LOAD_ADDR=0x96 > - $ make flash.bin > + $ make O=build imx8mp_evk_defconfig > + $ cp ../imx-atf/build/imx8mp/release/bl31.bin ./build/bl31.bin > + $ cp > ../firmware-imx-8.10/firmware/ddr/synopsys/lpddr4_pmu_train_1d_dmem_202006.bin > ./build/lpddr4_pmu_train_1d_dmem.bin > + $ cp > ../firmware-imx-8.10/firmware/ddr/synopsys/lpddr4_pmu_train_1d_imem_202006.bin > ./build/lpddr4_pmu_train_1d_imem.bin > + $ cp > ../firmware-imx-8.10/firmware/ddr/synopsys/lpddr4_pmu_train_2d_dmem_202006.bin > ./build/lpddr4_pmu_train_2d_dmem.bin > + $ cp > ../firmware-imx-8.10/firmware/ddr/synopsys/lpddr4_pmu_train_2d_imem_202006.bin > ./build/lpddr4_pmu_train_2d_imem.bin > + $ export ATF_LOAD_ADDR=0x97 > + $ make O=build flash.bin > > Burn the flash.bin to the MicroSD card at offset 32KB: > > .. code-block:: bash > > - $sudo dd if=flash.bin of=/dev/sd[x] bs=1K seek=32 conv=notrunc; sync > + $sudo dd if=build/flash.bin of=/dev/sd[x] bs=1K seek=32 conv=notrunc; sync > > Boot > > -- > 2.25.1 Reviewed-by: Andrey Zhizhikin
RE: [PATCH v5] dm: core: Add of_match_node helper function
Hi All, Gentle remainder. Are we happy with this patch[1]? Not sure who needs to merge this patch. Currently this patch has been delegated to Marek and is reviewed by Simon. [1] https://patchwork.ozlabs.org/project/uboot/patch/20210116124042.24007-1-biju.das...@bp.renesas.com/ Regards, Biju > -Original Message- > From: Biju Das > Sent: 16 January 2021 12:41 > To: Simon Glass > Cc: Biju Das ; u-boot@lists.denx.de; Tom Rini > ; Adam Ford ; Marek Vasut > ; Nobuhiro Iwamatsu ; > Chris Paterson ; Prabhakar Mahadev Lad > > Subject: [PATCH v5] dm: core: Add of_match_node helper function > > Add of_match_node() helper function to iterate over the device tree and > tell if a device_node has a matching of_match structure. > > Signed-off-by: Biju Das > Reviewed-by: Lad Prabhakar > Reviewed-by: Simon Glass > --- > v4->v5: > * Rebased to latest master > v3->v4: No change > * Added Simon's Rb tag. > v2->v3: > * Added a test case for of_match_node helper function. > (Ref: > https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwor > k.ozlabs.org%2Fproject%2Fuboot%2Fpatch%2F20201102150959.4793-2- > biju.das.jz%40bp.renesas.com%2Fdata=04%7C01%7Cbiju.das.jz%40bp.renesa > s.com%7C9a457b5b5cef4377a0a608d8ba1bf25f%7C53d82571da1947e49cb4625a166a4a2 > a%7C0%7C0%7C63746397665584%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDA > iLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=0DB8m2aLk > J0YqTFtjqXBpOmYpQAZO7eh7omBDGzrNR4%3Dreserved=0) > v1->v2: > * No Change > v1: > * New Patch > --- > drivers/core/device.c | 21 + > include/dm/device.h | 13 + > test/dm/core.c| 31 +++ > 3 files changed, 65 insertions(+) > > diff --git a/drivers/core/device.c b/drivers/core/device.c index > aeab3836ed..4ff708fd38 100644 > --- a/drivers/core/device.c > +++ b/drivers/core/device.c > @@ -1022,6 +1022,27 @@ bool of_machine_is_compatible(const char *compat) > return !fdt_node_check_compatible(fdt, 0, compat); } > > +static > +const struct udevice_id *__of_match_node(const struct udevice_id > *matches, > + const ofnode node) > +{ > + if (!matches) > + return NULL; > + > + for (; matches->compatible; matches++) { > + if (ofnode_device_is_compatible(node, matches->compatible)) > + return matches; > + } > + > + return NULL; > +} > + > +const struct udevice_id *of_match_node(const struct udevice_id *matches, > +const ofnode node) > +{ > + return __of_match_node(matches, node); } > + > int dev_disable_by_path(const char *path) { > struct uclass *uc; > diff --git a/include/dm/device.h b/include/dm/device.h index > f5b4cd6876..950fc78184 100644 > --- a/include/dm/device.h > +++ b/include/dm/device.h > @@ -802,6 +802,19 @@ bool device_is_compatible(const struct udevice *dev, > const char *compat); > */ > bool of_machine_is_compatible(const char *compat); > > +/** > + * of_match_node() - Tell if a device_node has a matching of_match > +structure > + * > + * > + * Low level utility function used by device matching. > + * > + * @matches: array of of device match structures to search in > + * @node:the of device structure to match against > + * @return matching structure on success, NULL if the match is not > +found */ const struct udevice_id *of_match_node(const struct > +udevice_id *matches, > +const ofnode node); > + > /** > * dev_disable_by_path() - Disable a device given its device tree path > * > diff --git a/test/dm/core.c b/test/dm/core.c index 1f5ca570dc..aae4d8427d > 100644 > --- a/test/dm/core.c > +++ b/test/dm/core.c > @@ -11,6 +11,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -1067,6 +1068,36 @@ static int dm_test_inactive_child(struct > unit_test_state *uts) } DM_TEST(dm_test_inactive_child, > UT_TESTF_SCAN_PDATA); > > +static int dm_test_of_match_node(struct unit_test_state *uts) { > + const ulong test_data_expected = 0x1234; > + ofnode root_node = ofnode_path("/"); > + const struct udevice_id *match; > + unsigned long match_data; > + > + const struct udevice_id soc_device_ids[] = { > + { .compatible = "sandbox", .data = test_data_expected, }, > + { /* sentinel */ } > + }; > + > + const struct udevice_id soc_device_nomatch_ids[] = { > + { .compatible = "sandbox123", .data = test_data_expected, }, > + { /* sentinel */ } > + }; > + > + match = of_match_node(soc_device_ids, root_node); > + ut_assert(match); > + > + match_data = match->data; > + ut_asserteq(match_data, test_data_expected); > + > + match = of_match_node(soc_device_nomatch_ids, root_node); > + ut_asserteq_ptr(match, NULL); > + > + return 0; > +} > +DM_TEST(dm_test_of_match_node,