[U-Boot] Please pull u-boot-dm (take 2)
Hi Tom, This is similar to the last attempt, but without this offending patch which will be replaced by a little series sent today: (I'll pull in that series later) 0a2980b dm: mmc: Avoid probing block devices in find_mmc_device() The following changes since commit 380e86f361e4e2aef83295972863654fde157560: Merge git://git.denx.de/u-boot-fsl-qoriq (2017-05-26 11:19:27 -0400) are available in the git repository at: git://git.denx.de/u-boot-dm.git for you to fetch changes up to 40fcab41cbcace3ff5928f146dd15c1ee3bfac65: sandbox: Move to use live tree (2017-05-27 10:38:13 -0600) Simon Glass (89): dm: Use dm.h header when driver mode is used dm: core: Move dev_get_addr() etc. into a separate file dm: Rename dev_addr..() functions atmel: Fix up use of dm_scan_fdt_node() dm: Fix up inclusion of common.h dm: core: Dont export dm_scan_fdt_node() dm: core: Replace of_offset with accessor (part 2) dm: core: Add ofnode to represent device tree nodes dm: core: Adjust device_bind_common() to take an ofnode dm: mmc: Don't call board_mmc_power_init() with driver model dm: mmc: Don't re-init when accessing environment dm: blk: Allow finding block devices without probing dm: blk: Add a function to find the next block device number dm: blk: Improve block device claiming dm: mmc: Check that drivers have operations dm: mmc: Rewrite mmc_blk_probe() tegra: Convert MMC to use driver model for operations dm: core: Set return value first in lists_bind_fdt() Update WARN_ON() to return a value dm: core: Add livetree definitions dm: core: Add livetree access functions dm: Add a function to create a 'live' device tree dm: Build a live tree after relocation dm: core: Rename of_device_is_compatible() dm: core: Add operations on device tree references dm: core: Add livetree address functions fdt: Update fdt_get_base_address() to use const dm: core: Add address operations on device tree references dm: core: Add a place to put extra device-tree reading functions dm: core: Add device-based 'read' functions to access DT dm: core: Implement live tree 'read' functions dm: core: Allow binding a device from a live tree dm: core: Update lists_bind_fdt() to use ofnode dm: core: Update device_bind_driver_to_node() to use ofnode dm: core: Scan the live tree when setting up driver model dm: core: Add a way to find a device by ofnode dm: regmap: Add support for livetree dm: simple-bus: Add support for livetree dm: core: Update uclass_find_device_by_phandle() for livetree sandbox: Add a way to reset sandbox state for tests dm: test: Move test running code into a separate function dm: test: Show the test filename when running dm: test: Add support for running tests with livetree dm: core: Run tests with both livetree and flat tree dm: gpio: Refactor to prepare for live tree support dm: gpio: Drop blank line in gpio_xlate_offs_flags() comment dm: gpio: sandbox: Use dev_read...() functions to access DT dm: gpio: Add live tree support cros_ec: Fix debug() statement in ec_command_inptr() cros_ec: Convert to support live tree sandbox: Add a new sandbox_flattree board test: Update 'make test' to run more tests fdt: Rename a few functions in fdt_support dm: Add more livetree helpers and definitions string: Add strchrnul() string: Add strcspn() dm: i2c: Convert uclass to livetree samsung: Move pmic header out of config file dm: pmic: Convert uclass to livetree sandbox: pmic: Convert pmic emulator to support livetree dm: regulator: Convert regulator uclass to support livetree dm: regulator: Update fixed regulator to support livetree. dm: mmc: Convert uclass to livetree dm: adc: Convert uclass to livetree dm: usb: Convert uclass to livetree sandbox: usb: Convert emulators to livetree clk: Modify xlate() method for livetree dm: clk: Update uclass to support livetree dm: clk: fixed: Update to support livetree dm: test: Separate out the bus DT offset test dm: test: Disable the fdt_offset test with livetree dm: phy: Update tests to use ut_asserteq() dm: mailbox: Update uclass to support livetree dm: phy: Update uclass to support livetree sandbox: phy: Update driver for livetree dm: power-domain: Update uclass to support livetree dm: reset: Update uclass to support livetree dm: pci: Update uclass to support livetree dm: Update the I2C eeprom driver for livetree cros_ec: Update the cros_ec keyboard driver to livetree dm: spi: Convert uclass to livetree dm: sandbox: i2c: Drop fdtdec.h header dm:
[U-Boot] [PATCH 2/3] dm: mmc: Ensure that block device is probed
Make sure that we probe the block device before using it when reading the environment. Signed-off-by: Simon Glass--- common/env_mmc.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common/env_mmc.c b/common/env_mmc.c index 1611886e22..3763b12278 100644 --- a/common/env_mmc.c +++ b/common/env_mmc.c @@ -98,7 +98,12 @@ static const char *init_mmc_for_env(struct mmc *mmc) if (!mmc) return "!No MMC card found"; -#ifndef CONFIG_BLK +#ifdef CONFIG_BLK + struct udevice *dev; + + if (blk_get_from_parent(mmc->dev, )) + return "!No block device"; +#else if (mmc_init(mmc)) return "!MMC init failed"; #endif -- 2.13.0.219.gdb65acc882-goog ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 3/3] dm: mmc: Avoid probing block devices in find_mmc_device()
We do not need to probe the block device here, so avoid doing so. The MMC device itself must be active, but the block device can come later. Signed-off-by: Simon Glass--- drivers/mmc/mmc-uclass.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c index 4dc3925fe6..994d2686f4 100644 --- a/drivers/mmc/mmc-uclass.c +++ b/drivers/mmc/mmc-uclass.c @@ -97,7 +97,7 @@ struct mmc *find_mmc_device(int dev_num) struct udevice *dev, *mmc_dev; int ret; - ret = blk_get_device(IF_TYPE_MMC, dev_num, ); + ret = blk_find_device(IF_TYPE_MMC, dev_num, ); if (ret) { #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT) @@ -108,7 +108,9 @@ struct mmc *find_mmc_device(int dev_num) mmc_dev = dev_get_parent(dev); - return mmc_get_mmc_dev(mmc_dev); + struct mmc *mmc = mmc_get_mmc_dev(mmc_dev); + + return mmc; } int get_mmc_num(void) -- 2.13.0.219.gdb65acc882-goog ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/3] dm: blk: Add a way to obtain a block device from its parent
Many devices support a child block device (e.g. MMC, USB). Add a convenient way to get this device given the parent device. Signed-off-by: Simon Glass--- drivers/block/blk-uclass.c | 26 ++ include/blk.h | 7 +++ test/dm/blk.c | 18 ++ 3 files changed, 51 insertions(+) diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c index 6145675271..23f131b7ad 100644 --- a/drivers/block/blk-uclass.c +++ b/drivers/block/blk-uclass.c @@ -453,6 +453,32 @@ int blk_prepare_device(struct udevice *dev) return 0; } +int blk_get_from_parent(struct udevice *parent, struct udevice **devp) +{ + struct udevice *dev; + enum uclass_id id; + int ret; + + device_find_first_child(parent, ); + if (!dev) { + debug("%s: No block device found for parent '%s'\n", __func__, + parent->name); + return -ENODEV; + } + id = device_get_uclass_id(dev); + if (id != UCLASS_BLK) { + debug("%s: Incorrect uclass %s for block device '%s'\n", + __func__, uclass_get_name(id), dev->name); + return -ENOTBLK; + } + ret = device_probe(dev); + if (ret) + return ret; + *devp = dev; + + return 0; +} + int blk_find_max_devnum(enum if_type if_type) { struct udevice *dev; diff --git a/include/blk.h b/include/blk.h index a128ee4841..4d60987f61 100644 --- a/include/blk.h +++ b/include/blk.h @@ -616,4 +616,11 @@ ulong blk_write_devnum(enum if_type if_type, int devnum, lbaint_t start, */ int blk_select_hwpart_devnum(enum if_type if_type, int devnum, int hwpart); +/** + * blk_get_from_parent() - obtain a block device by looking up its parent + * + * All devices with + */ +int blk_get_from_parent(struct udevice *parent, struct udevice **devp); + #endif diff --git a/test/dm/blk.c b/test/dm/blk.c index 5c5eb829a0..923e8d95f0 100644 --- a/test/dm/blk.c +++ b/test/dm/blk.c @@ -150,3 +150,21 @@ static int dm_test_blk_devnum(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_blk_devnum, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + +/* Test that we can get a block from its parent */ +static int dm_test_blk_get_from_parent(struct unit_test_state *uts) +{ + struct udevice *dev, *blk; + + ut_assertok(uclass_get_device(UCLASS_MMC, 0, )); + ut_assertok(blk_get_from_parent(dev, )); + + ut_assertok(uclass_get_device(UCLASS_I2C, 0, )); + ut_asserteq(-ENOTBLK, blk_get_from_parent(dev, )); + + ut_assertok(uclass_get_device(UCLASS_GPIO, 0, )); + ut_asserteq(-ENODEV, blk_get_from_parent(dev, )); + + return 0; +} +DM_TEST(dm_test_blk_get_from_parent, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); -- 2.13.0.219.gdb65acc882-goog ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 0/3] dm: mmc: Tidy up use of block devices
A recent series added a patch to avoid probing block devices in find_mmc_device(). This is because callers should obtain the block device itself, not the MMC device. But for now the environment code has not been converted. The patch caused problems on some boards so was dropped. This series reinstates that patch, but ensures that the block device is probed first. Simon Glass (3): dm: blk: Add a way to obtain a block device from its parent dm: mmc: Ensure that block device is probed dm: mmc: Avoid probing block devices in find_mmc_device() common/env_mmc.c | 7 ++- drivers/block/blk-uclass.c | 26 ++ drivers/mmc/mmc-uclass.c | 6 -- include/blk.h | 7 +++ test/dm/blk.c | 18 ++ 5 files changed, 61 insertions(+), 3 deletions(-) -- 2.13.0.219.gdb65acc882-goog ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/1] Kconfig: Add support for hash and sha1sum commands
From: Daniel ThompsonCurrently these (board agnostic) commands cannot be selected using menuconfig and friends. Fix this the obvious way. Signed-off-by: Daniel Thompson [trini: Re-apply, add imply for a few cases, run moveconfig.py] Signed-off-by: Tom Rini --- README | 11 --- arch/Kconfig| 1 + arch/arm/Kconfig| 1 + arch/arm/mach-exynos/Kconfig| 1 + cmd/Kconfig | 18 ++ configs/bcm958622hr_defconfig | 1 + include/configs/bcm_ep_board.h | 3 --- include/configs/exynos5-common.h| 3 --- include/configs/imx6qdl_icore.h | 1 - include/configs/imx6qdl_icore_rqs.h | 1 - include/configs/imx6ul_geam.h | 1 - include/configs/imx6ul_isiot.h | 1 - include/configs/sandbox.h | 2 -- include/hash.h | 4 scripts/config_whitelist.txt| 1 - 15 files changed, 22 insertions(+), 28 deletions(-) diff --git a/README b/README index 9d351ec5ad..f9931f6a6f 100644 --- a/README +++ b/README @@ -889,8 +889,6 @@ The following options need to be configured: CONFIG_CMD_SETGETDCR Support for DCR Register access (4xx only) CONFIG_CMD_SF * Read/write/erase SPI NOR flash - CONFIG_CMD_SHA1SUM * print sha1 memory digest - (requires CONFIG_CMD_MEMORY) CONFIG_CMD_SOFTSWITCH * Soft switch setting command for BF60x CONFIG_CMD_SOURCE "source" command Support CONFIG_CMD_SPI * SPI serial bus support @@ -2679,15 +2677,6 @@ The following options need to be configured: A better solution is to properly configure the firewall, but sometimes that is not allowed. -- Hashing support: - CONFIG_HASH_VERIFY - - Enable the hash verify command (hash -v). This adds to code - size a little. - - Note: There is also a sha1sum command, which should perhaps - be deprecated in favour of 'hash sha1'. - - bootcount support: CONFIG_BOOTCOUNT_LIMIT diff --git a/arch/Kconfig b/arch/Kconfig index 02e887ac86..6e291e7316 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -76,6 +76,7 @@ config SANDBOX imply CMD_IOTRACE imply LZMA imply CMD_LZMADEC + imply HASH_VERIFY config SH bool "SuperH architecture" diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 91f50b0637..0df99904a2 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -504,6 +504,7 @@ config TARGET_BCMCYGNUS bool "Support bcmcygnus" select CPU_V7 imply CMD_HASH + imply HASH_VERIFY config TARGET_BCMNSP bool "Support bcmnsp" diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig index 5b6c5ea328..9c5387e37a 100644 --- a/arch/arm/mach-exynos/Kconfig +++ b/arch/arm/mach-exynos/Kconfig @@ -19,6 +19,7 @@ config ARCH_EXYNOS5 select BOARD_EARLY_INIT_F select SHA_HW_ACCEL imply CMD_HASH + imply HASH_VERIFY help Samsung Exynos5 SoC family are based on ARM Cortex-A15 CPU (and Cortex-A7 CPU in big.LITTLE configuration). There are multiple SoCs diff --git a/cmd/Kconfig b/cmd/Kconfig index 5ee52f62cc..d3580ec779 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -417,6 +417,18 @@ config MD5SUM_VERFIY help Add -v option to verify data against an MD5 checksum. +config CMD_SHA1SUM + bool "sha1sum" + select SHA1 + help + Compute SHA1 checksum. + +config SHA1SUM_VERFIY + bool "sha1sum -v" + depends on CMD_SHA1SUM + help + Add -v option to verify data against an SHA1 checksum. + config LOOPW bool "loopw" help @@ -1068,6 +1080,12 @@ config CMD_HASH saved to memory or to an environment variable. It is also possible to verify a hash against data in memory. +config HASH_VERIFY + bool "hash -v" + depends on CMD_HASH + help + Add -v option to verify data against a hash. + config CMD_TPM bool "Enable the 'tpm' command" depends on TPM diff --git a/configs/bcm958622hr_defconfig b/configs/bcm958622hr_defconfig index c2713c61fa..69b9fe878b 100644 --- a/configs/bcm958622hr_defconfig +++ b/configs/bcm958622hr_defconfig @@ -14,6 +14,7 @@ CONFIG_CMD_ASKENV=y CONFIG_CMD_CACHE=y CONFIG_CMD_TIME=y CONFIG_CMD_HASH=y +CONFIG_HASH_VERIFY=y CONFIG_CMD_FAT=y # CONFIG_MMC is not set CONFIG_SYS_NS16550=y diff --git a/include/configs/bcm_ep_board.h b/include/configs/bcm_ep_board.h index 957cd9e0ba..53220491b8 100644 --- a/include/configs/bcm_ep_board.h +++ b/include/configs/bcm_ep_board.h @@ -66,9 +66,6 @@ /* Commands
Re: [U-Boot] [PATCH 4/8] usb: host: xhci-rockchip: add support for rk3328
On 2017/5/27 18:13, Marek Vasut wrote: On 05/27/2017 12:09 PM, rock-chips(daniel.meng) wrote: On 2017/5/27 16:38, Marek Vasut wrote: On 05/27/2017 09:44 AM, rock-chips(daniel.meng) wrote: On 2017/5/18 1:07, Marek Vasut wrote: On 05/17/2017 12:21 PM, Meng Dongyang wrote: Add the compatible "rockchip,rk3328-xhci" in match table for rk3328 to probe xhci controller. Turn off vbus when usb stop. Signed-off-by: Meng Dongyang--- drivers/usb/host/xhci-rockchip.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/host/xhci-rockchip.c b/drivers/usb/host/xhci-rockchip.c index f559830..8db92cb 100644 --- a/drivers/usb/host/xhci-rockchip.c +++ b/drivers/usb/host/xhci-rockchip.c @@ -168,6 +168,7 @@ static int xhci_usb_probe(struct udevice *dev) static int xhci_usb_remove(struct udevice *dev) { +struct rockchip_xhci_platdata *plat = dev_get_platdata(dev); struct rockchip_xhci *ctx = dev_get_priv(dev); int ret; @@ -178,11 +179,15 @@ static int xhci_usb_remove(struct udevice *dev) if (ret) return ret; +if (dm_gpio_is_valid(>vbus_gpio)) +dm_gpio_set_value(>vbus_gpio, 0); This should be a fixed regulator, then you don't have to mess with GPIOs directly. Indeed, this is better to be a fixed regulator. Yet other platforms still use GPIOs directly. So I must change the dts of the other platforms if change like this. Maybe it's better to change by another commit. This patch is only for turning off vbus when usb stop. How do you assure the polarity of this GPIO here though ? Anyway, turning this into regulator could be done in separate patch if this practice is already establish. I config the active voltageof gpio throw dts to assure the polarity. for example: vbus-gpio = < 27 GPIO_ACTIVE_HIGH>; The active voltage is configed to high, then if I call the function dm_gpio_set_value(>vbus_gpio, 1); the gpio output voltage will be high. So DM handles the polarity for you behind the scenes ? Yes, the polarity will be store in the struct of gpio_desc. Setting value function will change the actual value according to the polarity flag in gpio_desc. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 4/8] usb: host: xhci-rockchip: add support for rk3328
On 2017/5/27 16:38, Marek Vasut wrote: On 05/27/2017 09:44 AM, rock-chips(daniel.meng) wrote: On 2017/5/18 1:07, Marek Vasut wrote: On 05/17/2017 12:21 PM, Meng Dongyang wrote: Add the compatible "rockchip,rk3328-xhci" in match table for rk3328 to probe xhci controller. Turn off vbus when usb stop. Signed-off-by: Meng Dongyang--- drivers/usb/host/xhci-rockchip.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/host/xhci-rockchip.c b/drivers/usb/host/xhci-rockchip.c index f559830..8db92cb 100644 --- a/drivers/usb/host/xhci-rockchip.c +++ b/drivers/usb/host/xhci-rockchip.c @@ -168,6 +168,7 @@ static int xhci_usb_probe(struct udevice *dev) static int xhci_usb_remove(struct udevice *dev) { +struct rockchip_xhci_platdata *plat = dev_get_platdata(dev); struct rockchip_xhci *ctx = dev_get_priv(dev); int ret; @@ -178,11 +179,15 @@ static int xhci_usb_remove(struct udevice *dev) if (ret) return ret; +if (dm_gpio_is_valid(>vbus_gpio)) +dm_gpio_set_value(>vbus_gpio, 0); This should be a fixed regulator, then you don't have to mess with GPIOs directly. Indeed, this is better to be a fixed regulator. Yet other platforms still use GPIOs directly. So I must change the dts of the other platforms if change like this. Maybe it's better to change by another commit. This patch is only for turning off vbus when usb stop. How do you assure the polarity of this GPIO here though ? Anyway, turning this into regulator could be done in separate patch if this practice is already establish. I config the active voltageof gpio throw dts to assure the polarity. for example: vbus-gpio = < 27 GPIO_ACTIVE_HIGH>; The active voltage is configed to high, then if I call the function dm_gpio_set_value(>vbus_gpio, 1); the gpio output voltage will be high. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 4/8] usb: host: xhci-rockchip: add support for rk3328
On 2017/5/18 1:07, Marek Vasut wrote: On 05/17/2017 12:21 PM, Meng Dongyang wrote: Add the compatible "rockchip,rk3328-xhci" in match table for rk3328 to probe xhci controller. Turn off vbus when usb stop. Signed-off-by: Meng Dongyang--- drivers/usb/host/xhci-rockchip.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/host/xhci-rockchip.c b/drivers/usb/host/xhci-rockchip.c index f559830..8db92cb 100644 --- a/drivers/usb/host/xhci-rockchip.c +++ b/drivers/usb/host/xhci-rockchip.c @@ -168,6 +168,7 @@ static int xhci_usb_probe(struct udevice *dev) static int xhci_usb_remove(struct udevice *dev) { + struct rockchip_xhci_platdata *plat = dev_get_platdata(dev); struct rockchip_xhci *ctx = dev_get_priv(dev); int ret; @@ -178,11 +179,15 @@ static int xhci_usb_remove(struct udevice *dev) if (ret) return ret; + if (dm_gpio_is_valid(>vbus_gpio)) + dm_gpio_set_value(>vbus_gpio, 0); This should be a fixed regulator, then you don't have to mess with GPIOs directly. Indeed, this is better to be a fixed regulator. Yet other platforms still use GPIOs directly. So I must change the dts of the other platforms if change like this. Maybe it's better to change by another commit. This patch is only for turning off vbus when usb stop. + return 0; } static const struct udevice_id xhci_usb_ids[] = { { .compatible = "rockchip,rk3399-xhci" }, + { .compatible = "rockchip,rk3328-xhci" }, { } }; @@ -202,6 +207,7 @@ U_BOOT_DRIVER(usb_xhci) = { static const struct udevice_id usb_phy_ids[] = { { .compatible = "rockchip,rk3399-usb3-phy" }, + { .compatible = "rockchip,rk3328-usb3-phy" }, { } }; ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v1 4/8] rockchip: mkimage: rksd: pad SD/MMC images to a full blocksize
Hi Philipp, Simon: 2017-04-17 23:48 GMT+08:00 Philipp Tomsich < philipp.toms...@theobroma-systems.com>: > Signed-off-by: Philipp Tomsich> --- > > tools/rksd.c | 7 +-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/tools/rksd.c b/tools/rksd.c > index 6dafedf..8627b6d 100644 > --- a/tools/rksd.c > +++ b/tools/rksd.c > @@ -62,8 +62,11 @@ static int rksd_check_image_type(uint8_t type) > static int rksd_vrec_header(struct image_tool_params *params, > struct image_type_params *tparams) > { > - /* We don't add any additional padding after the end of the image > */ > - return rkcommon_vrec_header(params, tparams, 1); > + /* > +* Pad to the RK_BLK_SIZE (512 bytes) to be consistent with > init_size > +* being encoded in RK_BLK_SIZE units in header0 (see rkcommon.c). > +*/ > + return rkcommon_vrec_header(params, tparams, RK_BLK_SIZE); > This is another case that breaks BACK_TO_BROM function, as you documented in [1]: The init_size has to be a multiple of 4 blocks (i.e. of 2K) or the BootROM will not boot the image. So you need to pad the spl to 2kb aligned. [1]https://www.mail-archive.com/u-boot@lists.denx.de/msg245573.html > +* . > > > /* > -- > 1.9.1 > > ___ > U-Boot mailing list > U-Boot@lists.denx.de > https://lists.denx.de/listinfo/u-boot > ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v1 5/8] rockchip: mkimage: clarify header0 initialisation
Philipp, Simon: 2017-04-17 23:48 GMT+08:00 Philipp Tomsich < philipp.toms...@theobroma-systems.com>: > This change set adds documentation to the header0 initialisation and > improves readability for the calculations of various offsets/lengths. > > As the U-Boot SPL stage doesn't use any payload beyond what is covered > by init_size, we no longer add RK_MAX_BOOT_SIZE to init_boot_size. > I thinks this is one case that break BACK_TO_BROM function. The bootrom code will reads init_boot_size to get the size of the second level loader(such as uboot) to load from storage to sdram when the BACK_TO_BROM function enabled. This patch set init_boot_size to init_size, so the bootrom will think that there is no second level bootloader, so it won't load it and jump to it. > > Signed-off-by: Philipp Tomsich> --- > > tools/rkcommon.c | 20 +--- > 1 file changed, 17 insertions(+), 3 deletions(-) > > diff --git a/tools/rkcommon.c b/tools/rkcommon.c > index cfd40ac..ed29ef9 100644 > --- a/tools/rkcommon.c > +++ b/tools/rkcommon.c > @@ -13,6 +13,8 @@ > #include "mkimage.h" > #include "rkcommon.h" > > +#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) > + > enum { > RK_SIGNATURE= 0x0ff0aa55, > }; > @@ -159,9 +161,21 @@ static void rkcommon_set_header0(void *buf, uint > file_size, > hdr->disable_rc4 = !rkcommon_need_rc4_spl(params); > hdr->init_offset = RK_INIT_OFFSET; > > - hdr->init_size = (file_size + RK_BLK_SIZE - 1) / RK_BLK_SIZE; > - hdr->init_size = (hdr->init_size + 3) & ~3; > - hdr->init_boot_size = hdr->init_size + RK_MAX_BOOT_SIZE / > RK_BLK_SIZE; > + hdr->init_size = DIV_ROUND_UP(file_size, RK_BLK_SIZE); > + /* > +* The init_size has to be a multiple of 4 blocks (i.e. of 2K) > +* or the BootROM will not boot the image. > +* > +* Note: To verify that this is not a legacy constraint, we > +* rechecked this against the RK3399 BootROM. > +*/ > + hdr->init_size = ROUND(hdr->init_size, 4); > + /* > +* The images we create do not contain the stage following the SPL > as > +* part of the SPL image, so the init_boot_size (which might have > been > +* read by Rockchip's miniloder) should be the same as the > init_size. > +*/ > + hdr->init_boot_size = hdr->init_size; > > rc4_encode(buf, RK_BLK_SIZE, rc4_key); > } > -- > 1.9.1 > > ___ > U-Boot mailing list > U-Boot@lists.denx.de > https://lists.denx.de/listinfo/u-boot > ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Please pull u-boot-dm
Hi Tom, On 26 May 2017 at 10:16, Simon Glasswrote: > Hi Tom, > > On 26 May 2017 at 09:18, Tom Rini wrote: >> >> On Wed, May 24, 2017 at 06:19:04PM -0600, Simon Glass wrote: >> >> > Hi Tom, >> > >> > This is the first two of the livetree series as well as some >> > driver-model adjustments for MMC. >> > >> > It's up to you if you want to take this now, or wait. I will send a >> > new version of the 3rd livetree series later by early next week and am >> > happy to do this all at once if you prefer. On the other hand I don't >> > want to miss RC1 if I can help it. >> > >> > >> > The following changes since commit >> > be62fbf376261ab3a4ed5db3bf54d5df9e216d9f: >> > >> > Merge branch 'rmobile' of git://git.denx.de/u-boot-sh (2017-05-23 >> > 16:22:03 -0400) >> > >> > are available in the git repository at: >> > >> > git://git.denx.de/u-boot-dm.git >> > >> > for you to fetch changes up to 68dbdcb3cf8c59ab04b1b31d750fcee1e603e760: >> > >> > sandbox: Move to use live tree (2017-05-24 14:18:23 -0600) >> >> I bisected a boot time failure: >> U-Boot SPL 2017.05-00797-g137396d6249b (May 26 2017 - 11:08:31) >> DRA722-GP ES1.0 >> Trying to boot from MMC1 >> *** Warning - No MMC card found, using default environment >> >> reading u-boot.img >> reading u-boot.img >> reading u-boot.img >> reading u-boot.img >> >> >> U-Boot 2017.05-00797-g137396d6249b (May 26 2017 - 11:08:31 -0400) >> >> CPU : DRA722-GP ES1.0 >> Model: TI DRA722 >> Board: DRA72x EVM REV >> DRAM: 1 GiB >> MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1 >> ### ERROR ### Please RESET the board ### > > Where is this error coming from? Normally we would see the initcall > report a message. There are only a very few places where we can die > without a preceding message. > >> >> down to: >> >> commit 8e8cb1b3dd28404fa6d8fed316867185673f43ea >> Author: Simon Glass >> Date: Wed May 17 17:18:09 2017 -0600 >> >> dm: core: Replace of_offset with accessor (part 2) >> >> but don't quite know what would cause it to fail. > > Me neither, although I have stared at the code pretty hard for a while. > > Would it be possible for me to repeat this with beaglebone black? I'm > not sure what board you are using here. As suggested on IRC I tried this with BBB but no luck. It boots OK from a micro-SD card and MMC seems to work. Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] Please pull u-boot-fdt, take 2
Hi Tom, On 26 May 2017 at 06:49, Tom Riniwrote: > > On Thu, May 25, 2017 at 09:15:33PM -0600, Simon Glass wrote: > > Hi Tom, > > > > On 25 May 2017 at 11:42, Tom Rini wrote: > > > On Thu, May 25, 2017 at 11:27:10AM -0600, Simon Glass wrote: > > >> Hi Tom, > > >> > > >> On 25 May 2017 at 05:19, Tom Rini wrote: > > >> > > > >> > On Wed, May 24, 2017 at 06:15:25PM -0600, Simon Glass wrote: > > >> > > > >> > > Hi Tom, > > >> > > > > >> > > This incorporates the v2 patch for 'fdt: Build the new python libfdt > > >> > > module' which should fix the problem with the original pull request. > > >> > > > > >> > > > > >> > > The following changes since commit > > >> > > be62fbf376261ab3a4ed5db3bf54d5df9e216d9f: > > >> > > > > >> > > Merge branch 'rmobile' of git://git.denx.de/u-boot-sh (2017-05-23 > > >> > > 16:22:03 -0400) > > >> > > > > >> > > are available in the git repository at: > > >> > > > > >> > > git://git.denx.de/u-boot-fdt.git > > >> > > > > >> > > for you to fetch changes up to > > >> > > da9c601049eb7c993c7f6e33ae10af7a847a483d: > > >> > > > > >> > > fdt: Drop fdt_select.py (2017-05-24 18:12:31 -0600) > > >> > > > >> > NAK. travis-ci blows up quite badly: > > >> > https://travis-ci.org/trini/u-boot/builds/235861889 > > >> > > >> I'm not sure how to repeat this problem. When I try this: > > > > > > Your best bet is likely: > > > https://docs.travis-ci.com/user/common-build-problems/#Troubleshooting-Locally-in-a-Docker-Image > > > > Sadly still no luck. I installed this one: > > > > travisci/ci-garnet:packer-1478744932 > > > > It includes python-dev but not swig, so should not be able to build > > the module. As expected I get this error: > > > > NO_SDL=1 ./tools/buildman/buildman -P sandbox_spl > > boards.cfg is up to date. Nothing to do. > > Building current source for 1 boards (1 thread, 8 jobs per thread) > >sandbox: + sandbox_spl > > +Traceback (most recent call last): > > + File "", line 1, in > > +ImportError: No module named libfdt > > +make[2]: *** [checkdtoc] Error 1 > > +make[1]: *** [spl/u-boot-spl] Error 2 > > +make: *** [sub-make] Error 2 > > > > > > If I install swig then all is well. I don't see the same error. > > > > I'm also unsure how you get it to pass with some boards but not others... > > > > There is obviously something odd going on. I also cannot understand > > why in this one: > > > > https://travis-ci.org/trini/u-boot/jobs/235861899#L769 > > > > I see it trying to compile libfdt_wrap.c. That should be handled by > > setup.py - I just cannot figure out why it would try to compile it > > itself: > > > > arm: + mx6sabresd_spl > > +mv: cannot stat lib/libfdt/pylibfdt/libfdt.py: No such file or directory > > +make[2]: *** [tools/_libfdt.so] Error 1 > > +make[1]: *** [tools] Error 2 > > +make: *** [sub-make] Error 2 > > arm: + ls1021aqds_nor_lpuart > > +x86_64-linux-gnu-gcc: error: lib/libfdt/pylibfdt/libfdt_wrap.c: No > > such file or directory > > +x86_64-linux-gnu-gcc: fatal error: no input files > > +compilation terminated. > > +error: command 'x86_64-linux-gnu-gcc' failed with exit status 4 > > +make[2]: *** [tools/_libfdt.so] Error 1 > > +make[1]: *** [tools] Error 2 > > +make: *** [sub-make] Error 2 > > arm: + mx6slevk > > +x86_64-linux-gnu-gcc: error: lib/libfdt/pylibfdt/libfdt_wrap.c: No > > such file or directory > > +x86_64-linux-gnu-gcc: fatal error: no input files > > +compilation terminated. > > +error: command 'x86_64-linux-gnu-gcc' failed with exit status 4 > > +make[2]: *** [tools/_libfdt.so] Error 1 > > +make[1]: *** [tools] Error 2 > > +make: *** [sub-make] Error 2 > > 5503 /58 mx6qsabreauto > > boards.cfg is up to date. Nothing to do. > > Summary of current source for 58 boards (2 threads, 1 job per thread) > > arm: + mx6sabresd_spl ls1021aqds_nor_lpuart mx6slevk > > +mv: cannot stat lib/libfdt/pylibfdt/libfdt.py: No such file or directory > > > > > > Are you able to run with V=1 to get the full make output? That might > > help me narrow it down. Or, if you have a particular docket image, > > please point me to it. There seems to be some init going on though > > (e.g. /tmp/dtc). > > Anyone can use travis-ci :) In the past I've had some luck debugging > these issues (since I didn't want to mess with docker) by hacking up the > .travis.yml file to just have a single matrix entry for whatever I was > debugging and hack things as needed, including 'cat'ing files. OK I found that with the prerequisites installed I can repeat this with something like: buildman -P sandbox (which only builds 3 boards) The problem is that setup.py is writing to the source directory. It seems to be hard to stop it doing that. I was aware of it but did not imagine the race condition it would create. I've updated the patches and sent v3. I have a passing run on travis-ci [1]. If all looks good I'll pull it in and try a take three early next week. Most of my
[U-Boot] [PATCH v3 16/20] fdt: Drop fdt_fallback library
Drop this now-unused library and associated tests. Signed-off-by: Simon Glass--- Changes in v3: None Changes in v2: None tools/binman/fdt_test.py | 10 --- tools/binman/func_test.py | 42 --- tools/dtoc/fdt.py | 4 +- tools/dtoc/fdt_fallback.py | 181 - tools/dtoc/fdt_select.py | 24 +- 5 files changed, 18 insertions(+), 243 deletions(-) delete mode 100644 tools/dtoc/fdt_fallback.py diff --git a/tools/binman/fdt_test.py b/tools/binman/fdt_test.py index 65fb947386..df2b0a6af7 100644 --- a/tools/binman/fdt_test.py +++ b/tools/binman/fdt_test.py @@ -82,13 +82,3 @@ class TestFdt(unittest.TestCase): self.assertEquals(list, type(prop.value)) self.assertEquals(3, len(prop.value)) self.assertEquals(['another', 'multi-word', 'message'], prop.value) - -def testFdtFallback(self): -fname = self.GetCompiled('34_x86_ucode.dts') -dt = FdtScan(fname, True) -dt.GetProp('/microcode/update@0', 'data') -self.assertEqual('fred', -dt.GetProp('/microcode/update@0', 'none', default='fred')) -self.assertEqual('12345678 12345679', -dt.GetProp('/microcode/update@0', 'data', typespec='x')) -self._DeleteProp(dt) diff --git a/tools/binman/func_test.py b/tools/binman/func_test.py index 740fa9e4e2..7328d03b5c 100644 --- a/tools/binman/func_test.py +++ b/tools/binman/func_test.py @@ -683,7 +683,7 @@ class TestFunctional(unittest.TestCase): self.assertEqual('nodtb with microcode' + pos_and_size + ' somewhere in here', first) -def _RunPackUbootSingleMicrocode(self, collate): +def _RunPackUbootSingleMicrocode(self): """Test that x86 microcode can be handled correctly We expect to see the following in the image, in order: @@ -695,8 +695,6 @@ class TestFunctional(unittest.TestCase): # We need the libfdt library to run this test since only that allows # finding the offset of a property. This is required by # Entry_u_boot_dtb_with_ucode.ObtainContents(). -if not fdt_select.have_libfdt: -return data = self._DoReadFile('35_x86_single_ucode.dts', True) second = data[len(U_BOOT_NODTB_DATA):] @@ -705,34 +703,22 @@ class TestFunctional(unittest.TestCase): third = second[fdt_len:] second = second[:fdt_len] -if not collate: -ucode_data = struct.pack('>2L', 0x12345678, 0x12345679) -self.assertIn(ucode_data, second) -ucode_pos = second.find(ucode_data) + len(U_BOOT_NODTB_DATA) +ucode_data = struct.pack('>2L', 0x12345678, 0x12345679) +self.assertIn(ucode_data, second) +ucode_pos = second.find(ucode_data) + len(U_BOOT_NODTB_DATA) -# Check that the microcode pointer was inserted. It should match the -# expected position and size -pos_and_size = struct.pack('<2L', 0xfe00 + ucode_pos, -len(ucode_data)) -first = data[:len(U_BOOT_NODTB_DATA)] -self.assertEqual('nodtb with microcode' + pos_and_size + -' somewhere in here', first) +# Check that the microcode pointer was inserted. It should match the +# expected position and size +pos_and_size = struct.pack('<2L', 0xfe00 + ucode_pos, + len(ucode_data)) +first = data[:len(U_BOOT_NODTB_DATA)] +self.assertEqual('nodtb with microcode' + pos_and_size + + ' somewhere in here', first) def testPackUbootSingleMicrocode(self): """Test that x86 microcode can be handled correctly with fdt_normal. """ -self._RunPackUbootSingleMicrocode(False) - -def testPackUbootSingleMicrocodeFallback(self): -"""Test that x86 microcode can be handled correctly with fdt_fallback. - -This only supports collating the microcode. -""" -try: -old_val = fdt_select.UseFallback(True) -self._RunPackUbootSingleMicrocode(True) -finally: -fdt_select.UseFallback(old_val) +self._RunPackUbootSingleMicrocode() def testUBootImg(self): """Test that u-boot.img can be put in a file""" @@ -763,14 +749,12 @@ class TestFunctional(unittest.TestCase): def testMicrocodeWithoutPtrInElf(self): """Test that a U-Boot binary without the microcode symbol is detected""" # ELF file without a '_dt_ucode_base_size' symbol -if not fdt_select.have_libfdt: -return try: with open(self.TestFile('u_boot_no_ucode_ptr')) as fd: TestFunctional._MakeInputFile('u-boot', fd.read()) with self.assertRaises(ValueError) as e: -self._RunPackUbootSingleMicrocode(False) +
[U-Boot] [PATCH v3 13/20] fdt: Makefile: Build python libfdt library if needed
This is needed by binman and dtoc, so if those are being used, check that the library is present and complain if not. This means that the fallback library (which uses fdtget) will not be used anymore and swig will need to be installed to use binman / dtoc. This affects any board which uses binman (currently sunxi and x86) or dtoc (anything that uses CONFIG_SPL_OF_PLATDATA, currently some rockchip boards). Signed-off-by: Simon Glass--- Changes in v3: None Changes in v2: None Makefile | 16 ++-- scripts/Makefile.spl | 17 + 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 1b7cab2121..89e0451a49 100644 --- a/Makefile +++ b/Makefile @@ -1116,7 +1116,7 @@ cmd_ldr = $(LD) $(LDFLAGS_$(@F)) \ u-boot.rom: u-boot-x86-16bit.bin u-boot.bin \ $(if $(CONFIG_SPL_X86_16BIT_INIT),spl/u-boot-spl.bin) \ - $(if $(CONFIG_HAVE_REFCODE),refcode.bin) FORCE + $(if $(CONFIG_HAVE_REFCODE),refcode.bin) checkbinman FORCE $(call if_changed,binman) OBJCOPYFLAGS_u-boot-x86-16bit.bin := -O binary -j .start16 -j .resetvec @@ -1125,7 +1125,8 @@ u-boot-x86-16bit.bin: u-boot FORCE endif ifneq ($(CONFIG_ARCH_SUNXI),) -u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img u-boot.dtb FORCE +u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img u-boot.dtb \ + checkbinman FORCE $(call if_changed,binman) endif @@ -1354,6 +1355,17 @@ $(version_h): include/config/uboot.release FORCE $(timestamp_h): $(srctree)/Makefile FORCE $(call filechk,timestamp.h) +checkbinman: tools + @if ! ( echo 'import libfdt' | ( PYTHONPATH=tools python )); then \ + echo '*** binman needs the Python libfdt library. Either '; \ + echo '*** install it on your system, or try:'; \ + echo '***'; \ + echo '*** sudo apt-get install swig libpython-dev'; \ + echo '***'; \ + echo '*** to have U-Boot build its own version.'; \ + false; \ + fi + # --- quiet_cmd_cpp_lds = LDS $@ cmd_cpp_lds = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) \ diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index 135706f21d..ac3c2c7f13 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -257,14 +257,12 @@ PHONY += dts_dir dts_dir: $(shell [ -d $(obj)/dts ] || mkdir -p $(obj)/dts) -include/generated/dt-structs.h: $(obj)/$(SPL_BIN).dtb dts_dir dtoc +include/generated/dt-structs.h: $(obj)/$(SPL_BIN).dtb dts_dir checkdtoc $(call if_changed,dtoch) -$(obj)/dts/dt-platdata.c: $(obj)/$(SPL_BIN).dtb dts_dir dtoc +$(obj)/dts/dt-platdata.c: $(obj)/$(SPL_BIN).dtb dts_dir checkdtoc $(call if_changed,dtocc) -dtoc: #$(objtree)/tools/_libfdt.so - ifdef CONFIG_SAMSUNG ifdef CONFIG_VAR_SIZE_SPL VAR_SIZE_PARAM = --vs @@ -357,6 +355,17 @@ ifneq ($(cmd_files),) include $(cmd_files) endif +checkdtoc: tools + @if ! ( echo 'import libfdt' | ( PYTHONPATH=tools python )); then \ + echo '*** dtoc needs the Python libfdt library. Either '; \ + echo '*** install it on your system, or try:'; \ + echo '***'; \ + echo '*** sudo apt-get install swig libpython-dev'; \ + echo '***'; \ + echo '*** to have U-Boot build its own version.'; \ + false; \ + fi + PHONY += FORCE FORCE: -- 2.13.0.219.gdb65acc882-goog ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 14/20] fdt: Stop building the old python libfdt module
This is no-longer needed, so stop building it. Signed-off-by: Simon Glass--- Changes in v3: None Changes in v2: None lib/libfdt/libfdt_legacy.swig | 112 -- lib/libfdt/setup.py | 38 -- tools/Makefile| 18 --- 3 files changed, 168 deletions(-) delete mode 100644 lib/libfdt/libfdt_legacy.swig delete mode 100644 lib/libfdt/setup.py diff --git a/lib/libfdt/libfdt_legacy.swig b/lib/libfdt/libfdt_legacy.swig deleted file mode 100644 index 9880dd998e..00 --- a/lib/libfdt/libfdt_legacy.swig +++ /dev/null @@ -1,112 +0,0 @@ -%module libfdt_legacy - -%{ -#define SWIG_FILE_WITH_INIT -#include "libfdt.h" -%} - -%pythoncode %{ -def Raise(errnum): -raise ValueError('Error %s' % fdt_strerror(errnum)) - -def Name(fdt, offset): -name, len = fdt_get_name(fdt, offset) -return name - -def String(fdt, offset): -offset = fdt32_to_cpu(offset) -name = fdt_string(fdt, offset) -return name - -def swap32(x): -return (((x << 24) & 0xFF00) | -((x << 8) & 0x00FF) | -((x >> 8) & 0xFF00) | -((x >> 24) & 0x00FF)) - -def fdt32_to_cpu(x): -return swap32(x) - -def Data(prop): -set_prop(prop) -return get_prop_data() -%} - -%include "typemaps.i" -%include "cstring.i" - -%typemap(in) void* = char*; - -typedef int fdt32_t; - -struct fdt_property { -fdt32_t tag; -fdt32_t len; -fdt32_t nameoff; -char data[0]; -}; - -/* - * This is a work-around since I'm not sure of a better way to copy out the - * contents of a string. This is used in dtoc/GetProps(). The intent is to - * pass in a pointer to a property and access the data field at the end of - * it. Ideally the Data() function above would be able to do this directly, - * but I'm not sure how to do that. - */ -#pragma SWIG nowarn=454 -%inline %{ -static struct fdt_property *cur_prop; - -void set_prop(struct fdt_property *prop) { -cur_prop = prop; -} -%} - -%cstring_output_allocate_size(char **s, int *sz, free(*$1)); -%inline %{ -void get_prop_data(char **s, int *sz) { -*sz = fdt32_to_cpu(cur_prop->len); -*s = (char *)malloc(*sz); -if (!*s) -*sz = 0; -else -memcpy(*s, cur_prop + 1, *sz); -} -%} - -%typemap(in) (const void *) { - if (!PyByteArray_Check($input)) { -SWIG_exception_fail(SWIG_TypeError, "in method '" "$symname" "', argument " - "$argnum"" of type '" "$type""'"); - } - $1 = (void *) PyByteArray_AsString($input); -} - -const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int checklen); -int fdt_path_offset(const void *fdt, const char *path); -int fdt_first_property_offset(const void *fdt, int nodeoffset); -int fdt_next_property_offset(const void *fdt, int offset); -const char *fdt_strerror(int errval); -const struct fdt_property *fdt_get_property_by_offset(const void *fdt, - int offset, - int *OUTPUT); -const char *fdt_get_name(const void *fdt, int nodeoffset, int *OUTPUT); -const char *fdt_string(const void *fdt, int stroffset); -int fdt_first_subnode(const void *fdt, int offset); -int fdt_next_subnode(const void *fdt, int offset); - -%typemap(in) (void *) { - if (!PyByteArray_Check($input)) { -SWIG_exception_fail(SWIG_TypeError, "in method '" "$symname" "', argument " - "$argnum"" of type '" "$type""'"); - } - $1 = PyByteArray_AsString($input); -} - -int fdt_delprop(void *fdt, int nodeoffset, const char *name); - -const char *fdt_strerror(int errval); -int fdt_pack(void *fdt); - -int fdt_totalsize(const void *fdt); -int fdt_off_dt_struct(const void *fdt); diff --git a/lib/libfdt/setup.py b/lib/libfdt/setup.py deleted file mode 100644 index fc881351c6..00 --- a/lib/libfdt/setup.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env python - -""" -setup.py file for SWIG libfdt -""" - -from distutils.core import setup, Extension -import os -import sys - -# Don't cross-compile - always use the host compiler. -del os.environ['CROSS_COMPILE'] -del os.environ['CC'] - -progname = sys.argv[0] -cflags = sys.argv[1] -files = sys.argv[2:] - -if cflags: -cflags = [flag for flag in cflags.split(' ') if flag] -else: -cflags = None - -libfdt_module = Extension( -'_libfdt_legacy', -sources = files, -extra_compile_args = cflags -) - -sys.argv = [progname, '--quiet', 'build_ext', '--inplace', '--force'] - -setup (name = 'libfdt_legaacy', - version = '0.1', - author = "SWIG Docs", - description = """Simple swig libfdt from docs""", - ext_modules = [libfdt_module], - py_modules = ["libfdt_legacy"], - ) diff --git a/tools/Makefile b/tools/Makefile index bc411e4ae4..cb1683e153 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -141,24 +141,6 @@
[U-Boot] [PATCH v3 18/20] fdt: Merge fdt_normal with its base class
Since we only have one Fdt implementation now we don't need to have a base class. Merge the implementation and the base class together. Signed-off-by: Simon Glass--- Changes in v3: None Changes in v2: None tools/dtoc/fdt.py| 176 +++- tools/dtoc/fdt_normal.py | 226 --- tools/dtoc/fdt_select.py | 8 +- 3 files changed, 157 insertions(+), 253 deletions(-) delete mode 100644 tools/dtoc/fdt_normal.py diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py index dedd3d7501..bff31d1c92 100644 --- a/tools/dtoc/fdt.py +++ b/tools/dtoc/fdt.py @@ -10,12 +10,15 @@ import struct import sys import fdt_util +import libfdt # This deals with a device tree, presenting it as an assortment of Node and # Prop objects, representing nodes and properties, respectively. This file -# contains the base classes and defines the high-level API. Most of the -# implementation is in the FdtNormal subclass. See fdt_select.py for how to -# create an Fdt object. +# contains the base classes and defines the high-level API. See fdt_select.py +# for how to create an Fdt object. + +# This implementation uses a libfdt Python library to access the device tree, +# so it is fairly efficient. # A list of types we support (TYPE_BYTE, TYPE_INT, TYPE_STRING, TYPE_BOOL) = range(4) @@ -25,7 +28,7 @@ def CheckErr(errnum, msg): raise ValueError('Error %d: %s: %s' % (errnum, libfdt.fdt_strerror(errnum), msg)) -class PropBase: +class Prop: """A device tree property Properties: @@ -34,11 +37,17 @@ class PropBase: bytes type: Value type """ -def __init__(self, node, offset, name): +def __init__(self, node, offset, name, bytes): self._node = node self._offset = offset self.name = name self.value = None +self.bytes = str(bytes) +if not bytes: +self.type = TYPE_BOOL +self.value = True +return +self.type, self.value = self.BytesToValue(bytes) def GetPhandle(self): """Get a (single) phandle value from a property @@ -148,15 +157,12 @@ class PropBase: def GetOffset(self): """Get the offset of a property -This can be implemented by subclasses. - Returns: -The offset of the property (struct fdt_property) within the -file, or None if not known. +The offset of the property (struct fdt_property) within the file """ -return None +return self._node._fdt.GetStructOffset(self._offset) -class NodeBase: +class Node: """A device tree node Properties: @@ -189,25 +195,65 @@ class NodeBase: return subnode return None +def Offset(self): +"""Returns the offset of a node, after checking the cache + +This should be used instead of self._offset directly, to ensure that +the cache does not contain invalid offsets. +""" +self._fdt.CheckCache() +return self._offset + def Scan(self): -"""Scan the subnodes of a node +"""Scan a node's properties and subnodes + +This fills in the props and subnodes properties, recursively +searching into subnodes so that the entire tree is built. +""" +self.props = self._fdt.GetProps(self) + +offset = libfdt.fdt_first_subnode(self._fdt.GetFdt(), self.Offset()) +while offset >= 0: +sep = '' if self.path[-1] == '/' else '/' +name = self._fdt._fdt_obj.get_name(offset) +path = self.path + sep + name +node = Node(self._fdt, offset, name, path) +self.subnodes.append(node) -This should be implemented by subclasses +node.Scan() +offset = libfdt.fdt_next_subnode(self._fdt.GetFdt(), offset) + +def Refresh(self, my_offset): +"""Fix up the _offset for each node, recursively + +Note: This does not take account of property offsets - these will not +be updated. """ -raise NotImplementedError() +if self._offset != my_offset: +#print '%s: %d -> %d\n' % (self.path, self._offset, my_offset) +self._offset = my_offset +offset = libfdt.fdt_first_subnode(self._fdt.GetFdt(), self._offset) +for subnode in self.subnodes: +subnode.Refresh(offset) +offset = libfdt.fdt_next_subnode(self._fdt.GetFdt(), offset) def DeleteProp(self, prop_name): """Delete a property of a node -This should be implemented by subclasses +The property is deleted and the offset cache is invalidated. Args: prop_name: Name of the property to delete +Raises: +ValueError if the property does not exist """ -raise NotImplementedError() +
[U-Boot] [PATCH v3 17/20] binman: Drop a special case related to fdt_fallback
Previously we were sometimes forced to collate x86 microcode due to not having access to the offset of each individual piece. Now that we never use fdt_fallback, we don't have this problem. Drop this special case from the code. Signed-off-by: Simon Glass--- Changes in v3: None Changes in v2: None tools/binman/etype/u_boot_dtb_with_ucode.py | 13 - 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/tools/binman/etype/u_boot_dtb_with_ucode.py b/tools/binman/etype/u_boot_dtb_with_ucode.py index fc02c67c14..95405c6473 100644 --- a/tools/binman/etype/u_boot_dtb_with_ucode.py +++ b/tools/binman/etype/u_boot_dtb_with_ucode.py @@ -57,17 +57,12 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob): data_prop = node.props.get('data') if data_prop: self.ucode_data += ''.join(data_prop.bytes) -if not self.collate: -poffset = data_prop.GetOffset() -if poffset is None: -# We cannot obtain a property offset. Collate instead. -self.collate = True -else: -# Find the offset in the device tree of the ucode data -self.ucode_offset = poffset + 12 -self.ucode_size = len(data_prop.bytes) if self.collate: prop = node.DeleteProp('data') +else: +# Find the offset in the device tree of the ucode data +self.ucode_offset = data_prop.GetOffset() + 12 +self.ucode_size = len(data_prop.bytes) if self.collate: fdt.Pack() fdt.Flush() -- 2.13.0.219.gdb65acc882-goog ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 19/20] binman: Rename fdt variable to dtb
Since fdt is the name of a module, use a different name for variables to avoid a conflict. Signed-off-by: Simon Glass--- Changes in v3: None Changes in v2: None tools/binman/control.py | 10 +- tools/binman/etype/u_boot_dtb_with_ucode.py | 9 - tools/binman/func_test.py | 4 ++-- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/tools/binman/control.py b/tools/binman/control.py index e90967807c..42d75efbcd 100644 --- a/tools/binman/control.py +++ b/tools/binman/control.py @@ -40,15 +40,15 @@ def _ReadImageDesc(binman_node): images['image'] = Image('image', binman_node) return images -def _FindBinmanNode(fdt): +def _FindBinmanNode(dtb): """Find the 'binman' node in the device tree Args: -fdt: Fdt object to scan +dtb: Fdt object to scan Returns: Node object of /binman node, or None if not found """ -for node in fdt.GetRoot().subnodes: +for node in dtb.GetRoot().subnodes: if node.name == 'binman': return node return None @@ -92,8 +92,8 @@ def Binman(options, args): try: tools.SetInputDirs(options.indir) tools.PrepareOutputDir(options.outdir, options.preserve) -fdt = fdt_select.FdtScan(dtb_fname) -node = _FindBinmanNode(fdt) +dtb = fdt.FdtScan(dtb_fname) +node = _FindBinmanNode(dtb) if not node: raise ValueError("Device tree '%s' does not have a 'binman' " "node" % dtb_fname) diff --git a/tools/binman/etype/u_boot_dtb_with_ucode.py b/tools/binman/etype/u_boot_dtb_with_ucode.py index 95405c6473..01ee36fb0d 100644 --- a/tools/binman/etype/u_boot_dtb_with_ucode.py +++ b/tools/binman/etype/u_boot_dtb_with_ucode.py @@ -44,9 +44,8 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob): fd.write(self.data) # Remove the microcode -fdt = fdt_select.FdtScan(fname) -fdt.Scan() -ucode = fdt.GetNode('/microcode') +dtb = fdt.FdtScan(fname) +ucode = dtb.GetNode('/microcode') if not ucode: raise self.Raise("No /microcode node found in '%s'" % fname) @@ -64,8 +63,8 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob): self.ucode_offset = data_prop.GetOffset() + 12 self.ucode_size = len(data_prop.bytes) if self.collate: -fdt.Pack() -fdt.Flush() +dtb.Pack() +dtb.Flush() # Make this file the contents of this entry self._pathname = fname diff --git a/tools/binman/func_test.py b/tools/binman/func_test.py index 7328d03b5c..8960e23f2c 100644 --- a/tools/binman/func_test.py +++ b/tools/binman/func_test.py @@ -658,8 +658,8 @@ class TestFunctional(unittest.TestCase): fname = tools.GetOutputFilename('test.dtb') with open(fname, 'wb') as fd: fd.write(second) -fdt = fdt_select.FdtScan(fname) -ucode = fdt.GetNode('/microcode') +dtb = fdt.FdtScan(fname) +ucode = dtb.GetNode('/microcode') self.assertTrue(ucode) for node in ucode.subnodes: self.assertFalse(node.props.get('data')) -- 2.13.0.219.gdb65acc882-goog ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 12/20] fdt: Support use of the new python libfdt library
Use the new library if available, while retaining backwards compatibility with the old library for now. Signed-off-by: Simon Glass--- Changes in v3: - Drop changes which are now in any earlier patch Changes in v2: None tools/binman/binman.py | 3 +++ tools/dtoc/fdt.py| 1 + tools/dtoc/fdt_normal.py | 35 ++- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/tools/binman/binman.py b/tools/binman/binman.py index 857d698b4c..95d3a048d8 100755 --- a/tools/binman/binman.py +++ b/tools/binman/binman.py @@ -21,6 +21,9 @@ sys.path.append(os.path.join(our_path, '../patman')) sys.path.append(os.path.join(our_path, '../dtoc')) sys.path.append(os.path.join(our_path, '../')) +# Bring in the libfdt module +sys.path.append('tools') + # Also allow entry-type modules to be brought in from the etype directory. sys.path.append(os.path.join(our_path, 'etype')) diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py index 816fdbe525..c40b9b6bab 100644 --- a/tools/dtoc/fdt.py +++ b/tools/dtoc/fdt.py @@ -96,6 +96,7 @@ class PropBase: TYPE_INT: a byte-swapped integer stored as a 4-byte string TYPE_BYTE: a byte stored as a single-byte string """ +bytes = str(bytes) size = len(bytes) strings = bytes.split('\0') is_string = True diff --git a/tools/dtoc/fdt_normal.py b/tools/dtoc/fdt_normal.py index 17b0a9a726..e793f49fa8 100644 --- a/tools/dtoc/fdt_normal.py +++ b/tools/dtoc/fdt_normal.py @@ -12,7 +12,13 @@ import sys import fdt from fdt import Fdt, NodeBase, PropBase import fdt_util -import libfdt_legacy as libfdt +try: +import libfdt +legacy = False +except ImportError: +import libfdt_legacy as libfdt +legacy = True + # This deals with a device tree, presenting it as a list of Node and Prop # objects, representing nodes and properties, respectively. @@ -36,7 +42,7 @@ class Prop(PropBase): """ def __init__(self, node, offset, name, bytes): PropBase.__init__(self, node, offset, name) -self.bytes = bytes +self.bytes = str(bytes) if not bytes: self.type = fdt.TYPE_BOOL self.value = True @@ -86,7 +92,10 @@ class Node(NodeBase): offset = libfdt.fdt_first_subnode(self._fdt.GetFdt(), self.Offset()) while offset >= 0: sep = '' if self.path[-1] == '/' else '/' -name = libfdt.Name(self._fdt.GetFdt(), offset) +if legacy: +name = libfdt.Name(self._fdt.GetFdt(), offset) +else: +name = self._fdt._fdt_obj.get_name(offset) path = self.path + sep + name node = Node(self._fdt, offset, name, path) self.subnodes.append(node) @@ -139,6 +148,8 @@ class FdtNormal(Fdt): with open(self._fname) as fd: self._fdt = bytearray(fd.read()) +if not legacy: +self._fdt_obj = libfdt.Fdt(self._fdt) def GetFdt(self): """Get the contents of the FDT @@ -175,12 +186,18 @@ class FdtNormal(Fdt): props_dict = {} poffset = libfdt.fdt_first_property_offset(self._fdt, node._offset) while poffset >= 0: -dprop, plen = libfdt.fdt_get_property_by_offset(self._fdt, poffset) -prop = Prop(node, poffset, libfdt.String(self._fdt, dprop.nameoff), -libfdt.Data(dprop)) -props_dict[prop.name] = prop - -poffset = libfdt.fdt_next_property_offset(self._fdt, poffset) +if legacy: +dprop, plen = libfdt.fdt_get_property_by_offset(self._fdt, +poffset) +prop = Prop(node, poffset, +libfdt.String(self._fdt, dprop.nameoff), +libfdt.Data(dprop)) +else: +p = self._fdt_obj.get_property_by_offset(poffset) +prop = Prop(node, poffset, p.name, p.value) +props_dict[prop.name] = prop + +poffset = libfdt.fdt_next_property_offset(self._fdt, poffset) return props_dict def Invalidate(self): -- 2.13.0.219.gdb65acc882-goog ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 11/20] fdt: dtoc: Add a full set of property tests
The tests don't currently cover all the different property types. Add a new test which checks each property type in turn, to make sure each has the correct type and value. Signed-off-by: Simon Glass--- Changes in v3: None Changes in v2: None tools/binman/fdt_test.py | 46 ++ tools/binman/test/45_prop_test.dts | 23 +++ 2 files changed, 69 insertions(+) create mode 100644 tools/binman/test/45_prop_test.dts diff --git a/tools/binman/fdt_test.py b/tools/binman/fdt_test.py index 12edeaba6c..65fb947386 100644 --- a/tools/binman/fdt_test.py +++ b/tools/binman/fdt_test.py @@ -11,6 +11,7 @@ import sys import tempfile import unittest +import fdt from fdt_select import FdtScan import fdt_util import tools @@ -37,6 +38,51 @@ class TestFdt(unittest.TestCase): dt = FdtScan(fname) self._DeleteProp(dt) +def testFdtNormalProp(self): +fname = self.GetCompiled('45_prop_test.dts') +dt = FdtScan(fname) +node = dt.GetNode('/binman/intel-me') +self.assertEquals('intel-me', node.name) +val = fdt_util.GetString(node, 'filename') +self.assertEquals(str, type(val)) +self.assertEquals('me.bin', val) + +prop = node.props['intval'] +self.assertEquals(fdt.TYPE_INT, prop.type) +self.assertEquals(3, fdt_util.GetInt(node, 'intval')) + +prop = node.props['intarray'] +self.assertEquals(fdt.TYPE_INT, prop.type) +self.assertEquals(list, type(prop.value)) +self.assertEquals(2, len(prop.value)) +self.assertEquals([5, 6], + [fdt_util.fdt32_to_cpu(val) for val in prop.value]) + +prop = node.props['byteval'] +self.assertEquals(fdt.TYPE_BYTE, prop.type) +self.assertEquals(chr(8), prop.value) + +prop = node.props['bytearray'] +self.assertEquals(fdt.TYPE_BYTE, prop.type) +self.assertEquals(list, type(prop.value)) +self.assertEquals(str, type(prop.value[0])) +self.assertEquals(3, len(prop.value)) +self.assertEquals([chr(1), '#', '4'], prop.value) + +prop = node.props['longbytearray'] +self.assertEquals(fdt.TYPE_INT, prop.type) +self.assertEquals(0x090a0b0c, fdt_util.GetInt(node, 'longbytearray')) + +prop = node.props['stringval'] +self.assertEquals(fdt.TYPE_STRING, prop.type) +self.assertEquals('message2', fdt_util.GetString(node, 'stringval')) + +prop = node.props['stringarray'] +self.assertEquals(fdt.TYPE_STRING, prop.type) +self.assertEquals(list, type(prop.value)) +self.assertEquals(3, len(prop.value)) +self.assertEquals(['another', 'multi-word', 'message'], prop.value) + def testFdtFallback(self): fname = self.GetCompiled('34_x86_ucode.dts') dt = FdtScan(fname, True) diff --git a/tools/binman/test/45_prop_test.dts b/tools/binman/test/45_prop_test.dts new file mode 100644 index 00..d22e460d29 --- /dev/null +++ b/tools/binman/test/45_prop_test.dts @@ -0,0 +1,23 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + sort-by-pos; + end-at-4gb; + size = <16>; + intel-me { + filename = "me.bin"; + pos-unset; + intval = <3>; + intarray = <5 6>; + byteval = [08]; + bytearray = [01 23 34]; + longbytearray = [09 0a 0b 0c]; + stringval = "message2"; + stringarray = "another", "multi-word", "message"; + }; + }; +}; -- 2.13.0.219.gdb65acc882-goog ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 20/20] fdt: Drop fdt_select.py
This file was used to select between the normal and fallback libfdt implementations. Now that we only have one, it is not needed. Drop it and fix up all users. Signed-off-by: Simon Glass--- Changes in v3: None Changes in v2: None tools/binman/control.py | 2 +- tools/binman/etype/u_boot_dtb_with_ucode.py | 2 +- tools/binman/fdt_test.py| 2 +- tools/binman/func_test.py | 2 +- tools/dtoc/dtoc.py | 3 +-- tools/dtoc/fdt.py | 10 -- tools/dtoc/fdt_select.py| 16 7 files changed, 13 insertions(+), 24 deletions(-) delete mode 100644 tools/dtoc/fdt_select.py diff --git a/tools/binman/control.py b/tools/binman/control.py index 42d75efbcd..e9d48df030 100644 --- a/tools/binman/control.py +++ b/tools/binman/control.py @@ -12,7 +12,7 @@ import sys import tools import command -import fdt_select +import fdt import fdt_util from image import Image import tout diff --git a/tools/binman/etype/u_boot_dtb_with_ucode.py b/tools/binman/etype/u_boot_dtb_with_ucode.py index 01ee36fb0d..a384a759c4 100644 --- a/tools/binman/etype/u_boot_dtb_with_ucode.py +++ b/tools/binman/etype/u_boot_dtb_with_ucode.py @@ -6,7 +6,7 @@ # Entry-type module for U-Boot device tree with the microcode removed # -import fdt_select +import fdt from entry import Entry from blob import Entry_blob import tools diff --git a/tools/binman/fdt_test.py b/tools/binman/fdt_test.py index df2b0a6af7..249a9ea388 100644 --- a/tools/binman/fdt_test.py +++ b/tools/binman/fdt_test.py @@ -12,7 +12,7 @@ import tempfile import unittest import fdt -from fdt_select import FdtScan +from fdt import FdtScan import fdt_util import tools diff --git a/tools/binman/func_test.py b/tools/binman/func_test.py index 8960e23f2c..8b4db41659 100644 --- a/tools/binman/func_test.py +++ b/tools/binman/func_test.py @@ -21,7 +21,7 @@ import cmdline import command import control import entry -import fdt_select +import fdt import fdt_util import tools import tout diff --git a/tools/dtoc/dtoc.py b/tools/dtoc/dtoc.py index 2e0b9c04e2..08e35f148c 100755 --- a/tools/dtoc/dtoc.py +++ b/tools/dtoc/dtoc.py @@ -17,7 +17,6 @@ our_path = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.join(our_path, '../patman')) import fdt -import fdt_select import fdt_util # When we see these properties we ignore them - i.e. do not create a structure member @@ -170,7 +169,7 @@ class DtbPlatdata: Once this is done, self.fdt.GetRoot() can be called to obtain the device tree root node, and progress from there. """ -self.fdt = fdt_select.FdtScan(self._dtb_fname) +self.fdt = fdt.FdtScan(self._dtb_fname) def ScanNode(self, root): for node in root.subnodes: diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py index bff31d1c92..63a32ea2d7 100644 --- a/tools/dtoc/fdt.py +++ b/tools/dtoc/fdt.py @@ -14,8 +14,8 @@ import libfdt # This deals with a device tree, presenting it as an assortment of Node and # Prop objects, representing nodes and properties, respectively. This file -# contains the base classes and defines the high-level API. See fdt_select.py -# for how to create an Fdt object. +# contains the base classes and defines the high-level API. You can use +# FdtScan() as a convenience function to create and scan an Fdt. # This implementation uses a libfdt Python library to access the device tree, # so it is fairly efficient. @@ -400,3 +400,9 @@ class Fdt: """ node = Node(fdt, offset, name, path) return node + +def FdtScan(fname): +"""Returns a new Fdt object from the implementation we are using""" +dtb = Fdt(fname) +dtb.Scan() +return dtb diff --git a/tools/dtoc/fdt_select.py b/tools/dtoc/fdt_select.py deleted file mode 100644 index d6337ea227..00 --- a/tools/dtoc/fdt_select.py +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/python -# -# Copyright (C) 2016 Google, Inc -# Written by Simon Glass -# -# SPDX-License-Identifier: GPL-2.0+ -# - -# Bring in the normal fdt library (which relies on libfdt) -import fdt - -def FdtScan(fname): -"""Returns a new Fdt object from the implementation we are using""" -dtb = fdt.Fdt(fname) -dtb.Scan() -return dtb -- 2.13.0.219.gdb65acc882-goog ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 15/20] fdt: Drop use of the legacy libfdt python module
Now that this is no-longer available, stop looking for it. The new module will be used if available. Signed-off-by: Simon Glass--- Changes in v3: None Changes in v2: None tools/dtoc/fdt_normal.py | 32 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/tools/dtoc/fdt_normal.py b/tools/dtoc/fdt_normal.py index e793f49fa8..a0e58a4464 100644 --- a/tools/dtoc/fdt_normal.py +++ b/tools/dtoc/fdt_normal.py @@ -12,12 +12,7 @@ import sys import fdt from fdt import Fdt, NodeBase, PropBase import fdt_util -try: -import libfdt -legacy = False -except ImportError: -import libfdt_legacy as libfdt -legacy = True +import libfdt # This deals with a device tree, presenting it as a list of Node and Prop @@ -92,10 +87,7 @@ class Node(NodeBase): offset = libfdt.fdt_first_subnode(self._fdt.GetFdt(), self.Offset()) while offset >= 0: sep = '' if self.path[-1] == '/' else '/' -if legacy: -name = libfdt.Name(self._fdt.GetFdt(), offset) -else: -name = self._fdt._fdt_obj.get_name(offset) +name = self._fdt._fdt_obj.get_name(offset) path = self.path + sep + name node = Node(self._fdt, offset, name, path) self.subnodes.append(node) @@ -148,8 +140,7 @@ class FdtNormal(Fdt): with open(self._fname) as fd: self._fdt = bytearray(fd.read()) -if not legacy: -self._fdt_obj = libfdt.Fdt(self._fdt) +self._fdt_obj = libfdt.Fdt(self._fdt) def GetFdt(self): """Get the contents of the FDT @@ -186,18 +177,11 @@ class FdtNormal(Fdt): props_dict = {} poffset = libfdt.fdt_first_property_offset(self._fdt, node._offset) while poffset >= 0: -if legacy: -dprop, plen = libfdt.fdt_get_property_by_offset(self._fdt, -poffset) -prop = Prop(node, poffset, -libfdt.String(self._fdt, dprop.nameoff), -libfdt.Data(dprop)) -else: -p = self._fdt_obj.get_property_by_offset(poffset) -prop = Prop(node, poffset, p.name, p.value) -props_dict[prop.name] = prop - -poffset = libfdt.fdt_next_property_offset(self._fdt, poffset) +p = self._fdt_obj.get_property_by_offset(poffset) +prop = Prop(node, poffset, p.name, p.value) +props_dict[prop.name] = prop + +poffset = libfdt.fdt_next_property_offset(self._fdt, poffset) return props_dict def Invalidate(self): -- 2.13.0.219.gdb65acc882-goog ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 09/20] fdt: Build the new python libfdt module
Build the upstream python libfdt module. At present the legacy module is still built and is the one that it used. Future work will switch this over. Signed-off-by: Simon Glass--- Changes in v3: - More machinations to avoid touching the source directory Changes in v2: - Fix building when srcpath is ".." tools/Makefile | 31 +++ 1 file changed, 31 insertions(+) diff --git a/tools/Makefile b/tools/Makefile index cd08d3b33b..bc411e4ae4 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -63,6 +63,16 @@ FIT_SIG_OBJS-$(CONFIG_FIT_SIGNATURE) := common/image-sig.o LIBFDT_CSRCS := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c \ fdt_empty_tree.c fdt_addresses.c fdt_overlay.c \ fdt_region.c + +# Unfortunately setup.py below cannot handle srctree being ".." which it often +# is. It fails with an error like: +# Fatal error: can't create build/temp.linux-x86_64-2.7/../lib/libfdt/fdt.o: +#No such file or directory +# To fix this, use an absolute path. +libfdt_tree := $(shell readlink -f $(srctree)/lib/libfdt) + +LIBFDT_SRCS := $(addprefix $(libfdt_tree)/, $(LIBFDT_CSRCS)) +LIBFDT_SWIG := $(addprefix $(libfdt_tree)/, pylibfdt/libfdt.i) LIBFDT_OBJS := $(addprefix lib/libfdt/, $(patsubst %.c, %.o, $(LIBFDT_CSRCS))) RSA_OBJS-$(CONFIG_FIT_SIGNATURE) := $(addprefix lib/rsa/, \ @@ -114,6 +124,23 @@ mkimage-objs := $(dumpimage-mkimage-objs) mkimage.o fit_info-objs := $(dumpimage-mkimage-objs) fit_info.o fit_check_sign-objs := $(dumpimage-mkimage-objs) fit_check_sign.o +# Unfortunately setup.py (or actually the Python distutil implementation) +# puts files into the same directory as the .i file. We cannot touch the source +# directory, so we copy the .i file into the tools/ build subdirectory before +# calling setup. This directory is safe to write to. This ensures that we get +# all three files in $(obj)/tools: _libfdt.so, libfdt.py and libfdt_wrap.c +# The latter is a temporary file which we could actually remove. +tools/_libfdt.so: $(LIBFDT_SRCS) $(LIBFDT_SWIG) + cp $(LIBFDT_SWIG) tools/. + unset CC; \ + unset CROSS_COMPILE; \ + LDFLAGS="$(HOSTLDFLAGS)" CFLAGS= VERSION="u-boot-$(UBOOTVERSION)" \ + CPPFLAGS="$(_hostc_flags)" OBJDIR=tools \ + SOURCES="$(LIBFDT_SRCS) tools/libfdt.i" \ + SWIG_OPTS="-I$(srctree)/lib/libfdt -I$(srctree)/lib" \ + $(libfdt_tree)/pylibfdt/setup.py --quiet build_ext \ + --build-lib tools + # Build a libfdt Python module if swig is available # Use 'sudo apt-get install swig libpython-dev' to enable this hostprogs-y += \ @@ -219,6 +246,10 @@ clean-dirs := lib common always := $(hostprogs-y) +# Build a libfdt Python module if swig is available +# Use 'sudo apt-get install swig libpython-dev' to enable this +always += $(if $(shell which swig 2> /dev/null),_libfdt.so) + # Generated LCD/video logo LOGO_H = $(objtree)/include/bmp_logo.h LOGO_DATA_H = $(objtree)/include/bmp_logo_data.h -- 2.13.0.219.gdb65acc882-goog ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 10/20] fdt: Update fdt_test to use 'dt' instead of 'fdt'
Since fdt is a module it conflicts with this variable name and prevents it being used in tests. Rename the variable. Signed-off-by: Simon Glass--- Changes in v3: None Changes in v2: None tools/binman/fdt_test.py | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/binman/fdt_test.py b/tools/binman/fdt_test.py index 1d9494e52f..12edeaba6c 100644 --- a/tools/binman/fdt_test.py +++ b/tools/binman/fdt_test.py @@ -28,21 +28,21 @@ class TestFdt(unittest.TestCase): def GetCompiled(self, fname): return fdt_util.EnsureCompiled(self.TestFile(fname)) -def _DeleteProp(self, fdt): -node = fdt.GetNode('/microcode/update@0') +def _DeleteProp(self, dt): +node = dt.GetNode('/microcode/update@0') node.DeleteProp('data') def testFdtNormal(self): fname = self.GetCompiled('34_x86_ucode.dts') -fdt = FdtScan(fname) -self._DeleteProp(fdt) +dt = FdtScan(fname) +self._DeleteProp(dt) def testFdtFallback(self): fname = self.GetCompiled('34_x86_ucode.dts') -fdt = FdtScan(fname, True) -fdt.GetProp('/microcode/update@0', 'data') +dt = FdtScan(fname, True) +dt.GetProp('/microcode/update@0', 'data') self.assertEqual('fred', -fdt.GetProp('/microcode/update@0', 'none', default='fred')) +dt.GetProp('/microcode/update@0', 'none', default='fred')) self.assertEqual('12345678 12345679', -fdt.GetProp('/microcode/update@0', 'data', typespec='x')) -self._DeleteProp(fdt) +dt.GetProp('/microcode/update@0', 'data', typespec='x')) +self._DeleteProp(dt) -- 2.13.0.219.gdb65acc882-goog ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 04/20] fdt: Use SPDX format for licenses in the libfdt headers
These should follow the UBoot standard. Update them. Signed-off-by: Simon Glass--- Changes in v3: None Changes in v2: None include/fdt.h| 46 +- include/libfdt.h | 46 +- 2 files changed, 2 insertions(+), 90 deletions(-) diff --git a/include/fdt.h b/include/fdt.h index 526aedb515..3134d78332 100644 --- a/include/fdt.h +++ b/include/fdt.h @@ -5,51 +5,7 @@ * Copyright (C) 2006 David Gibson, IBM Corporation. * Copyright 2012 Kim Phillips, Freescale Semiconductor. * - * libfdt is dual licensed: you can use it either under the terms of - * the GPL, or the BSD license, at your option. - * - * a) This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, - * MA 02110-1301 USA - * - * Alternatively, - * - * b) Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * 1. Redistributions of source code must retain the above - *copyright notice, this list of conditions and the following - *disclaimer. - * 2. Redistributions in binary form must reproduce the above - *copyright notice, this list of conditions and the following - *disclaimer in the documentation and/or other materials - *provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * SPDX-License-Identifier: GPL-2.0+ BSD-2-Clause */ #ifndef __ASSEMBLY__ diff --git a/include/libfdt.h b/include/libfdt.h index e2bc2e00c1..6d33065e80 100644 --- a/include/libfdt.h +++ b/include/libfdt.h @@ -4,51 +4,7 @@ * libfdt - Flat Device Tree manipulation * Copyright (C) 2006 David Gibson, IBM Corporation. * - * libfdt is dual licensed: you can use it either under the terms of - * the GPL, or the BSD license, at your option. - * - * a) This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, - * MA 02110-1301 USA - * - * Alternatively, - * - * b) Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * 1. Redistributions of source code must retain the above - *copyright notice, this list of conditions and the following - *disclaimer. - * 2. Redistributions in binary form must reproduce the above - *copyright notice, this list of conditions and the following - *disclaimer in the documentation and/or other materials - *provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - *
[U-Boot] [PATCH v3 07/20] fdt: Add all source files to the libfdt build
At present only a subset of source files are build. Add the rest and refactor this so that a source file list is available also. This will be used in later commit. Signed-off-by: Simon Glass--- Changes in v3: None Changes in v2: None tools/Makefile | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/Makefile b/tools/Makefile index 2fc4a583d4..dadc75b912 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -60,9 +60,11 @@ hostprogs-$(CONFIG_FIT_SIGNATURE) += fit_info fit_check_sign FIT_SIG_OBJS-$(CONFIG_FIT_SIGNATURE) := common/image-sig.o # Flattened device tree objects -LIBFDT_OBJS := $(addprefix lib/libfdt/, \ - fdt.o fdt_ro.o fdt_rw.o fdt_strerror.o fdt_wip.o \ - fdt_region.o fdt_sw.o) +LIBFDT_CSRCS := fdt.c fdt_ro.c fdt_wip.c fdt_sw.c fdt_rw.c fdt_strerror.c \ + fdt_empty_tree.c fdt_addresses.c fdt_overlay.c \ + fdt_region.c +LIBFDT_OBJS := $(addprefix lib/libfdt/, $(patsubst %.c, %.o, $(LIBFDT_CSRCS))) + RSA_OBJS-$(CONFIG_FIT_SIGNATURE) := $(addprefix lib/rsa/, \ rsa-sign.o rsa-verify.o rsa-checksum.o \ rsa-mod-exp.o) -- 2.13.0.219.gdb65acc882-goog ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 06/20] fdt: Allow swig options to be provided by Makefile
U-Boot needs to provide some swig include directories. Add this feature. Signed-off-by: Simon Glass--- Changes in v3: None Changes in v2: None lib/libfdt/pylibfdt/setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libfdt/pylibfdt/setup.py b/lib/libfdt/pylibfdt/setup.py index 38a844cb6d..daf1089425 100755 --- a/lib/libfdt/pylibfdt/setup.py +++ b/lib/libfdt/pylibfdt/setup.py @@ -97,12 +97,12 @@ files = os.environ.get('SOURCES', '').split() cflags = os.environ.get('CPPFLAGS', '').split() objdir = os.environ.get('OBJDIR') version = os.environ.get('VERSION') -swig_opts = [] +swig_opts = os.environ.get('SWIG_OPTS', '').split() # If we were called directly rather than through our Makefile (which is often # the case with Python module installation), read the settings from the # Makefile. -if not all((version, files, cflags, objdir)): +if not all((swig_opts, version, files, cflags, objdir)): swig_opts, version, files, cflags, objdir = GetEnvFromMakefiles() libfdt_module = Extension( -- 2.13.0.219.gdb65acc882-goog ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 08/20] fdt: Rename existing python libfdt module
Now that this module has been accepted upstream we should stop using the local U-Boot one. In preparation for this, rename it to indicate it is for legacy use. Signed-off-by: Simon Glass--- Changes in v3: None Changes in v2: None lib/libfdt/{libfdt.swig => libfdt_legacy.swig} | 3 +-- lib/libfdt/setup.py| 6 +++--- tools/Makefile | 11 ++- tools/dtoc/fdt_normal.py | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) rename lib/libfdt/{libfdt.swig => libfdt_legacy.swig} (98%) diff --git a/lib/libfdt/libfdt.swig b/lib/libfdt/libfdt_legacy.swig similarity index 98% rename from lib/libfdt/libfdt.swig rename to lib/libfdt/libfdt_legacy.swig index b24c72b1a2..9880dd998e 100644 --- a/lib/libfdt/libfdt.swig +++ b/lib/libfdt/libfdt_legacy.swig @@ -1,5 +1,4 @@ -/* File: libfdt.i */ -%module libfdt +%module libfdt_legacy %{ #define SWIG_FILE_WITH_INIT diff --git a/lib/libfdt/setup.py b/lib/libfdt/setup.py index 845a0c2b10..fc881351c6 100644 --- a/lib/libfdt/setup.py +++ b/lib/libfdt/setup.py @@ -22,17 +22,17 @@ else: cflags = None libfdt_module = Extension( -'_libfdt', +'_libfdt_legacy', sources = files, extra_compile_args = cflags ) sys.argv = [progname, '--quiet', 'build_ext', '--inplace', '--force'] -setup (name = 'libfdt', +setup (name = 'libfdt_legaacy', version = '0.1', author = "SWIG Docs", description = """Simple swig libfdt from docs""", ext_modules = [libfdt_module], - py_modules = ["libfdt"], + py_modules = ["libfdt_legacy"], ) diff --git a/tools/Makefile b/tools/Makefile index dadc75b912..cd08d3b33b 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -117,16 +117,17 @@ fit_check_sign-objs := $(dumpimage-mkimage-objs) fit_check_sign.o # Build a libfdt Python module if swig is available # Use 'sudo apt-get install swig libpython-dev' to enable this hostprogs-y += \ - $(if $(shell which swig 2> /dev/null),_libfdt.so) -_libfdt.so-sharedobjs += $(LIBFDT_OBJS) + $(if $(shell which swig 2> /dev/null),_libfdt_legacy.so) +_libfdt_legacy.so-sharedobjs += $(LIBFDT_OBJS) libfdt: -tools/_libfdt.so: $(patsubst %.o,%.c,$(LIBFDT_OBJS)) tools/libfdt_wrap.c +tools/_libfdt_legacy.so: $(patsubst %.o,%.c,$(LIBFDT_OBJS)) \ + tools/libfdt_legacy_wrap.c LDFLAGS="$(HOSTLDFLAGS)" CFLAGS= ${PYTHON} $(srctree)/lib/libfdt/setup.py \ "$(_hostc_flags)" $^ - mv _libfdt.so $@ + mv _libfdt_legacy.so $@ -tools/libfdt_wrap.c: $(srctree)/lib/libfdt/libfdt.swig +tools/libfdt_legacy_wrap.c: $(srctree)/lib/libfdt/libfdt_legacy.swig swig -python -o $@ $< # TODO(s...@chromium.org): Is this correct on Mac OS? diff --git a/tools/dtoc/fdt_normal.py b/tools/dtoc/fdt_normal.py index cce5c06d8c..17b0a9a726 100644 --- a/tools/dtoc/fdt_normal.py +++ b/tools/dtoc/fdt_normal.py @@ -12,7 +12,7 @@ import sys import fdt from fdt import Fdt, NodeBase, PropBase import fdt_util -import libfdt +import libfdt_legacy as libfdt # This deals with a device tree, presenting it as a list of Node and Prop # objects, representing nodes and properties, respectively. -- 2.13.0.219.gdb65acc882-goog ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 02/20] pci: Correct cast for sandbox
This gives a warning with some native compilers: cmd/pci.c:152:11: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘u64 {aka long unsigned int}’ [-Wformat=] Fix it with a cast. Signed-off-by: Simon Glass--- Changes in v3: None Changes in v2: None cmd/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/pci.c b/cmd/pci.c index 41b4fffcf9..fe27b4f761 100644 --- a/cmd/pci.c +++ b/cmd/pci.c @@ -150,7 +150,8 @@ int pci_bar_show(struct udevice *dev) if ((!is_64 && size_low) || (is_64 && size)) { size = ~size + 1; printf(" %d %#016llx %#016llx %d %s %s\n", - bar_id, base, size, is_64 ? 64 : 32, + bar_id, (unsigned long long)base, + (unsigned long long)size, is_64 ? 64 : 32, is_io ? "I/O" : "MEM", prefetchable ? "Prefetchable" : ""); } -- 2.13.0.219.gdb65acc882-goog ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 03/20] fdt: Correct cast for sandbox in fdtdec_setup_memory_size()
This gives a warning with some native compilers: lib/fdtdec.c:1203:8: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘long unsigned int’ [-Wformat=] Fix it with a cast. Signed-off-by: Simon Glass--- Changes in v3: None Changes in v2: None lib/fdtdec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/fdtdec.c b/lib/fdtdec.c index c072e54cff..942244f9a3 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -1200,7 +1200,8 @@ int fdtdec_setup_memory_size(void) } gd->ram_size = (phys_size_t)(res.end - res.start + 1); - debug("%s: Initial DRAM size %llx\n", __func__, (u64)gd->ram_size); + debug("%s: Initial DRAM size %llx\n", __func__, + (unsigned long long)gd->ram_size); return 0; } -- 2.13.0.219.gdb65acc882-goog ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 01/20] fdt: Add Python bindings
An early version of this is available upstream. Bring it in as a starting point. This is from dtc upstream commit e56f2b0. Future work will plumb it into dtoc and remove the now-unnecessary local libraries. Signed-off-by: Simon Glass--- Changes in v3: None Changes in v2: None lib/libfdt/pylibfdt/libfdt.i | 389 +++ lib/libfdt/pylibfdt/setup.py | 123 ++ 2 files changed, 512 insertions(+) create mode 100644 lib/libfdt/pylibfdt/libfdt.i create mode 100755 lib/libfdt/pylibfdt/setup.py diff --git a/lib/libfdt/pylibfdt/libfdt.i b/lib/libfdt/pylibfdt/libfdt.i new file mode 100644 index 00..3b11bb0c95 --- /dev/null +++ b/lib/libfdt/pylibfdt/libfdt.i @@ -0,0 +1,389 @@ +/* + * pylibfdt - Flat Device Tree manipulation in Python + * Copyright (C) 2017 Google, Inc. + * Written by Simon Glass + * + * SPDX-License-Identifier:GPL-2.0+ BSD-2-Clause + */ + +%module libfdt + +%{ +#define SWIG_FILE_WITH_INIT +#include "libfdt.h" +%} + +%pythoncode %{ + +import struct + +# Error codes, corresponding to FDT_ERR_... in libfdt.h +(NOTFOUND, +EXISTS, +NOSPACE, +BADOFFSET, +BADPATH, +BADPHANDLE, +BADSTATE, +TRUNCATED, +BADMAGIC, +BADVERSION, +BADSTRUCTURE, +BADLAYOUT, +INTERNAL, +BADNCELLS, +BADVALUE, +BADOVERLAY, +NOPHANDLES) = QUIET_ALL = range(1, 18) +# QUIET_ALL can be passed as the 'quiet' parameter to avoid exceptions +# altogether. All # functions passed this value will return an error instead +# of raising an exception. + +# Pass this as the 'quiet' parameter to return -ENOTFOUND on NOTFOUND errors, +# instead of raising an exception. +QUIET_NOTFOUND = (NOTFOUND,) + + +class FdtException(Exception): +"""An exception caused by an error such as one of the codes above""" +def __init__(self, err): +self.err = err + +def __str__(self): +return 'pylibfdt error %d: %s' % (self.err, fdt_strerror(self.err)) + +def strerror(fdt_err): +"""Get the string for an error number + +Args: +fdt_err: Error number (-ve) + +Returns: +String containing the associated error +""" +return fdt_strerror(fdt_err) + +def check_err(val, quiet=()): +"""Raise an error if the return value is -ve + +This is used to check for errors returned by libfdt C functions. + +Args: +val: Return value from a libfdt function +quiet: Errors to ignore (empty to raise on all errors) + +Returns: +val if val >= 0 + +Raises +FdtException if val < 0 +""" +if val < 0: +if -val not in quiet: +raise FdtException(val) +return val + +def check_err_null(val, quiet=()): +"""Raise an error if the return value is NULL + +This is used to check for a NULL return value from certain libfdt C +functions + +Args: +val: Return value from a libfdt function +quiet: Errors to ignore (empty to raise on all errors) + +Returns: +val if val is a list, None if not + +Raises +FdtException if val indicates an error was reported and the error +is not in @quiet. +""" +# Normally a list is returned which contains the data and its length. +# If we get just an integer error code, it means the function failed. +if not isinstance(val, list): +if -val not in quiet: +raise FdtException(val) +return val + +class Fdt: +"""Device tree class, supporting all operations + +The Fdt object is created is created from a device tree binary file, +e.g. with something like: + + fdt = Fdt(open("filename.dtb").read()) + +Operations can then be performed using the methods in this class. Each +method xxx(args...) corresponds to a libfdt function fdt_xxx(fdt, args...). + +All methods raise an FdtException if an error occurs. To avoid this +behaviour a 'quiet' parameter is provided for some functions. This +defaults to empty, but you can pass a list of errors that you expect. +If one of these errors occurs, the function will return an error number +(e.g. -NOTFOUND). +""" +def __init__(self, data): +self._fdt = bytearray(data) +check_err(fdt_check_header(self._fdt)); + +def path_offset(self, path, quiet=()): +"""Get the offset for a given path + +Args: +path: Path to the required node, e.g. '/node@3/subnode@1' +quiet: Errors to ignore (empty to raise on all errors) + +Returns: +Node offset + +Raises +FdtException if the path is not valid or not found +""" +return check_err(fdt_path_offset(self._fdt, path), quiet) + +def first_property_offset(self, nodeoffset, quiet=()): +"""Get the offset of the first property in a node offset + +Args: +
[U-Boot] [PATCH v3 00/20] fdt: Move to the new upstream pylibfdt library
Python libfdt bindings have recently been accepted upstream. While the internals have changed a fair bit most of the API remains the same. Still, a few functions are different from how they are used in U-Boot so changes are needed to make this work. At present in U-Boot there are two libraries for accessing a device tree file: - FdtNormal which uses U-Boot's own Python bindings - FdtFallback which uses the fdtget command-line utility The latter is not a great solution: it is fairly slow since the DT is re-read for every access and it cannot provide DT offsets or packing of the DT. In addition, U-Boot now builds the libfdt module if swig is available, meaning that the fallback module is not used in that case. Finally, at some point in the future distributions may start packaging the libfdt Python module and it will be available without U-Boot needing to build it itself. Therefore it seems like a good idea to take this opportunity to drop the fallback module and just require that the Python libfdt bindings be present (at least if need by the build). The bindings are needed in two situations: - When dtoc is used to convert a device tree into C code. This is enabled by CONFIG_SPL_OF_PLATDATA - When binman is used to produce a firmware image. This is used on all x86 and sunxi boards at present This series: - Plumbs in building the Python libfdt module to the U-Boot build system - Ensures that the module is always built if needed, print an error if swig is not available (and thus the module cannot be built) - Allows use of a libfdt.py module already installed on the machine - Drops the FdtFallback support - Moves fdt.h and libfdt.h into lib/libfdt to aid with syncing with upstream, building the Python bindings and to keep the code together - Merges Fdt and FdtNormal to simplify the code - Adjusts the Fdt library to work with the new libfdt module - Adds a few more tests to check access to properties in the DT - Adjusts binman and dtoc to work with the new approach It should be possible to easily sync libfdt's Python bindings with U-Boot in the future, as development there proceeds. Changes in v3: - More machinations to avoid touching the source directory - Drop changes which are now in any earlier patch Changes in v2: - Fix building when srcpath is ".." Simon Glass (20): fdt: Add Python bindings pci: Correct cast for sandbox fdt: Correct cast for sandbox in fdtdec_setup_memory_size() fdt: Use SPDX format for licenses in the libfdt headers fdt: Move header files into lib/libfdt fdt: Allow swig options to be provided by Makefile fdt: Add all source files to the libfdt build fdt: Rename existing python libfdt module fdt: Build the new python libfdt module fdt: Update fdt_test to use 'dt' instead of 'fdt' fdt: dtoc: Add a full set of property tests fdt: Support use of the new python libfdt library fdt: Makefile: Build python libfdt library if needed fdt: Stop building the old python libfdt module fdt: Drop use of the legacy libfdt python module fdt: Drop fdt_fallback library binman: Drop a special case related to fdt_fallback fdt: Merge fdt_normal with its base class binman: Rename fdt variable to dtb fdt: Drop fdt_select.py Makefile| 16 +- cmd/pci.c |3 +- include/fdt.h | 112 +- include/libfdt.h| 2138 +- lib/fdtdec.c|3 +- lib/libfdt/fdt.h| 67 + lib/libfdt/libfdt.h | 2144 +++ lib/libfdt/libfdt.swig | 113 -- lib/libfdt/pylibfdt/libfdt.i| 389 + lib/libfdt/pylibfdt/setup.py| 123 ++ lib/libfdt/setup.py | 38 - scripts/Makefile.spl| 17 +- tools/Makefile | 54 +- tools/binman/binman.py |3 + tools/binman/control.py | 12 +- tools/binman/etype/u_boot_dtb_with_ucode.py | 24 +- tools/binman/fdt_test.py| 64 +- tools/binman/func_test.py | 48 +- tools/binman/test/45_prop_test.dts | 23 + tools/dtoc/dtoc.py |3 +- tools/dtoc/fdt.py | 183 ++- tools/dtoc/fdt_fallback.py | 181 --- tools/dtoc/fdt_normal.py| 225 --- tools/dtoc/fdt_select.py| 36 - 24 files changed, 3060 insertions(+), 2959 deletions(-) create mode 100644 lib/libfdt/fdt.h create mode 100644 lib/libfdt/libfdt.h delete mode 100644 lib/libfdt/libfdt.swig create mode 100644 lib/libfdt/pylibfdt/libfdt.i create mode 100755 lib/libfdt/pylibfdt/setup.py delete mode 100644 lib/libfdt/setup.py create mode 100644 tools/binman/test/45_prop_test.dts delete mode
Re: [U-Boot] i.Mx6q u-boot stuck
On Sat, May 27, 2017 at 8:00 AM, Fausto Sessegowrote: > Starting kernel ... > > Uncompressing Linux... done, booting the kernel. > > Error: unrecognized/unsupported machine ID (r1 = 0x15b3). > > Available machine support: > > ID (hex)NAME > Generic DT based system > Freescale i.MX6 Quad/DualLite (Device Tree) > Freescale i.MX6 SoloLite (Device Tree) > Freescale i.MX6 SoloX (Device Tree) > Freescale i.MX6 Ultralite (Device Tree) > Freescale i.MX7 Dual (Device Tree) > Freescale i.MX50 (Device Tree Support) > Freescale i.MX53 (Device Tree Support) > Freescale Vybrid VF5xx/VF6xx (Device Tree) > > Please check your kernel config and/or bootloader. > > There is the error "Error: unrecognized/unsupported machine ID" > > I read many post but i didn't found any solution. You are probably missing: CONFIG_OF_LIBFDT=y in your defconfig file. Just looked at your defconfig and it has: #CONFIG_OF_LIBFDT=y So you need to remove the "#" in front of it. This will tell U-Boot that it will boot a kernel + dtb. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] i.Mx6q u-boot stuck
2017-05-26 14:04 GMT+02:00 Lothar Waßmann: > Fausto Sessego wrote: > > > Hi, > > > > here you are my configuration: > > > > #define CONFIG_EXTRA_ENV_SETTINGS \ > > "image=zImage\0" \ > > "console=" CONFIG_CONSOLE_DEV "\0" \ > > "fdt_file=imx6q-tibidabo.dtb\0" \ > > "fdt_addr=0x1400\0" \ > > "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \ > > "mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \ > > "mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \ > > "mmcautodetect=yes\0" \ > > "mmcargs=setenv bootargs console=${console},${baudrate} earlyprintk " \ > > "root=${mmcroot}\0" \ > > "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ > > "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ > > > > > > #define CONFIG_BOOTCOMMAND \ > > "run mmcargs; " \ > > "run loadfdt; " \ > > "run loadimage; " \ > > "bootz ${loadaddr} - ${fdt_addr}; "\ > > > > it is easy. > > > > I tried to put earlyprintk but i didn't see any output. > > > > > Please do not top-post! (put your own comments _after_ the quoted > portion of the original mail you are responding to just like everyone > else on this mailing list). > > Your SDRAM size is 2GiB. That means U-Boot will relocate the FDT > outside reach for the kernel. Try setting 'fdt_high=0x' (or > ${fdt_addr}), to prevent U-Boot from relocating the FDT. > > > Lothar Waßmann > -- > ___ > > Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen > Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10 > Geschäftsführer: Matthias Kaussen > Handelsregistereintrag: Amtsgericht Aachen, HRB 4996 > > www.karo-electronics.de | i...@karo-electronics.de > ___ > I finally found the error enabling "earlyprintk" U-Boot 2016.07 (May 27 2017 - 01:17:11 +0200) CPU: Freescale i.MX6Q rev1.2 at 792MHz CPU: Industrial temperature grade (-40C to 105C) at 30C Reset cause: POR Board: i.MX6Q TIBIDABO I2C: ready DRAM: gd->ram_size: 2147483648 DRAM test not implemented! 2 GiB MMC: FSL_SDHC: 0, FSL_SDHC: 1 *** Warning - bad CRC, using default environment In:serial Out: serial Err: serial Net: FEC [PRIME] Error: FEC address not set. Hit any key to stop autoboot: 0 reading imx6q-tibidabo.dtb 29636 bytes read in 22 ms (1.3 MiB/s) reading uImage 6622920 bytes read in 324 ms (19.5 MiB/s) ## Booting kernel from Legacy Image at 1200 ... Image Name: Linux-4.1.38 Image Type: ARM Linux Kernel Image (uncompressed) Data Size:6622856 Bytes = 6.3 MiB Load Address: 10008000 Entry Point: 10008000 Verifying Checksum ... OK Loading Kernel Image ... OK Starting kernel ... Uncompressing Linux... done, booting the kernel. Error: unrecognized/unsupported machine ID (r1 = 0x15b3). Available machine support: ID (hex)NAME Generic DT based system Freescale i.MX6 Quad/DualLite (Device Tree) Freescale i.MX6 SoloLite (Device Tree) Freescale i.MX6 SoloX (Device Tree) Freescale i.MX6 Ultralite (Device Tree) Freescale i.MX7 Dual (Device Tree) Freescale i.MX50 (Device Tree Support) Freescale i.MX53 (Device Tree Support) Freescale Vybrid VF5xx/VF6xx (Device Tree) Please check your kernel config and/or bootloader. There is the error "Error: unrecognized/unsupported machine ID" I read many post but i didn't found any solution. PS: is it ok if i answer this way? thank ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 4/8] usb: host: xhci-rockchip: add support for rk3328
On 05/27/2017 12:09 PM, rock-chips(daniel.meng) wrote: > > > On 2017/5/27 16:38, Marek Vasut wrote: >> On 05/27/2017 09:44 AM, rock-chips(daniel.meng) wrote: >>> >>> On 2017/5/18 1:07, Marek Vasut wrote: On 05/17/2017 12:21 PM, Meng Dongyang wrote: > Add the compatible "rockchip,rk3328-xhci" in match table > for rk3328 to probe xhci controller. Turn off vbus when > usb stop. > > Signed-off-by: Meng Dongyang> --- > drivers/usb/host/xhci-rockchip.c | 6 ++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/usb/host/xhci-rockchip.c > b/drivers/usb/host/xhci-rockchip.c > index f559830..8db92cb 100644 > --- a/drivers/usb/host/xhci-rockchip.c > +++ b/drivers/usb/host/xhci-rockchip.c > @@ -168,6 +168,7 @@ static int xhci_usb_probe(struct udevice *dev) > static int xhci_usb_remove(struct udevice *dev) > { > +struct rockchip_xhci_platdata *plat = dev_get_platdata(dev); > struct rockchip_xhci *ctx = dev_get_priv(dev); > int ret; > @@ -178,11 +179,15 @@ static int xhci_usb_remove(struct udevice *dev) > if (ret) > return ret; > +if (dm_gpio_is_valid(>vbus_gpio)) > +dm_gpio_set_value(>vbus_gpio, 0); This should be a fixed regulator, then you don't have to mess with GPIOs directly. >>> Indeed, this is better to be a fixed regulator. Yet other platforms >>> still use GPIOs directly. >>> So I must change the dts of the other platforms if change like this. >>> Maybe it's better to change >>> by another commit. This patch is only for turning off vbus when usb stop. >> How do you assure the polarity of this GPIO here though ? Anyway, >> turning this into regulator could be done in separate patch if this >> practice is already establish. > I config the active voltageof gpio throw dts to assure the polarity. > > for example: > vbus-gpio = < 27 GPIO_ACTIVE_HIGH>; > The active voltage is configed to high, then if I call the function > dm_gpio_set_value(>vbus_gpio, 1); > the gpio output voltage will be high. So DM handles the polarity for you behind the scenes ? -- Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 4/8] usb: host: xhci-rockchip: add support for rk3328
On 05/27/2017 09:44 AM, rock-chips(daniel.meng) wrote: > > > On 2017/5/18 1:07, Marek Vasut wrote: >> On 05/17/2017 12:21 PM, Meng Dongyang wrote: >>> Add the compatible "rockchip,rk3328-xhci" in match table >>> for rk3328 to probe xhci controller. Turn off vbus when >>> usb stop. >>> >>> Signed-off-by: Meng Dongyang>>> --- >>> drivers/usb/host/xhci-rockchip.c | 6 ++ >>> 1 file changed, 6 insertions(+) >>> >>> diff --git a/drivers/usb/host/xhci-rockchip.c >>> b/drivers/usb/host/xhci-rockchip.c >>> index f559830..8db92cb 100644 >>> --- a/drivers/usb/host/xhci-rockchip.c >>> +++ b/drivers/usb/host/xhci-rockchip.c >>> @@ -168,6 +168,7 @@ static int xhci_usb_probe(struct udevice *dev) >>> static int xhci_usb_remove(struct udevice *dev) >>> { >>> +struct rockchip_xhci_platdata *plat = dev_get_platdata(dev); >>> struct rockchip_xhci *ctx = dev_get_priv(dev); >>> int ret; >>> @@ -178,11 +179,15 @@ static int xhci_usb_remove(struct udevice *dev) >>> if (ret) >>> return ret; >>> +if (dm_gpio_is_valid(>vbus_gpio)) >>> +dm_gpio_set_value(>vbus_gpio, 0); >> This should be a fixed regulator, then you don't have to mess with GPIOs >> directly. > Indeed, this is better to be a fixed regulator. Yet other platforms > still use GPIOs directly. > So I must change the dts of the other platforms if change like this. > Maybe it's better to change > by another commit. This patch is only for turning off vbus when usb stop. How do you assure the polarity of this GPIO here though ? Anyway, turning this into regulator could be done in separate patch if this practice is already establish. -- Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 2/2] LS2080ARDB: Secure Boot defconfig for QSPI boot.
Add the secure boot defconfig for QSPI boot on LS2088ARDB platform. Signed-off-by: Udit Agarwal--- Dependent Patch Set: https://patchwork.ozlabs.org/patch/756260/ Changes in v2: Updates the MAINTAINERS file and reverses the order of secure boot patches for LS2080 QSPI Boot. configs/ls2088ardb_qspi_SECURE_BOOT_defconfig | 49 +++ 1 file changed, 49 insertions(+) create mode 100644 configs/ls2088ardb_qspi_SECURE_BOOT_defconfig diff --git a/configs/ls2088ardb_qspi_SECURE_BOOT_defconfig b/configs/ls2088ardb_qspi_SECURE_BOOT_defconfig new file mode 100644 index 000..360d8c4 --- /dev/null +++ b/configs/ls2088ardb_qspi_SECURE_BOOT_defconfig @@ -0,0 +1,49 @@ +CONFIG_ARM=y +CONFIG_TARGET_LS2080ARDB=y +CONFIG_SECURE_BOOT=y +CONFIG_FSL_LS_PPA=y +CONFIG_QSPI_AHB_INIT=y +CONFIG_DEFAULT_DEVICE_TREE="fsl-ls2088a-rdb-qspi" +# CONFIG_SYS_MALLOC_F is not set +CONFIG_FIT_VERBOSE=y +CONFIG_OF_BOARD_SETUP=y +CONFIG_OF_STDOUT_VIA_ALIAS=y +CONFIG_QSPI_BOOT=y +CONFIG_BOOTDELAY=10 +CONFIG_CMD_GREPENV=y +# CONFIG_CMD_IMLS is not set +CONFIG_CMD_GPT=y +CONFIG_CMD_MMC=y +CONFIG_CMD_SF=y +CONFIG_CMD_I2C=y +CONFIG_CMD_DHCP=y +CONFIG_CMD_MII=y +CONFIG_CMD_PING=y +CONFIG_CMD_CACHE=y +CONFIG_CMD_EXT2=y +CONFIG_CMD_FAT=y +CONFIG_OF_CONTROL=y +CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_DM=y +CONFIG_FSL_CAAM=y +CONFIG_DM_SPI_FLASH=y +CONFIG_NETDEVICES=y +CONFIG_E1000=y +CONFIG_PCI=y +CONFIG_DM_PCI=y +CONFIG_DM_PCI_COMPAT=y +CONFIG_PCIE_LAYERSCAPE=y +CONFIG_SYS_NS16550=y +CONFIG_DM_SPI=y +CONFIG_FSL_QSPI=y +CONFIG_FSL_DSPI=y +CONFIG_CMD_USB=y +CONFIG_RSA=y +CONFIG_RSA_SOFTWARE_EXP=y +# CONFIG_CMD_SETEXPR is not set +CONFIG_USB=y +CONFIG_DM_USB=y +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_DWC3=y +CONFIG_USB_STORAGE=y +CONFIG_EFI_LOADER_BOUNCE_BUFFER=y -- 1.9.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 1/2] LS2080ARDB: QSPI boot: Secure Boot image validation
Validates the images in the ESBC phase for (QSPI boot) using esbc_validate command. Add images validation in default environment under mcinitcmd prior to MC initialization. Adds header address for PPA to be validated during ESBC phase for ARCH_LS2088 and QSPI_BOOT. Moves sec_init prior to ppa_init as for validation of PPA, sec must be initialised before the PPA is initialised. Signed-off-by: Udit Agarwal--- Dependent Patch Set: https://patchwork.ozlabs.org/patch/756260/ Changes in v2: Updates the MAINTAINERS file and reverses the order of secure boot patches for LS2080 QSPI Boot. arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 3 ++- arch/arm/include/asm/fsl_secure_boot.h| 5 + board/freescale/ls2080aqds/ls2080aqds.c | 7 +++ board/freescale/ls2080ardb/MAINTAINERS| 5 + board/freescale/ls2080ardb/ls2080ardb.c | 4 include/configs/ls2080ardb.h | 22 ++ 6 files changed, 41 insertions(+), 5 deletions(-) diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig index 312c54d..18c3b2a 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig +++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig @@ -182,7 +182,8 @@ config SYS_LS_PPA_ESBC_ADDR default 0x6068 if SYS_LS_PPA_FW_IN_XIP && ARCH_LS1043A default 0x4068 if SYS_LS_PPA_FW_IN_XIP && ARCH_LS1046A default 0x4068 if SYS_LS_PPA_FW_IN_XIP && ARCH_LS1012A - default 0x58068 if SYS_LS_PPA_FW_IN_XIP && FSL_LSCH3 + default 0x2068 if SYS_LS_PPA_FW_IN_XIP && QSPI_BOOT && ARCH_LS2080A + default 0x58068 if SYS_LS_PPA_FW_IN_XIP && ARCH_LS2080A default 0x68 if SYS_LS_PPA_FW_IN_MMC default 0x68 if SYS_LS_PPA_FW_IN_NAND help diff --git a/arch/arm/include/asm/fsl_secure_boot.h b/arch/arm/include/asm/fsl_secure_boot.h index 6d53708..b6f63a3 100644 --- a/arch/arm/include/asm/fsl_secure_boot.h +++ b/arch/arm/include/asm/fsl_secure_boot.h @@ -72,8 +72,13 @@ * DDR memory map */ #ifdef CONFIG_FSL_LSCH3 +#ifdef CONFIG_QSPI_BOOT +#define CONFIG_BS_ADDR_DEVICE 0x2060 +#define CONFIG_BS_HDR_ADDR_DEVICE 0x2064 +#else /* NOR BOOT */ #define CONFIG_BS_ADDR_DEVICE 0x58060 #define CONFIG_BS_HDR_ADDR_DEVICE 0x58064 +#endif /*ifdef CONFIG_QSPI_BOOT */ #define CONFIG_BS_SIZE 0x1000 #define CONFIG_BS_HDR_SIZE 0x4000 #define CONFIG_BS_ADDR_RAM 0xa060 diff --git a/board/freescale/ls2080aqds/ls2080aqds.c b/board/freescale/ls2080aqds/ls2080aqds.c index 6da9c6c..b9eb549 100644 --- a/board/freescale/ls2080aqds/ls2080aqds.c +++ b/board/freescale/ls2080aqds/ls2080aqds.c @@ -226,15 +226,14 @@ int board_init(void) #endif select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT); rtc_enable_32khz_output(); +#ifdef CONFIG_FSL_CAAM + sec_init(); +#endif #ifdef CONFIG_FSL_LS_PPA ppa_init(); #endif -#ifdef CONFIG_FSL_CAAM - sec_init(); -#endif - return 0; } diff --git a/board/freescale/ls2080ardb/MAINTAINERS b/board/freescale/ls2080ardb/MAINTAINERS index 91f13ea..8da1c6d 100644 --- a/board/freescale/ls2080ardb/MAINTAINERS +++ b/board/freescale/ls2080ardb/MAINTAINERS @@ -21,3 +21,8 @@ LS2080A_SECURE_BOOT BOARD M: Saksham Jain S: Maintained F: configs/ls2080ardb_SECURE_BOOT_defconfig + +LS2088A_QSPI_SECURE_BOOT BOARD +M: Udit Agarwal +S: Maintained +F: configs/ls2088ardb_qspi_SECURE_BOOT_defconfig diff --git a/board/freescale/ls2080ardb/ls2080ardb.c b/board/freescale/ls2080ardb/ls2080ardb.c index df2d768..4c42c73 100644 --- a/board/freescale/ls2080ardb/ls2080ardb.c +++ b/board/freescale/ls2080ardb/ls2080ardb.c @@ -231,6 +231,10 @@ int board_init(void) #ifdef CONFIG_FSL_QIXIS QIXIS_WRITE(rst_ctl, QIXIS_RST_CTL_RESET_EN); #endif + +#ifdef CONFIG_FSL_CAAM + sec_init(); +#endif #ifdef CONFIG_FSL_LS_PPA ppa_init(); #endif diff --git a/include/configs/ls2080ardb.h b/include/configs/ls2080ardb.h index 2dab065..f04a343 100644 --- a/include/configs/ls2080ardb.h +++ b/include/configs/ls2080ardb.h @@ -364,6 +364,27 @@ unsigned long get_board_sys_clk(void); /* Initial environment variables */ #undef CONFIG_EXTRA_ENV_SETTINGS #ifdef CONFIG_SECURE_BOOT +#ifdef CONFIG_QSPI_BOOT +#define CONFIG_EXTRA_ENV_SETTINGS \ + "hwconfig=fsl_ddr:bank_intlv=auto\0"\ + "scriptaddr=0x8080\0" \ + "kernel_addr_r=0x8100\0"\ + "pxefile_addr_r=0x8100\0" \ + "fdt_addr_r=0x8800\0" \ + "ramdisk_addr_r=0x8900\0" \ + "loadaddr=0x8010\0" \ + "kernel_addr=0x10\0"\ + "ramdisk_size=0x200\0" \ + "fdt_high=0xa000\0" \ +