aboutsummaryrefslogtreecommitdiff
path: root/common/fdt_support.c
AgeCommit message (Collapse)AuthorFilesLines
2021-08-26fdt_support: Add kernel-doc for fdt_fixup_memory_banks()Michal Simek1-0/+18
Add kernel-doc description for fdt_fixup_memory_banks() because it is implemented in one specific way and this information should be available for others to decide if their SoC conforms to it. If you don't want U-Boot to update your memory DT layout please disable CONFIG_ARCH_FIXUP_FDT_MEMORY. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-08-02global: Convert simple_strtoul() with hex to hextoul()Simon Glass1-1/+1
It is a pain to have to specify the value 16 in each call. Add a new hextoul() function and update the code to use it. Add a proper comment to simple_strtoul() while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-06-23spl: fit: Also record architecture in /fit-imagesMichal Simek1-1/+3
On ARM64 secure OS can run as 64bit or 32bit that's why it is necessary to record information about architecture that other code can read it and properly pass it to TF-A and start in 64bit or 32bit mode. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-05-13fdt_support: move fdt_valid from cmd_fdt.c to fdt_support.cKory Maincent1-0/+46
Move the fdt_valid function to fdt_support. This changes allow to be able to test the validity of a devicetree in other c files. Update code syntax. Signed-off-by: Kory Maincent <kory.maincent@bootlin.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Maxime Ripard <maxime@cerno.tech>
2021-05-12Revert "fdt: translate address if #size-cells = <0>"Dario Binacchi1-4/+2
This reverts commit d64b9cdcd475eb7f07b49741ded87e24dae4a5fc. As pointed by [1] and [2], the reverted patch made every DT 'reg' property translatable. What the patch was trying to fix was fixed in a different way from previously submitted patches which instead of correcting the generic address translation function fixed the issue with appropriate platform code. [1] https://patchwork.ozlabs.org/project/uboot/patch/1614324949-61314-1-git-send-email-bmeng.cn@gmail.com/ [2] https://lore.kernel.org/linux-clk/20210402192054.7934-1-dariobin@libero.it/T/ Signed-off-by: Dario Binacchi <dariobin@libero.it> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2021-05-04fdt_support.c: Allow late kernel cmdline modificationNiko Mauno1-1/+11
By declaring board-specific board_fdt_chosen_bootargs() the kernel command line arguments can be adjusted before injecting to flat dt chosen node. Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
2021-03-05common: fdt_support: Support special case of PCI address in fdt_read_prop()Bin Meng1-3/+17
At present fdt_read_prop() can only handle 1 or 2 cells. It is called by fdt_read_range() which may be used to read PCI address from <ranges> for a PCI bus node where the number of PCI address cell is 3. The <ranges> property is an array of: { <child address> <parent address> <size in child address space> } When trying to read <child address> from a PCI bus node using fdt_read_prop(), as the codes below: /* Read <child address> */ if (child_addr) { r = fdt_read_prop(ranges, ranges_len, cell, child_addr, acells); if (r) return r; } it will fail, because the PCI child address is made up of 3 cells but fdt_read_prop() cannot handle it. We advance the cell offset by 1 so that the <child address> can be correctly read. This adds the special handling of such case. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
2021-02-19fdt/sunxi: Remove OF_STDOUT_PATHAndre Przywara1-8/+1
OF_STDOUT_PATH was meant to hold the devicetree path to the serial console, to be put into the linux,stdout-path property of the chosen node. The only user of that was sunxi, and it was actually wrong for years there: the paths hardcoded in sunxi_common.h were not matching the DTs, evident by the leading 0's in nodenames, which have been removed years ago. On top of that, "linux,stdout-path" is now deprecated for a while (Linux commit 2a9d832cc9aae from November 2014), and also all modern DTs (including those included in U-Boot) carry a "stdout-path" property already. So remove the stanza from sunxi_common.h, and, since this was the last user, also remove the associated bits from the rest of U-Boot. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-02-18dm: Introduce xxx_get_dma_range()Nicolas Saenz Julienne1-0/+73
Add the following functions to get a specific device's DMA ranges: - dev_get_dma_range() - ofnode_get_dma_range() - of_get_dma_range() - fdt_get_dma_range() They are specially useful in oder to be able validate a physical address space range into a bus's and to convert addresses from and to address spaces. Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Peter Robinson <pbrobinson@gmail.com> Signed-off-by: Matthias Brugger <mbrugger@suse.com>
2021-01-12fdt: translate address if #size-cells = <0>Dario Binacchi1-2/+4
The __of_translate_address routine translates an address from the device tree into a CPU physical address. A note in the description of the routine explains that the crossing of any level with since inherited from IBM. This does not happen for Texas Instruments, or at least for the beaglebone device tree. Without this patch, in fact, the translation into physical addresses of the registers contained in the am33xx-clocks.dtsi nodes would not be possible. They all have a parent with #size-cells = <0>. The CONFIG_OF_TRANSLATE_ZERO_SIZE_CELLS symbol makes translation possible even in the case of crossing levels with #size-cells = <0>. The patch acts conservatively on address translation, except for removing a check within the of_translate_one function in the drivers/core/of_addr.c file: + ranges = of_get_property(parent, rprop, &rlen); - if (ranges == NULL && !of_empty_ranges_quirk(parent)) { - debug("no ranges; cannot translate\n"); - return 1; - } if (ranges == NULL || rlen == 0) { offset = of_read_number(addr, na); memset(addr, 0, pna * 4); debug("empty ranges; 1:1 translation\n"); There are two reasons: 1 The function of_empty_ranges_quirk always returns false, invalidating the following if statement in case of null ranges. Therefore one of the two checks is useless. 2 The implementation of the of_translate_one function found in the common/fdt_support.c file has removed this check while keeping the one about the 1:1 translation. The patch adds a test and modifies a check for the correctness of an address in the case of enabling translation also for zero size cells. The added test checks translations of addresses generated by nodes of a device tree similar to those you can find in the files am33xx.dtsi and am33xx-clocks.dtsi for which the patch was created. The patch was also tested on a beaglebone black board. The addresses generated for the registers of the loaded drivers are those specified by the AM335x reference manual. Signed-off-by: Dario Binacchi <dariobin@libero.it> Tested-by: Dario Binacchi <dariobin@libero.it> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-27spl: fdt: Record load/entry fit-images entries in 64bit formatMichal Simek1-7/+2
The commit 9f45aeb93727 ("spl: fit: implement fdt_record_loadable") which introduced fdt_record_loadable() state there spl_fit.c is not 64bit safe. Based on my tests on Xilinx ZynqMP zcu102 platform there shouldn't be a problem to record these addresses in 64bit format. The patch adds support for systems which need to load images above 4GB. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-27spl: Use standard FIT entriesMichal Simek1-2/+2
SPL is creating fit-images DT node when loadables are recorded in selected configuration. Entries which are created are using entry-point and load-addr property names. But there shouldn't be a need to use non standard properties because entry/load are standard FIT properties. But using standard FIT properties enables option to use generic FIT functions to descrease SPL size. Here is result for ZynqMP virt configuration: xilinx_zynqmp_virt: spl/u-boot-spl:all -82 spl/u-boot-spl:rodata -22 spl/u-boot-spl:text -60 The patch causes change in run time fit image record. Before: fit-images { uboot { os = "u-boot"; type = "firmware"; size = <0xfd520>; entry-point = <0x8000000>; load-addr = <0x8000000>; }; }; After: fit-images { uboot { os = "u-boot"; type = "firmware"; size = <0xfd520>; entry = <0x8000000>; load = <0x8000000>; }; }; Replacing calling fdt_getprop_u32() by fit_image_get_entry/load() also enables support for reading entry/load properties recorded in 64bit format. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-07-25fdt_support: skip MTD node with "disabled" in fdt_fixup_mtdparts()Masahiro Yamada1-7/+10
Currently, fdt_fixup_mtdparts() only checks the compatible property. It is pointless to fix up the disabled node. Skip the node if it has the property: status = "disabled" Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-07-25fdt_support: call mtdparts_init() after finding MTD node to fix upMasahiro Yamada1-3/+8
Platform code can call fdt_fixup_mtdparts() in order to hand U-Boot's MTD partitions over to the Linux device tree. Currently, fdt_fixup_mtdparts() calls mtdparts_init() in its entry. If no target MTD device is found, an error message like follows is displayed: Device nand0 not found! This occurs when the same code (e.g. arch/arm/mach-uniphier/fdt-fixup.c) is shared among several boards, but not all of them support an MTD device. Parse the DT first, then call mtdparts_init() only when the target MTD node is found. Yet, you still need to call mtdparts_init() before device_find(). Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-07-25fdt_support: add static to fdt_node_set_part_info()Masahiro Yamada1-2/+2
This function is only called from fdt_fixup_mtdpart() in the same file. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-07-24Revert "Merge tag 'dm-pull-20jul20' of git://git.denx.de/u-boot-dm"Tom Rini1-20/+12
This reverts commit 5d3a21df6694ebd66d5c34c9d62a26edc7456fc7, reversing changes made to 56d37f1c564107e27d873181d838571b7d7860e7. Unfortunately this is causing CI failures: https://travis-ci.org/github/trini/u-boot/jobs/711313649 Signed-off-by: Tom Rini <trini@konsulko.com>
2020-07-20fdt_support: skip MTD node with "disabled" in fdt_fixup_mtdparts()Masahiro Yamada1-7/+10
Currently, fdt_fixup_mtdparts() only checks the compatible property. It is pointless to fix up the disabled node. Skip the node if it has the property: status = "disabled" Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-07-20fdt_support: call mtdparts_init() after finding MTD node to fix upMasahiro Yamada1-3/+8
Platform code can call fdt_fixup_mtdparts() in order to hand U-Boot's MTD partitions over to the Linux device tree. Currently, fdt_fixup_mtdparts() calls mtdparts_init() in its entry. If no target MTD device is found, an error message like follows is displayed: Device nand0 not found! This occurs when the same code (e.g. arch/arm/mach-uniphier/fdt-fixup.c) is shared among several boards, but not all of them support an MTD device. Parse the DT first, then call mtdparts_init() only when the target MTD node is found. Yet, you still need to call mtdparts_init() before device_find(). Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-07-20fdt_support: add static to fdt_node_set_part_info()Masahiro Yamada1-2/+2
This function is only called from fdt_fixup_mtdpart() in the same file. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-05-18common: Drop log.h from common headerSimon Glass1-0/+1
Move this header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-18common: Drop net.h from common headerSimon Glass1-0/+1
Move this header out of the common header. Network support is used in quite a few places but it still does not warrant blanket inclusion. Note that this net.h header itself has quite a lot in it. It could be split into the driver-mode support, functions, structures, checksumming, etc. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-12-06common: fdt_support: add support for setting usable memoryIgor Opaniuk1-0/+35
Add support for setting linux,usable-memory property in the memory node of device tree for the kernel [1]. This property holds a base address and size, describing a limited region in which memory may be considered available for use by the kernel. Memory outside of this range is not available for use. [1] https://www.kernel.org/doc/Documentation/devicetree/bindings/chosen.txt Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com> Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com> Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
2019-10-27fdt: Fix alignment issue when reading 64-bits properties from fdtJean-Jacques Hiblot1-1/+1
The FDT specification [0] gives a requirement of aligning properties on 32-bits. Make sure that the compiler is aware of this constraint when accessing 64-bits properties. [0]: https://github.com/devicetree-org/devicetree-specification/blob/master/source/flattened-format.rst Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-08-11env: Move env_get() to env.hSimon Glass1-0/+1
Move env_get() over to the new header file. Acked-by: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-24common: fdt_support: Add missing cpu_to_fdt32() to fdt_pci_dma_ranges()Marek Vasut1-11/+14
The fdt_pci_dma_ranges() cannot work on e.g. ARM, since the DT entries endianness is not adjusted at all. Fix this. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Tom Rini <trini@konsulko.com>
2019-07-24fdt: make fdt_get_base_address() return OF_BAD_ADDR when "reg" not foundMasahiro Yamada1-1/+1
Currently, fdt_get_base_address() returns 0 if the "reg" property is missing. Since 0 is a valid value, it is not suitable for the error handling. Return OF_BAD_ADDR instead. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-07-22dm: core: Introduce xxx_translate_dma_address()Fabien Dessenne1-0/+6
Add the following functions to translate DMA address to CPU address: - dev_translate_dma_address() - ofnode_translate_dma_address() - of_translate_dma_address() - fdt_translate_dma_address() These functions work the same way as xxx_translate_address(), with the difference that the translation relies on the "dma-ranges" property instead of the "ranges" property. Add related test. Test report: => ut dm fdt_translation Test: dm_test_fdt_translation: test-fdt.c Test: dm_test_fdt_translation: test-fdt.c (flat tree) Failures: 0 Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
2019-05-21common: fdt_support: Check mtdparts cell sizeStefan Mavrodiev1-9/+22
When using fdt_fixup_mtdparts() offset and length cell sizes are limited to 4 bytes (1 cell). However if the mtd device is bigger then 4GiB, then #address-cells and #size-cells are 8 bytes (2 cells) [1]. This patch read #size-cells and uses either fdt32_t or fdt64_t cell size. The default is fdt32_t. [1] Documentation/devicetree/bindings/mtd/partition.txt Signed-off-by: Stefan Mavrodiev <stefan@olimex.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-05-09fdt_shrink_to_minimum: do not mark fdt space reserved unconditionallySimon Goldschmidt1-4/+8
This function merely relocates the fdt blob, so don't let it alter it by adding reservations that didn't exist before. Instead, if the memory used for the fdt blob has been reserved before calling this function, ensure the relocated memory is marked as reserved instead. Reported-by: Keerthy <j-keerthy@ti.com> Reported-by: Lokesh Vutla <lokeshvutla@ti.com> Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
2019-04-11fdt: Remove duplicate codeThierry Reding1-6/+0
Commit 6d29cc7dcf2d ("fdt: Fixup only valid memory banks") ended up being merged twice, first as: commit 6d29cc7dcf2d35966aa0b6119fd1cbca0d21d5e6 Author: Thierry Reding <treding@nvidia.com> AuthorDate: Tue Jan 30 11:34:17 2018 +0100 Commit: Simon Glass <sjg@chromium.org> CommitDate: Sun Feb 18 12:53:38 2018 -0700 fdt: Fixup only valid memory banks Memory banks with address 0 and size 0 are empty and should not be passed to the OS via device tree. Signed-off-by: Thierry Reding <treding@nvidia.com> Acked-by: Stephen Warren <swarren@nvidia.com> and later again, though this time it was v2: commit ed5af03f9bb8905f1e94d68ab49f22d7f061d75f Author: Thierry Reding <treding@nvidia.com> AuthorDate: Thu Feb 15 19:05:59 2018 +0100 Commit: Tom Rini <trini@konsulko.com> CommitDate: Fri Feb 23 10:40:50 2018 -0500 fdt: Fixup only valid memory banks Memory banks with address 0 and size 0 are empty and should not be passed to the OS via device tree. Acked-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Thierry Reding <treding@nvidia.com> The second version was slightly different, so the main hunk of the patch was applied twice. This isn't harmful because the code is idempotent, but it's wasteful to run the same code twice. Signed-off-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-01-14common: fdt_support: print hexadecimal numbers in debugSekhar Nori1-2/+2
We usually deal with hexadecimal addresses and sizes in device-tree. Its much easier if debug logs print hexadecimal values too. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Sekhar Nori <nsekhar@ti.com> Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2018-12-02fdt_support: fdt reservations on the sandboxHeinrich Schuchardt1-1/+2
On the sandbox the memory addresses in the device tree refer to the virtual address space of the sandbox. This implies that the memory reservations for the fdt also have to be converted to this address space. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-09-10Remove <inttypes.h> includes and PRI* usages in printf() entirelyMasahiro Yamada1-10/+7
In int-ll64.h, we always use the following typedefs: typedef unsigned int u32; typedef unsigned long uintptr_t; typedef unsigned long long u64; This does not need to match to the compiler's <inttypes.h>. Do not include it. The use of PRI* makes the code super-ugly. You can simply use "l" for printing uintptr_t, "ll" for u64, and no modifier for u32. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-08-16fdt_support: Use CONFIG_NR_DRAM_BANKS if necessaryRamon Fried1-0/+4
If CONFIG_NR_DRAM_BANKS is bigger than the default value (4) define MEMORY_BANKS_MAX as CONFIG_NR_DRAM_BANKS. Fixes: 2a1f4f1758b5 ("Revert "fdt_support: Use CONFIG_NR_DRAM_BANKS if defined"") Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
2018-08-07common: fdt: Make fdt_del_subnodes/fdt_del_partition staticMichal Simek1-2/+2
These functions are only called in this file that's why make them static to keep static analysers happy. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-07-28Revert "fdt_support: Use CONFIG_NR_DRAM_BANKS if defined"Ramon Fried1-4/+0
This reverts commit 5e5745465c94605720295fab942eacbdd215db90. The reverted commit didn't support the scenario where there are less DRAM banks in U-Boot than in Linux. Also, it didn't introduce any new functionality, only limitaion. User could just increase MEMORY_BANKS_MAX if it's too small. Reviewed-by: Simon Glass <sjg@chromium.org>
2018-07-25fdt_support: make fdt_fixup_mtdparts() prototype more specificMasahiro Yamada1-6/+7
The second argument of fdt_fixup_mtdparts() is an opaque pointer, 'void *node_info', hence callers can pass any pointer. Obviously, fdt_fixup_mtdparts() expects 'struct node_info *' otherwise, it crashes run-time. Change the prototype so that it is compile-time checked. Also, add 'const' qualifier to it so that callers can constify the struct node_info arrays. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini1-2/+1
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
2018-03-05libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h>Masahiro Yamada1-1/+1
Thomas reported U-Boot failed to build host tools if libfdt-devel package is installed because tools include libfdt headers from /usr/include/ instead of using internal ones. This commit moves the header code: include/libfdt.h -> include/linux/libfdt.h include/libfdt_env.h -> include/linux/libfdt_env.h and replaces include directives: #include <libfdt.h> -> #include <linux/libfdt.h> #include <libfdt_env.h> -> #include <linux/libfdt_env.h> Reported-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2018-02-23fdt: Fixup only valid memory banksThierry Reding1-0/+7
Memory banks with address 0 and size 0 are empty and should not be passed to the OS via device tree. Acked-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
2018-02-18fdt: Fixup only valid memory banksThierry Reding1-1/+7
Memory banks with address 0 and size 0 are empty and should not be passed to the OS via device tree. Signed-off-by: Thierry Reding <treding@nvidia.com> Acked-by: Stephen Warren <swarren@nvidia.com>
2018-02-13spl: fit: move fdt_record_loadable out of ARCH_FIXUP_FDT_MEMORY guardPhilipp Tomsich1-39/+39
The fdt_record_loadable()-function was wedged between other functions that were guarded by ARCH_FIXUP_FDT_MEMORY. This could lead to linker errors on some configurations. With this change, fdt_record_loadable() is moved out of the ARCH_FIXUP_FDT_MEMORY guard (plus I tried to retain alphabetical ordering for functions by placing it appropriately). References: 9f45aeb ("spl: fit: implement fdt_record_loadable") Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reported-by: Michal Simek <michal.simek@xilinx.com> Tested-by: Michal Simek <michal.simek@xilinx.com>
2017-12-24common: Fix-up MAC addr in dts by fetching env variable seriallyPrabhakar Kushwaha1-4/+21
The MAC addresses get fixed in the device tree for "ethernet" nodes is by using trailing number behind "ethernet" found in "/aliases". It may not be necessary for the "ethernet" nodes to be sequential. There can be gaps in between or any node disabled So provide a support to fetch MAC addr sequentially from env and apply them to "ethernet" nodes in the order they appear in device tree only if "ethernet" is not "disabled" Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com> Reviewed-by: York Sun <york.sun@nxp.com>
2017-11-26spl: fit: implement fdt_record_loadablePhilipp Tomsich1-0/+39
During the loading of more complex FIT images (e.g. when the invoked next stage needs to find additional firmware for a power-management core... or if there are multiple images for different privilege levels started in parallel), it is helpful to create a record of what images are loaded where: if a FDT is loaded for one of the next stages, it can be used to convey the status and location of loadables. This adds a fdt_record_loadable() function that can be invoked to record the status of each loadable below the /fit-images path. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-09-15fdt: Introduce helper method fdt_overlay_apply_verbose()Pantelis Antoniou1-0/+31
Introduce fdt_overlay_apply_verbose, a method that applies an overlay but in the case of an error produces a helpful message. In addition if a base tree is found to be missing the __symbols__ node the message will point out that the probable reason is that the base tree was miscompiled without the -@ option. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Acked-by: Simon Glass <sjg@chromium.org>
2017-08-16env: Rename getenv/_f() to env_get()Simon Glass1-3/+3
We are now using an env_ prefix for environment functions. Rename these two functions for consistency. Also add function comments in common.h. Quite a few places use getenv() in a condition context, provoking a warning from checkpatch. These are fixed up in this patch also. Suggested-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org>
2017-08-01fdt: Correct fdt_get_base_address()Simon Glass1-5/+2
This function appears to obtain the value of the 'ranges' property rather than 'reg'. As such it does not behave as documented or expected. In addition it picks up the second field of the property which is the size (with prop += naddr) rather than the first which is the address. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-07-03powerpc: remove 4xx supportHeiko Schocher1-78/+0
There was for long time no activity in the 4xx area. We need to go further and convert to Kconfig, but it turned out, nobody is interested anymore in 4xx, so remove it. Signed-off-by: Heiko Schocher <hs@denx.de>
2017-06-01fdt: Rename a few functions in fdt_supportSimon Glass1-13/+13
These two functions have an of_ prefix which conflicts with naming used in of_addr. Rename them: fdt_read_number fdt_support_bus_default_count_cells Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01fdt: Update fdt_get_base_address() to use constSimon Glass1-1/+1
This function does not change the device tree so adjust it to use const for this parameter. Signed-off-by: Simon Glass <sjg@chromium.org>