summaryrefslogtreecommitdiffstats
path: root/drivers/of
Commit message (Collapse)AuthorAgeFilesLines
* of: request reserved memory regions so other code can'tAhmad Fatoum2022-06-152-0/+72
| | | | | | | | | | | Add a new of_reserved_mem_walk that can be used to request reserved memory regions. This avoids e.g. bootm trying to place the kernel into a reserved region. Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220609111810.2454588-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: remove unused and misleading #cells in /memreserveAhmad Fatoum2022-06-101-11/+0
| | | | | | | | | | | | | | | | | | barebox creates a /memreserve node to hold FDT reservation entries inside its reg property for unflattened device trees that are copied back into the FDT reservation table on flattening. These reservation entries are pairs of big-endian 64-bit start+size pairs. To properly describe these in DT, we would need the (#address|#size)-cells properties at the root node, not in the same node having the reg property. As we don't read back these properties anyway, just drop them. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220609111810.2454588-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: address: fix printing of OF node name in error messageUwe Kleine-König2022-06-071-2/+2
| | | | | | | | | | barebox has no %pOF. Open code this instance to yield a better error message. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220603072307.1578650-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: address: treat absent dma-ranges as 1:1 translationLucas Stach2022-05-191-1/+4
| | | | | | | | | | Some DTs use dma-ranges in child busses without this property being present in the parent bus. To avoid failing the address translation, do the same as the Linux kernel and treat absence of this property as a 1:1 translation. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Link: https://lore.barebox.org/20220518175745.56467-1-l.stach@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of_net: add rev-rmii supportOleksij Rempel2022-04-141-0/+1
| | | | | | | | | Add support for the revert RMII device tree property. It is needed for SJA1105 switch driver. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Link: https://lore.barebox.org/20220413082205.429509-11-o.rempel@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/of-deep-probe'Sascha Hauer2022-03-144-9/+81
|\
| * of: platform: Ensure timers are probed earlySascha Hauer2022-03-081-0/+26
| | | | | | | | | | | | | | | | | | | | Timers are a very crucial resource and are needed early. Without them no delay function can work properly. With deep probe enabled they may be initialized very late in the initialization order. Make sure they are probed early. We do not know which device node provides the timer, so probe all nodes named "timer". Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * of: platform: Change of_devices_ensure_probed_by_property() return valueSascha Hauer2022-03-081-4/+3
| | | | | | | | | | | | | | | | | | | | of_devices_ensure_probed_by_property() returns with an error immediately when one the calls to of_device_ensure_probed() fails. This is not the desired behaviour. Instead, always call of_device_ensure_probed() on all found nodes and return unsuccessfully when at least one of the nodes failed. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * of: Add of_find_node_by_name() with Linux semanticsSascha Hauer2022-03-081-0/+38
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * of: rename of_find_node_by_name() to of_find_node_by_name_address()Sascha Hauer2022-03-084-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | of_find_node_by_name() has the same name as the corresponding kernel function but a different semantics. A node name is comprised of the nodes name and a unit address, separated with '@'. Linux of_find_node_by_name() matches only the name before the '@' whereas the barebox function compares the full name. As several callers depend on the barebox semantics we can't just change the semantics, so rename the barebox function to of_find_node_by_name_address(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * of: platform: return early when deep probe is not supportedSascha Hauer2022-03-081-0/+9
| | | | | | | | | | | | | | | | When deep probe is not supported we can bail out early from the of_devices_ensure_probed_by_* functions. This saves us from iterating over the whole device tree and then doing nothing on the found nodes. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | of: deep-probe: replace BUG() with more verbose panic()Ahmad Fatoum2022-03-081-1/+3
|/ | | | | | | | | In the case, we do hit this bug, the node name can be helpful, so print it out. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.barebox.org/20220302200801.657501-1-ahmad@a3f.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/tests'Sascha Hauer2022-02-181-4/+23
|\
| * of: silence of_diff output for negative indentsAhmad Fatoum2022-02-071-2/+14
| | | | | | | | | | | | | | | | | | | | | | Negative indents just led to strange behavior so far. Repurpose them to mean that the caller is not interested in console output. This makes them useful for negative tests (Sanity check that two different nodes are indeed different). Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220207082801.1052894-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * of: report whether of_diff found differences in return codeAhmad Fatoum2022-02-071-3/+10
| | | | | | | | | | | | | | | | | | | | | | Tests may want to leverage of_diff to verify that fixups proceeded as expected. of_diff lends itself nicely to that by being silent in case of success and just reporting diff on error. Add a return code to make it usable in follow-up tests. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220207082801.1052894-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2022-02-181-1/+1
|\ \
| * | of_path: Fix typoSascha Hauer2022-02-041-1/+1
| |/ | | | | | | | | | | | | | | parition -> partition Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> parition# arch/arm/boards/globalscale-mirabox/binary.0
* / driver: Add functions to free devicesSascha Hauer2022-02-082-2/+3
|/ | | | | | | | | | | | | | | | | struct device_d has some dynamically allocated members, namely .name and .unique_name. These are normally not freed when a device is freed. Add two functions to free these resources. free_device_res() only frees the allocated members, but not the device itself. This is suitable for cases where the device is embedded in another struct. free_device() frees the allocated members along with the device itself. This can be called when the device itself has been directly allocated. Some users which should use these functions are also fixed in this patch. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20220207094953.949868-5-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Revert "clk: handle CLK_OF_DECLARE in deep probe"Sascha Hauer2022-01-181-4/+1
| | | | | | | | | | | | | | This issue is now solved differently in: | commit 2f9aeab92f51d7b224468f6cd62d7cbbb05ceb1e (master) | Author: Lucas Stach <dev@lynxeye.de> | Date: Sun Jan 16 22:32:19 2022 +0100 | | clk: ignore of_device_ensure_probed error in clock lookup This reverts commit bd516e38dd1490cb83b58f8f7914912f3a702978. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: add trailing 0 in of_property_sprintf()Ahmad Fatoum2022-01-141-0/+2
| | | | | | | | | Otherwise, tools like of_dump will consider the output to be byte arrays. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.barebox.org/20220114085735.731631-1-ahmad@a3f.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2021-12-1518-40/+52
|\
| * commands: of_diff: don't mix tabs and spaces for indentationAhmad Fatoum2021-12-131-13/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Nodes are indented with spaces, while properties are indented with tabs, leading to discrepancies when the indentation doesn't start at a tab stop, like when using of_diff: chosen { + barebox-version = "barebox-2021.06.0-20210716-2"; + reset-source = "POR"; + reset-source-instance = <0x0>; + subnode { Fix this by using spaces throughout. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211209105739.3517998-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * of: make of_dump abortable by ctrlc()Ahmad Fatoum2021-12-131-3/+10
| | | | | | | | | | | | | | | | | | | | Some device trees can be quite long, e.g. because they contain all possible pinmux entries. Writing that out over serial can take quite a while. Check for ctrlc() between nodes to make these less annoying. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211209105727.3517863-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * of: overlay: rescan aliases calling of_overlay_apply_tree on live treeAhmad Fatoum2021-12-071-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Couple of drivers in-tree, like state, depend on aliases for correct operation. If state node is added via overlay and oftree -p is called, driver would start probing, but fail because aliases weren't reloaded. Fix this corner case by always just calling of_alias_scan() on every successful of_overlay_apply_tree to the live tree. No functional change yet, as the only user of this function is overlay application code of ARM QEMU machine, which happens at pure_initcall level, making of_alias_scan a no-op. Follow-up commit will move overlay application to happen after device tree is registered, necessitating this change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211125161042.3829996-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * of: base: improve documentation of global exportsAhmad Fatoum2021-11-301-4/+8
| | | | | | | | | | | | | | | | | | Most comments are probably from the initial Linux port. Fix some discrepancies and add docs for barebox-specific of_probe. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211125160637.3828394-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * of: skip machine device creation on subsequent of_probeAhmad Fatoum2021-11-301-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | of_probe may be called more than once, e.g. after oftree -p or by board code after fixing up device tree. This currently leads to a harmless, but annoying error message about machine already being registered. Avoid this by creating the device only once. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211125160637.3828394-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * of: address: mark 64-bit PCI resources explicitly as suchAhmad Fatoum2021-11-221-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | Eventually, we shouldn't need this, when all code can deal with 64-bit addresses. For now, PCI drivers, when given the choice between 32-bit and 64-bit resources, should select the 32-bit one. This patch makes the resources straight forward to compare. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Link: https://lore.barebox.org/20211118062546.1380928-1-ahmad@a3f.at Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * drivers: migrate "GPL-2.0" license identifiers to SPDX 2.0Roland Hieber2021-11-2218-18/+18
| | | | | | | | | | | | | | | | | | | | "GPL-2.0-only" was introduced in SPDX 2.0, and the old identifier "GPL-2.0" is now considered deprecated; see <https://spdx.org/licenses>. Fixes: 28f4a6a4df76f0f1581d (2021-10-30, "drivers: add missing SPDX-License-Identifier") Signed-off-by: Roland Hieber <rhi@pengutronix.de> Link: https://lore.barebox.org/20211117113851.2022669-2-rhi@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | of: implement new of_property_sprintfAhmad Fatoum2021-12-141-10/+47
|/ | | | | | | | | | | Board code may compute values for device tree properties and write them as strings. Make this easier by adding a of_property_write_string variant that does formatted output. This also saves an allocation, because asprintf buffer is reused. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211209105708.3517684-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/spdx'Sascha Hauer2021-11-1515-70/+17
|\
| * drivers: add missing SPDX-License-IdentifierAhmad Fatoum2021-11-0115-70/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the suitable SPDX-License-Identifier to all files in drivers/ that previously lacked one. To aid manual inspection, following heuristics can be used: * No changes outside of comments/whitespace: git show -U0 HEAD | rg -v '^(@@|diff|index)|[-+]([-+]|//|#|[\s/]\*)' * -or-later come in pairs: git show --inter-hunk-context=19 HEAD | \ perl -0777 -F'/^@/gm' -ne 'for (@F) { @m = /later/g; print if @m & 1 }' Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211030175632.2276077-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/rockchip'Sascha Hauer2021-11-151-1/+4
|\ \
| * | clk: handle CLK_OF_DECLARE in deep probeAhmad Fatoum2021-11-101-1/+4
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An assigned-clock-parents referring to a fixed-clock will result in a warning: WARNING: clk: couldn't get parent clock 0 for /ethernet@fe300000 That's because the device for the fixed clock is created on demand and even after ensuring probe, no driver will have bound against it as CLK_OF_DECLARE operates outside the driver model. Fix this by creating devices and binding the dummy driver while iterating over the CLK_OF_DECLARE list. No functional change for systems not enabling deep-probe. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211108075209.2366770-7-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / of: partitions: Skip fixup for devices with no partitionsTrent Piepho2021-10-121-0/+3
|/ | | | | | | | | | | | | | | | | If the device has no partitions, e.g. most EEPROM or OTP memory, of_partition_fixup() can exit early, before trying to find the kernel dt node and calling of_fixup_partitions(). This avoids spurious error messages when the kernel dt node doesn't exist. E.g., for an EEPROM in the Barebox dtb but not in the kernel dtb, Barebox will display an error about being unable to fixup the kernel dt node, however, if it had found the node it would just return without doing anything since the partition list is empty, so really there is no error. Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com> Link: https://lore.barebox.org/20211011191933.857941-1-trent.piepho@igorinstitute.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: overlay: don't do fixups on empty global.of.overlay.dirAhmad Fatoum2021-10-041-0/+3
| | | | | | | | | | | | | | | | | | | | | | | $global.of.overlay.dir is dynamically prepended with the root of the device currently being booted. This allows use of relative paths. Because $global.of.overlay.filepattern is * by default, this means that all files in the root of the device will be considered overlays and barebox will try to unflatten them leading to an error message on boot: ERROR: of_overlay: Failed to unflatten /mnt/mmc0.4//.root_is_rw: Invalid argument Fix this by not doing any fixups at all on empty global.of.overlay.dir. If for whatever reason, a user wants overlays at /, they can global.of.overlay.dir=. Fixes: 124c64af0982 ("overlay: Add filters to choose which overlays to apply") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210831161139.2988-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: partition: implement of_partition_ensure_probedAhmad Fatoum2021-07-181-0/+11
| | | | | | | | | | | | | | The device tree nodes for both barebox environment and state can have phandles that reference partitions. Environment runs at late_initcall level, so deep probe will have populated the device by the time the probe is called. barebox-state however is probed at device_initcall level and thus must take care itself to ensure the partition provider is probed. Add a new of_partition_ensure_probed that does this. It can handle both legacy and new style (fixed) partitions. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210628064517.28636-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/nvmem'Sascha Hauer2021-07-183-18/+88
|\
| * of: of_net: sync of_get_mac_address with Linux for NVMEM supportAhmad Fatoum2021-06-221-14/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't use of_get_mac_address anywhere, but it can come in handy as a last resort before barebox generates a random MAC address. With the existing implementation, that MAC address is written literally into the DT, so it's mainly useful when barebox is booted with an external device tree. The kernel implementation adds support for parsing the MAC address out of a revered mac-address nvmem cell, which is much more prevalent. Sync the implementation with Linux v5.13 in preparation for using it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210619034516.6737-12-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * nvmem: add support for nvmem-cells bindingAhmad Fatoum2021-06-211-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | Recently, nvmem cell and MTD partition bindings were made to coexist: Partitions can now be compatible = "nvmem-cells"; which registers a NVMEM provider and interprets its child nodes as cells. Teach barebox about this. This allows fetching NVMEM cells from MTD partitions and hostfiles. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210619034516.6737-5-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * nvmem: add support for new read-only memory (rmem) bindingAhmad Fatoum2021-06-211-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | Only upstream user of this binding is the raspberry pi 4 DT, where it's used to pass along bootloader-provided info to Linux. We have instances in barebox, where a previous stage bootloader passes along a memory region with info for barebox to interpret. This could in future be modelled as nvmem-rmem nodes. The binding is also quite handy for debugging. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210619034516.6737-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/firmware'Sascha Hauer2021-07-185-51/+467
|\ \
| * | of_firmware: Fix handling of firmware-name propertySascha Hauer2021-06-281-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fpga-region binding states that the firmware-name property must be in the same node as the fpga-region compatible, so checking for this compatible when walking up the parents is wrong. Instead, only test for it in the target node. Also, when the current node is not a fpga-region we must return successfully. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210624085223.14616-19-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | overlay: Add filters to choose which overlays to applySascha Hauer2021-06-281-1/+313
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a filter mechanism to choose which overlays to apply. Filters can either match on the filename or on the content of an overlay. Two generic filters are registered, one matching filename patterns given in global.of.overlay.filepattern, the other matching device tree compatibles given in global.of.overlay.compatible. Other board or SoC specific filters can be registered and activated using the global.of.overlay.filter variable. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210624085223.14616-15-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | blspec: Rework firmware loadSascha Hauer2021-06-282-24/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Applying overlays in blspec currently works in two steps. First of_firmware_load_overlay() is called which doesn't load an overlay, but instead loads firmware when one is needed by the overlay. This is done on the live tree, because that was needed to find the firmware manager. The second step is to call of_register_overlay() to apply the overlay to the kernel device tree when the fixups are executed. Instead of using a separate step to load the firmware, load the firmware as part of the of_fixups. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210624085223.14616-14-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | firmware: Load from global search pathSascha Hauer2021-06-251-21/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have a global firmware search path, so use it. This removes the path argument from of_firmware_load_overlay(). blspec already extends the global firmware search path, so the path is not needed there. The of_overlay command has an option for specifying the search path, this is removed here, the global search path has to be used instead. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210624085223.14616-13-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | overlay: Add of_overlay_apply_file()Sascha Hauer2021-06-251-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | A shortcut to of_overlay_apply_tree() which takes a filename rather than an unflattened device tree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210624085223.14616-12-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | fdt: Check blob size during unflatteningSascha Hauer2021-06-252-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of_unflatten_dtb() doesn't check the size of the device tree blob passed to it. Add a size argument end add checks for the size. Some callers have no idea of the buffer size themselves, INT_MAX is passed in these cases. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210624085223.14616-4-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | of: Add function to duplicate a device treeSascha Hauer2021-06-251-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds of_dup() to duplicate a device tree. Previously of_copy_node() was used for this, but of_copy_node() has issues with potentially duplicated phandle values when the new tree is inserted to an existing tree, that is when the parent argument of of_copy_node() is non NULL. All users of of_copy_node() with a NULL parent argument are converted to of_dup() which is safe to use leaving only the problematic users of of_copy_node(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210624085223.14616-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | of: of_copy_node(): Copy phandles as wellSascha Hauer2021-06-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of_copy_node() has to copy the phandles as well, because otherwise the phandles in the copied tree become invalid. This is not entirely correct because when of_copy_node() is used to copy one tree as a subtree of another tree then we might get duplicated phandles which will result in a corrupted tree. This is also an issue already without this patch, because the phandle of a node is not only stored in the phandle member of a struct device_node, but also as a separate phandle property in the tree itself. The phandle property is copied before this patch, so we can equally well also copy the phandle member of struct device_node. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210624085223.14616-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | of: kconfig: of_overlay uses firmwaremgr_load_fileSteffen Trumtrar2021-06-211-0/+1
| |/ | | | | | | | | | | | | | | | | As of_firmware.c uses the firmwaremgr_load_file function, it depends on FIRMWARE. Signed-off-by: Steffen Trumtrar <str@pengutronix.de> Link: https://lore.barebox.org/20210616063246.14900-6-s.trumtrar@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>