summaryrefslogtreecommitdiff
path: root/include/fdtdec.h
AgeCommit message (Collapse)AuthorFilesLines
2021-07-27samsung: exynos: Convert SROMC interface to a driverSimon Glass1-2/+0
Add a bus driver for this and use it to configure the bus parameters for the Ethernet interface. Drop the old pre-driver-model code. Switch over to use driver model for Ethernet. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2021-04-29dm: core: Add size operations on device tree referencesChen Guanqiao1-2/+3
Add functions to add size of addresses in the device tree using ofnode references. If the size is not set, return FDT_SIZE_T_NONE. Signed-off-by: Chen Guanqiao <chenguanqiao@kuaishou.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-09-22fdtdec: optionally add property no-map to created reserved memory nodeEtienne Carriere1-2/+3
Add boolean input argument @no_map to helper function fdtdec_add_reserved_memory() to add or not "no-map" property for an added reserved memory node. Property no-map is used by the Linux kernel to not not map memory in its static memory mapping. It is needed for example for the| consistency of system non-cached memory and to prevent speculative accesses to some firewalled memory. No functional change. A later change will update to OPTEE library to add no-map property to OP-TEE reserved memory nodes. Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-08-25fdtdec: Add API to read pci bus-range propertySuneel Garapati1-0/+13
Add fdtdec_get_pci_bus_range to read bus-range property values. Signed-off-by: Suneel Garapati <sgarapati@marvell.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-08-20lib: fdt: Introduce fdtdec_setup_mem_size_base_lowest()Michal Simek1-0/+17
New function should be called from board dram_init() because it initialized gd->ram_base/ram_size. It finds the lowest available memory. On systems with multiple memory nodes finding out the first memory node by fdtdec_setup_mem_size_base() is not enough because this memory can be above actual U-Boot VA mapping. Currently only mapping till 39bit is supported (Full 44bit mapping was removed by commit 7985cdf74b28 ("arm64: Remove non-full-va map code")). If DT starts with the first memory node above 39bit address then system can be unpredictable. The function is available only when multiple memory bank support is enabled. Calling fdtdec_setup_memory_banksize() from dram_init() is not possible because fdtdec_setup_memory_banksize() is saving dram information to bd structure which is placed on stack but not initialized at this time. Also stack is placed at location setup in dram_init(). Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-07-25Revert "lib: fdt: Split fdtdec_setup_mem_size_base()"Michal Simek1-20/+0
This reverts commit 3ebe09d09a407f93022d945a205c5318239eb3f6. There is no user of this split function that's why remove it. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-07-25Revert "lib: fdt: Split fdtdec_setup_memory_banksize()"Michal Simek1-19/+0
This reverts commit 118f4d4559a4386fa87a1e2509e84a1986b24a34. There is no user of this split function that's why remove it. Signed-off-by: Michal Simek <michal.simek@xilinx.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-0/+39
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-20Revert "lib: fdt: Split fdtdec_setup_mem_size_base()"Michal Simek1-20/+0
This reverts commit 3ebe09d09a407f93022d945a205c5318239eb3f6. There is no user of this split function that's why remove it. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-07-20Revert "lib: fdt: Split fdtdec_setup_memory_banksize()"Michal Simek1-19/+0
This reverts commit 118f4d4559a4386fa87a1e2509e84a1986b24a34. There is no user of this split function that's why remove it. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-05-20fdtdec: Add weak function to patch U-Boot DT right after fdtdec_setup()Marek Vasut1-0/+5
Add weak function which is called right after fdtdec_setup() configured the U-Boot DT. This permits board-specific adjustments to the U-Boot DT before U-Boot starts parsing the DT. This could be used e.g. to patch in various custom nodes or merge in DT fragments from prior-stage firmware. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com>
2020-02-06dm: pci: Update a few more interfaces for const udevice *Simon Glass1-1/+1
Tidy up a few places where const * should be used. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-17common: Move embedded fdt location to fdtdec.hSimon Glass1-0/+3
These declarations are only used in fdtdec.c so move them to its header file. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-11-14fdtdec: only create phandle if caller wants it in fdtdec_add_reserved_memory()Heiko Stuebner1-1/+1
The phandlep pointer returning the phandle to the caller is optional and if it is not set when calling fdtdec_add_reserved_memory() it is highly likely that the caller is not interested in a phandle to the created reserved-memory area and really just wants that area added. So just don't create a phandle in that case. Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-11-14fdtdec: protect against another NULL phandlep in fdtdec_add_reserved_memory()Heiko Stuebner1-0/+1
The change adding fdtdec_add_reserved_memory() already protected the added phandle against the phandlep being NULL - making the phandlep var optional. But in the early code checking for an already existing carveout this check was not done and thus the phandle assignment could run into trouble, so add a check there as well, which makes the function still return successfully if a matching region is found, even though no-one wants to work with the phandle. Fixes: c9222a08b3f7 ("fdtdec: Implement fdtdec_add_reserved_memory()") Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-10-08dm: core: Drop fdtdec_get_pci_addr()Simon Glass1-17/+0
This function ise effectively replaced by ofnode_read_pci_addr() which works with flat tree. Delete it to avoid code duplication. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-08-26fdtdec: make CONFIG_OF_PRIOR_STAGE available in SPLLukas Auer1-1/+1
The current preprocessor logic prevents CONFIG_OF_PRIOR_STAGE from being used in U-Boot SPL. Change the logic to also make it available in U-Boot SPL. Signed-off-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Anup Patel <anup.patel@wdc.com>
2019-06-05fdtdec: Add fdtdec_set_ethernet_mac_address()Thierry Reding1-0/+24
This function can be used to set the local MAC address for the default Ethernet interface in its device tree node. The default interface is identified by the "ethernet" alias. One case where this is useful is for devices that store their MAC address in a custom location. Once extracted, board code can store the MAC address in U-Boot's control DTB so that it will automatically be used by the Ethernet uclass. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Tom Warren <twarren@nvidia.com>
2019-05-22fdtdec: Remove fdt_{addr,size}_unpack()Thierry Reding1-24/+0
U-Boot already defines the {upper,lower}_32_bits() macros that have the same purpose. Use the existing macros instead of defining new APIs. Signed-off-by: Thierry Reding <treding@nvidia.com>
2019-04-24fdtdec: Use fdt_setprop_u32() for fdtdec_set_phandle()Thierry Reding1-1/+4
The fdt_setprop_u32() function does everything that we need, so we really only use the function as a convenience wrapper, in which case it can simply be a static inline function. Signed-off-by: Thierry Reding <treding@nvidia.com>
2019-04-12fdtdec: Implement carveout support functionsThierry Reding1-0/+81
The fdtdec_get_carveout() and fdtdec_set_carveout() function can be used to read a carveout from a given node or add a carveout to a given node using the standard device tree bindings (involving reserved-memory nodes and the memory-region property). Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Thierry Reding <treding@nvidia.com>
2019-04-12fdtdec: Implement fdtdec_add_reserved_memory()Thierry Reding1-0/+48
This function can be used to add subnodes in the /reserved-memory node. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Thierry Reding <treding@nvidia.com>
2019-04-12fdtdec: Implement fdtdec_set_phandle()Thierry Reding1-0/+11
This function can be used to set a phandle for a given node. Signed-off-by: Thierry Reding <treding@nvidia.com>
2019-04-12fdtdec: Add fdt_{addr, size}_unpack() helpersThierry Reding1-0/+25
These helpers can be used to unpack variables of type fdt_addr_t and fdt_size_t into a pair of 32-bit variables. This is useful in cases where such variables need to be written to properties (such as "reg") of a device tree node where they need to be split into cells. Signed-off-by: Thierry Reding <treding@nvidia.com>
2019-04-12fdtdec: Add cpu_to_fdt_{addr, size}() macrosThierry Reding1-0/+4
These macros are useful for converting the endianness of variables of type fdt_addr_t and fdt_size_t. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Thierry Reding <treding@nvidia.com>
2019-04-09lib: fdt: Split fdtdec_setup_memory_banksize()Marek Vasut1-0/+19
Split fdtdec_setup_memory_banksize() into fdtdec_setup_memory_banksize_fdt(), which allows the caller to pass custom blob into the function and the original fdtdec_setup_memory_banksize(), which uses the gd->fdt_blob. This is useful when configuring the DRAM properties from a FDT blob fragment passed in by the firmware. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-04-09lib: fdt: Split fdtdec_setup_mem_size_base()Marek Vasut1-0/+20
Split fdtdec_setup_mem_size_base() into fdtdec_setup_mem_size_base_fdt(), which allows the caller to pass custom blob into the function and the original fdtdec_setup_mem_size_base(), which uses the gd->fdt_blob. This is useful when configuring the DRAM properties from a FDT blob fragment passed in by the firmware. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2019-02-11Merge branch 'master' of git://git.denx.de/u-boot-i2cTom Rini1-0/+13
- DM I2C improvements
2019-02-09fdt: tegra: Drop COMPAT_AMS_AS3722Simon Glass1-1/+0
This is no-longer used. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Lukasz Majewski <lukma@denx.de>
2019-02-09fdt: samsung: Drop unused fdt_compat_id valuesSimon Glass1-6/+0
This enum still exists but we can shrink it a little based on recent driver-model conversions with samsung. Update it to remove unused items. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Lukasz Majewski <lukma@denx.de>
2019-02-08fdt: Introduce fdtdec_get_alias_highest_id()Michal Simek1-0/+13
Find out the highest alias ID used for certain subsystem. This call will be used for alocating IDs for i2c buses which are not described in DT. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Heiko Schocher <hs@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-12-10lib: fdtdec: Add function re-setup the fdt more effecientlyJean-Jacques Hiblot1-0/+21
In some cases it may be useful to be able to change the fdt we have been using and use another one instead. For example, the TI platforms uses an EEPROM to store board information and, based on the type of board, different dtbs are used by the SPL. When DM_I2C is used, a first dtb must be used before the I2C is initialized and only then the final dtb can be selected. To speed up the process and reduce memory usage, introduce a new function fdtdec_setup_best_match() that re-use the DTBs loaded in memory by fdtdec_setup() to select the best match. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Heiko Schocher <hs@denx.de>
2018-11-21fdt: restore board_fdt_blob_setup() declarationBaruch Siach1-0/+1
Commit 90c08fa038451d (fdt: Add device tree memory bindings) removed the prototype declaration of board_fdt_blob_setup(), most likely by mistake. This didn't break the build because the only file calling this function (lib/fdtdec.c) provides a local weak definition. Restore the declaration. Cc: Michael Pratt <mpratt@chromium.org> Signed-off-by: Baruch Siach <baruch@tkos.co.il> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-10-09fdt: Remove fdtdec_decode_region() functionSimon Glass1-45/+0
This function is not used in U-Boot now. Remove it along with its 'memory' version. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-07-19lib: fdtdec: Rename routine fdtdec_setup_memory_size()Siva Durga Prasad Paladugu1-7/+9
This patch renames the routine fdtdec_setup_memory_size() to fdtdec_setup_mem_size_base() as it now fills the mem base as well along with size. Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Tom Rini <trini@konsulko.com>
2018-07-10board: arm: Add support for Broadcom BCM7445Thomas Fitzsimmons1-0/+4
Add support for loading U-Boot on the Broadcom 7445 SoC. This port assumes Broadcom's BOLT bootloader is acting as the second stage bootloader, and U-Boot is acting as the third stage bootloader, loaded as an ELF program by BOLT. Signed-off-by: Thomas Fitzsimmons <fitzsim@fitzsim.org> Cc: Stefan Roese <sr@denx.de> Cc: Tom Rini <trini@konsulko.com> Cc: Florian Fainelli <f.fainelli@gmail.com>
2018-07-09fdt: Add device tree memory bindingsMichael Pratt1-1/+37
Support a default memory bank, specified in reg, as well as board-specific memory banks in subtree board-id nodes. This allows memory information to be provided in the device tree, rather than hard-coded in, which will make it simpler to handle similar devices with different memory banks, as the board-id values or masks can be used to match devices. Signed-off-by: Michael Pratt <mpratt@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2018-05-18fdt: Add another Altera Arria10 clock init compatibleMarek Vasut1-0/+1
The DT bindings for the Arria10 clock init have changed, add another compatible to make them work with U-Boot until a proper clock driver gets written. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Tom Rini <trini@konsulko.com> Cc: Chin Liang See <chin.liang.see@intel.com> Cc: Dinh Nguyen <dinguyen@kernel.org>
2018-05-08lib: fdtdec: drop the old compatible about max77686Jaehoon Chung1-1/+0
Drop the old compatible about max77686. Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> Acked-by: Lukasz Majewski <lukma@denx.de>
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini1-1/+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-19sandbox: Add 64-bit sandboxMario Six1-1/+1
To debug device tree issues involving 32- and 64-bit platforms, it is useful to have a generic 64-bit platform available. Add a version of the sandbox that uses 64-bit integers for its physical addresses as well as a modified device tree. Signed-off-by: Mario Six <mario.six@gdsys.cc> Added CONFIG_SYS_TEXT_BASE to configs/sandbox64_defconfig Signed-off-by: Simon Glass <sjg@chromium.org>
2018-01-16fdtdec: allow board to provide fdt for CONFIG_OF_SEPARATERob Clark1-1/+2
Similar to CONFIG_OF_BOARD, but in this case the fdt is still built by u-boot build. This allows the board to patch the fdt, etc. In the specific case of dragonboard 410c, we pass the u-boot generated fdt to the previous stage of bootloader (by embedding it in the u-boot.img that is loaded by lk/aboot), which patches the fdt and passes it back to u-boot. Signed-off-by: Rob Clark <robdclark@gmail.com> [trini: Update board_fdt_blob_setup #if check] Signed-off-by: Tom Rini <trini@konsulko.com>
2017-11-26fdt: Add compatible strings for Arria 10Tien Fong Chee1-0/+2
Add compatible strings for Intel Arria 10 SoCFPGA device. Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com>
2017-09-15dtoc: Add support for 32 or 64-bit addressesSimon Glass1-0/+2
When using 32-bit addresses dtoc works correctly. For 64-bit addresses it does not since it ignores the #address-cells and #size-cells properties. Update the tool to use fdt64_t as the element type for reg properties when either the address or size is larger than one cell. Use the correct value so that C code can obtain the information from the device tree easily. Alos create a new type, fdt_val_t, which is defined to either fdt32_t or fdt64_t depending on the word size of the machine. This type corresponds to fdt_addr_t and fdt_size_t. Unfortunately we cannot just use those types since they are defined to phys_addr_t and phys_size_t which use 'unsigned long' in the 32-bit case, rather than 'unsigned int'. Add tests for the four combinations of address and size values (32/32, 64/64, 32/64, 64/32). Also update existing uses for rk3399 and rk3368 which now need to use the new fdt_val_t type. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: Heiko Stuebner <heiko@sntech.de> Reported-by: Kever Yang <kever.yang@rock-chips.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Tested-by: Kever Yang <kever.yang@rock-chips.com>
2017-07-28fdtdec: Drop old compatible valuesSimon Glass1-6/+0
These are not needed now since the drivers now use driver model. Drop them. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> Tested-on: Beaver, Jetson-TK1 Tested-by: Stephen Warren <swarren@nvidia.com>
2017-06-01cros_ec: Convert to support live treeSimon Glass1-13/+0
Convert this driver to support the live device tree and remove the old fdtdec support. The keyboard is not yet converted. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01dm: core: Add a place to put extra device-tree reading functionsSimon Glass1-22/+1
Some functions deal with structured data rather than simple data types. It makes sense to have these in their own file. For now this just has a function to read a flashmap entry. Move the data types also. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-05-15edid: Add HDMI flag to timing infoJernej Skrabec1-0/+1
Some DVI monitors don't show anything in HDMI mode since audio stream confuses them. To solve this situation, this commit adds HDMI flag in timing data and sets it accordingly during edid parsing. First existence of extension block is checked. If it exists and it is CEA861 extension, then data blocks are checked for presence of HDMI vendor specific data block. If it is present, HDMI flag is set. Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-05-10Allow boards to initialize the DT at runtime.Alex Deymo1-0/+6
In some boards like the Raspberry Pi the initial bootloader will pass a DT to the kernel. When using U-Boot as such kernel, the board code in U-Boot should be able to provide U-Boot with this, already assembled device tree blob. This patch introduces a new config option CONFIG_OF_BOARD to use instead of CONFIG_OF_EMBED or CONFIG_OF_SEPARATE which will initialize the DT from a board-specific funtion instead of bundling one with U-Boot or as a separated file. This allows boards like the Raspberry Pi to reuse the device tree passed from the bootcode.bin and start.elf firmware files, including the run-time selected device tree overlays. Signed-off-by: Alex Deymo <deymo@google.com> Reviewed-by: Simon Glass <sjg@chromium.org>