summaryrefslogtreecommitdiffstats
path: root/drivers/of
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-next/mtd-nand'Sascha Hauer2020-11-101-0/+3
|\
| * mtd: nand: Update to Linux-5.9Sascha Hauer2020-11-101-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This updates the barebox NAND layer and parts of the mtd layer to Linux-5.9. This patch is huge, but the barebox NAND layer is so far away from the Linux NAND layer that a step by step update would have taken ages. Unlike Linux barebox has functions to mark a block as good. This feature has been preserved. Also barebox used to make NAND write support optional, this feature is lost during the update for the sake of better compatibility to the Linux NAND layer. This patch has been tested: - GPMI aka nand_mxs on i.MX6 - nand_imx on i.MX25 - nand_omap_gpmc on AM335x - atmel_nand on Atmel sama5d3 - nand_denali on SoCFPGA Currently untested: - nand_orion - nand_mrvl_nfc - nand_s3c24xx The nand_denali driver is tested with the update of that driver to Linux-5.9 following in the next patch. I could only test the drivers with the NAND chips found on my boards, so there's still enough room for regressions, especially given that the NAND drivers themselves are mostly not updated. With the NAND layer being up-to-date with Linux it should hopefully be easy to update drivers to their Linux counterpart as well if necessary. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | of: base: ignore disabled memory nodesRouven Czerwinski2020-11-091-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Qemu with the secure extension enabled will insert a secram node into the device tree: secram@e000000 { secure-status = "okay"; status = "disabled"; reg = <0x0 0xe000000 0x0 0x1000000>; device_type = "memory"; }; Barebox would previously parse this node, add it as a memory bank and than reinsert an enabled node into the fixed up device tree. Fix this by skipping disabled memory nodes. Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/sandbox' into masterSascha Hauer2020-10-141-0/+65
|\ \
| * | of: implement of_property_read_u64_arrayAhmad Fatoum2020-10-131-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | For reading reg with #address-cells and #size-cells of 2, an of_property_read_u64_array can be quite convenient. Add one. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | of: Add common device tree register functionSascha Hauer2020-10-121-0/+28
| |/ | | | | | | | | | | | | | | The different architectures duplicate some code around unflattening and registering the device tree. Add common functions to reduce this duplication. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc' into masterSascha Hauer2020-10-141-0/+48
|\ \
| * | of: implement of_property_write_strings for multiple stringsAhmad Fatoum2020-10-021-0/+48
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current way to set a property with multiple values (e.g. compatible strings) is to have char properties[] = "st,stm32mp157c-dk2\0st,stm32mp157"; of_set_property(np, "compatible", properties, sizeof(properties), 1); Add a new helper to make this easier at the cost of one runtime reallocation: of_property_write_strings(np, "compatible, "st,stm32mp157c-dk2", "st,stm32mp157", NULL); Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / of: platform: fix of_amba_device_create stub return valueMarco Felsch2020-09-291-1/+1
|/ | | | | | | | The stub should have the same function signature as the non-stub function. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: of_device_get_match_compatible() helperOleksij Rempel2020-08-241-0/+12
| | | | | | | | | Some times we need to know, against which compatible did the driver was registered. So, instead of coding it in the driver, add generic helper for all drivers. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: base: register DT root as deviceOleksij Rempel2020-08-241-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A usual board file contains at least one of_machine_is_compatible(). Some of the have a rather long list with complicated version logic. To avoid own implementation for driver management, register the root node of device tree as platform device. So, the main platform bus can attach proper board driver. After this patch a typical board.c file can reuse existing driver infrastructure. After this patch, you will be able to see all registered board drivers with drvinfo as fallow: ... board-embest-riot board-protonic-imx6 machine ... With devinfo, you'll be able to get some board specific information, if this is implemented: barebox@Protonic PRTI6Q board:/ devinfo machine Driver: board-protonic-imx6 Bus: platform Parameters: boardid: 0 (type: uint32) boardrev: 1 (type: uint32) Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2020-05-147-21/+0
|\
| * treewide: remove references to CREDITSUwe Kleine-König2020-04-277-21/+0
| | | | | | | | | | | | | | | | The CREDITS file was removed from barebox in 2015 by commit 6570288f2d97 ("Remove the CREDITS file"). Remove references to it from several files. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | net: remove unused Kconfig optionsAhmad Fatoum2020-04-291-4/+0
|/ | | | | | | | | | | | Both options are used nowhere and can be dropped: - OF_NET code is compiled always and code is discarded at link-time if unreferenced - Designware Ethernet can be enabled in Kconfig and no arch code selects the symbol Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/pwm'Sascha Hauer2020-04-161-0/+32
|\
| * of: introduce of_property_count_elems_of_sizeAhmad Fatoum2020-03-311-0/+32
| | | | | | | | | | | | | | Import the Linux helper, so code using it may be more easily ported. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2020-04-163-15/+24
|\ \
| * | of: overlay: fix uninitialized read of variableAhmad Fatoum2020-04-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | When there are no fragments, we return an uninitialized err. Initialize err as zero, so it's returned in that case. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | of: use of_get_child_by_name() to find child nodeMichael Tretter2020-04-141-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After iterating the children of a node with for_each_child_of_node(), the child node will never be NULL. If the node was not found, overlay_child will always point to the first element in the list, which might or might not be the node that was searched. Use the of_get_child_by_name() helper function to find the child node with the name, which does the right thing and returns NULL if the node is not found. Reported-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | of: base: parse all available memory nodesClement Leger2020-03-301-6/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, barebox only parse one memory node which is either the "/memory" node or the first node with device_type == "memory". However, the use of multiple memory nodes with device_type = "memory" property is allowed by the device tree specification and already correctly parsed by Linux kernel. In order to fix that, add of_probe_memory function which loop over all available memory nodes matching device_type == "memory". Signed-off-by: Clement Leger <cleger@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | of: base: allow of_add_memory to be called multiple timesClement Leger2020-03-301-5/+6
| |/ | | | | | | | | | | | | | | | | | | | | | | Currently, of_add_memory can't be called multiple times because it will always create memory banks by restarting at value 0. This means that, when adding a second memory bank by calling again of_add_memory, it will be named ram0 and overwrite the previous one. Fix that by using a static variable to store the current memory bank number in order to be preserved from one call to another. Signed-off-by: Clement Leger <cleger@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/kalray-coolidge'Sascha Hauer2020-04-161-1/+1
|\ \
| * | kvx: Initial Kalray Coolidge (kv3) architecture supportClement Leger2020-04-151-1/+1
| |/ | | | | | | | | | | | | Add kalray coolidge arch/ support. Signed-off-by: Clement Leger <cleger@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / of: port Linux of_get_compatible_child helperAhmad Fatoum2020-04-151-0/+25
|/ | | | | | | | Incoming Linux code port makes use of the helper. Add it now instead of having to open-code it later. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: overlay: rework error message for symbolsRouven Czerwinski2020-03-091-11/+7
| | | | | | | | | | Missing symbols for overlay or root tree are valid if the overlay only adds paths to the device tree. The code handles this correctly, however it still isues a WARNING for the missing symbols. Demote the warning to info and move into the of_overlay_apply_symbols() function. Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: add missing newline to pr_warnRouven Czerwinski2020-02-251-1/+1
| | | | | | | Add a missing newline to the pr_warn call while applying the overlays. Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/rpi'Sascha Hauer2020-01-153-18/+155
|\
| * of: Read dma_offset from device treeSascha Hauer2019-12-202-0/+127
| | | | | | | | | | | | | | | | | | This reads the dma-ranges property from the device tree and sets dma_offset in the devices accordingly. The code is mostly taken from the Kernel as of v5.5-rc1. of_dma_configure() is trimmed down to the cases we want to support currently. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * of: Add of_bus_n_xxx_cells()Sascha Hauer2019-12-201-18/+28
| | | | | | | | | | | | Added straight from the Kernel. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | of: demote most debug output to loglevel 8 (vdebug)Roland Hieber2019-12-111-12/+12
|/ | | | | | | | | | | Loglevel 7 (debug) is often useful to get barebox running on new hardware; however, the heavy output of "OF:" messages makes most boards take several minutes to boot to a prompt, printing things which are probably interesting when debugging OF code itself, but not very helpful otherwise. Degrade most of the message to loglevel 8 (vdebug). Signed-off-by: Roland Hieber <rhi@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: Add of_property_read_string_array()Sascha Hauer2019-11-271-85/+37
| | | | | | | | | | of_property_read_string_array() is used to read a multistring device tree property into an array of strings. This is taken from the kernel. It is implemented around of_property_read_string_helper() which can be used to implement of_property_count_strings() and of_property_read_string_index() as well. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: of_path: fix return in case of EPROBE_DEFERMarco Felsch2019-11-041-1/+1
| | | | | | | | | As said in commit 82eb3dff10 ("of_path: handle no driver for device") this case happens if the driver isn't probed yet. So we should return -EPROBE_DEFER to signal that. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* OF: gpio: don't warn if ignored GPIO flag matches the behaviorLucas Stach2019-11-041-2/+4
| | | | | | | | | | | | | | | Port of the upstream accepted change to the Linux kernel. Some devicetrees specify the ACTIVE_LOW flag in the fixed regulator GPIO handle. While this has always been ignored, it's consistent with the behavior of the regulator binding in the absence of the "enable-active-high" DT property. It doesn't make much sense to print a user visible warning for a configuration which is consistent, so only print the warning if the GPIO flag contradicts the behavior dictated by by the enable-active-high property. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/remoteproc'Sascha Hauer2019-10-171-1/+2
|\
| * of: base: don't try to read cells_name property if no cells_name setOleksij Rempel2019-09-261-1/+2
| | | | | | | | | | | | | | | | | | Some device tree node parsed by of_count_phandle_with_args() have no #*-cells parameter. To make linux device trees work with barebox, we should accept cells_name set to NULL, so sync this behavior with linux. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/of-overlay'Sascha Hauer2019-10-175-0/+638
|\ \
| * | dtc: optionally add add __symbols__ to build-in devicetreeMichael Tretter2019-09-161-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The devicetree overlay driver requires the __symbols__ node to resolve phandles to the base devicetree. If Barebox has to apply the overlay to the live devicetree, the build-in devicetree must be built with the __symbols__ node. It is configurable, because adding __symbols__ significantly increases the size of the devicetree binary. When configuring Barebox, a developer should be able to enable or disable devicetree overlay support and as this only affects the build-in devicetree, which is linked to the image anyway, use a Kconfig item for configuring the __symbols__. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | firmware: add support to load firmware from dt overlayMichael Tretter2019-09-162-1/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fpga-region device tree nodes have the firmware-name property that contains the file name of firmware in the firmware search path (but not the path) that shall be loaded before the overlay is applied. Add the of_firmware_load_overlay() function that accepts an overlay and a firmware search path, finds the responsible firmware_mgr and loads the firmware. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | of: add iterator for overlaysMichael Tretter2019-09-161-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Device tree overlays (the dto files) may contain multiple fragments for different target nodes. Each fragment contains a __overlay__ node that is applied to target node specified in the fragment. Add a helper to call a function for each fragment in a device tree overlay to avoid having device tree overlay internal information in other modules. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | of: add support for devicetree overlaysMichael Tretter2019-09-164-0/+498
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | The devicetree overlay support is based on the Linux driver for device tree overlays, but many features that are not required in Barebox are left out. Unlike Linux, which applies the overlay to the live devicetree, Barebox registers a fixup for the overlay which is applied with other fixups to whatever tree is fixed. This is necessary to apply the overlay to devicetrees that are passed to Linux, which might differ from the devicetree that is currently live in Barebox. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | of: add of_diff()Sascha Hauer2019-09-121-10/+131
| | | | | | | | | | | | | | of_diff compares two device trees against each other and prints a diff-like result. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | of: Fix memory hole in of_find_node_by_reproducible_name()Sascha Hauer2019-09-121-2/+10
|/ | | | | | | of_get_reproducible_name() returns an allocated string, so we must free it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* OF: gpio: Add special quirk to parse regulator flagsOleksij Rempel2019-07-171-1/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To make fec work with devicetree on imx28-evk, partially port following kernel patch: |commit a603a2b8d86ee93ee2107da8ca75fd854fd4ff32 |Author: Linus Walleij <linus.walleij@linaro.org> |Date: Sat Dec 30 16:26:36 2017 +0100 | | gpio: of: Add special quirk to parse regulator flags | | While most GPIOs are indicated to be active low or open drain using | their twocell flags, we have legacy regulator bindings to take into | account. | | Add a quirk respecting the special boolean active-high and open | drain flags when parsing regulator nodes for GPIOs. | | This makes it possible to get rid of duplicated inversion semantics | handling in the regulator core and any regulator drivers parsing | and handling this separately. | | Unfortunately the old regulator inversion semantics are specified | such that the presence or absence of "enable-active-high" solely | controls the semantics, so we cannot deprecate this in favor | of the phandle-provided inversion flag, instead any such phandle | inversion flag provided in the second cell of a GPIO handle must be | actively ignored, so we print a warning to contain the situation | and make things easy for the users. | | Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: partition: use NULL instead of never-read argumentAhmad Fatoum2019-05-241-3/+3
| | | | | | | | len isn't read afterward and of_get_property accepts NULL as third argument, so do it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/zynqmp'Sascha Hauer2019-04-091-1/+5
|\
| * of: populate "/firmware" while populating device treeThomas Haemmerle2019-03-181-1/+5
| | | | | | | | | | | | | | | | | | | | | | The sub-nodes of "/firmware" are not populated, since it has no "compatible" property. Copy the behavior of Linux and call of_platform_populate() on the "/firmware" node to probe firmware drivers. Signed-off-by: Thomas Haemmerle <thomas.haemmerle@wolfvision.net> Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | of: Fix reproducible names for #address-cells != 1Sascha Hauer2019-03-181-2/+2
|/ | | | | | | | | | | | | | For the new "fixed-partitions" binding we ignore the partitions subnode for creating reproducible names and set node to its parent. To get the number of address cells we must call of_n_addr_cells() before setting node to its parent though, not afterwards. With the current behaviour we always get OF_ROOT_NODE_ADDR_CELLS_DEFAULT (=1). This happens to work then the partitioned device is less than 4GiB in size. On bigger devices #address-cells = <2> is chosen by the mtd partition fixup code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reported-by: Bastian Krause <bst@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2019-02-131-1/+11
|\
| * net: Phy: Update phy interface modes from LinuxSascha Hauer2019-02-061-1/+11
| | | | | | | | | | | | | | | | | | This syncs the phy interface modes with Linux and adds names that were previously missing. With this we no longer have holes in the phy mode name arrays and thus of_get_phy_mode no longer derefences NULL pointers when it finds such a hole. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | drivers: of: Add function to enable and register a device by aliasTeresa Remmet2019-02-131-0/+19
|/ | | | | | | | In some cases node names are not unique and passing the full path is really long. So make add a new device by passing the alias string possible. Signed-off-by: Teresa Remmet <t.remmet@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>