summaryrefslogtreecommitdiffstats
path: root/drivers/of
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* Add initial RISC-V architecture supportAntony Pavlov2019-01-071-1/+1
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: Add .of suffix to device names from devicetreeSascha Hauer2018-12-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | Previous implementation used to add a number to the device names for devices registered from the device tree which did not have a 'reg' property, thus a device node named "state" resulted in a device name "state.<x>". Current implementation skips that number and we get a device named "state". This conflicts with our barebox state implementation which tries to register a device named "state" itself. We could rename the state device nodes of all our device trees, but it causes less trouble to rename the devices. This adds a ".of" suffix to the device names for devices registered from the device tree which also has the nice effect that they now can easily be recognized. Fixes: 7e497d48acbd11 ("of: Port latest of_device_make_bus_id() implementation") Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Cc: Andrey Smirnov <andrew.smirnov@gmail.com> Cc: Jan Lübbe <jlu@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: partition: set ret for error casesOleksij Rempel2018-11-191-2/+2
| | | | | | | looks like it was forgotten. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/state'Sascha Hauer2018-11-091-0/+12
|\
| * of: fix reproducible node name for legacy vs. new partition bindingSascha Hauer2018-10-181-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the of_reproducible_name mechanism is used to find a partition node from the barebox devicetree in the Linux devicetree. Unfortunately we have two different partition bindings. In the legacy one the partition nodes are directly under the hardware devicenode whereas in the new binding the partitions are under an additional partitions subnode. This means we get two different (not so) reproducible names when the barebox devicetree uses the legacy binding and the Linux devicetree uses the new binding (or the other way round). To get the same name then for these cases we drop the partitions subnode from the reproducible name. This makes the partition fixup in barebox-state work when the barebox devicetree uses another binding than the Linux devicetree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Tested-by: Ulrich Ölmann <u.oelmann@pengutronix.de> Tested-by: Gavin Schenk <g.schenk@eckelmann.de
* | Merge branch 'for-next/net-switch-mv88e6xxx'Sascha Hauer2018-11-092-60/+24
|\ \
| * | of: Port latest of_device_make_bus_id() implementationAndrey Smirnov2018-10-181-58/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Code implementing of_device_make_bus_id() in Barebox uses rather old implementation from Linux kernel and has a very significan limitation in that it will produce identical names for different DT nodes that happen to have the same node name as well as "reg" property. One such example, that tirggered this change, is "switch@0" nodes that can be found in dts/src/arm/vf610-zii-dev-rev-c.dts This commit replaces original code with the current Linux kernel implementation that traverses DT hierarchy from leaf node to its root concatenating node names in the process. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | drivers: Introduce dev_set_name()Andrey Smirnov2018-10-181-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | Introduce dev_set_name() in order to hide implementation details of setting device's name so it'd be easier to change it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | of: Demote "Bad cell count for" to debugAndrey Smirnov2018-10-181-2/+2
| |/ | | | | | | | | | | | | | | | | There are valid use-cases where getting OF_BAD_ADDR via that codepath is expected. In addition to that analogous code in Linux kernel uses pr_debug as well. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2018-11-091-1/+1
|\ \
| * | of: base: fix typoUlrich Ölmann2018-10-191-1/+1
| |/ | | | | | | | | Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / of: unflatten: access property properlySascha Hauer2018-10-301-1/+1
|/ | | | | | | | Properties have to be accessed with of_property_get_value() rather than accessing them directly from the devicenode. The accessor does the right thing when of_new_property_const() is used. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers: of: Make use of devpath_to_name()Andrey Smirnov2018-06-251-4/+2
| | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: Make of_property_get_value() publicAndrey Smirnov2018-05-181-5/+0
| | | | | | | | Make of_property_get_value() public, so it can be used in other part of the system. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2018-04-061-1/+1
|\
| * of: demote "no ranges" message to debug levelLucas Stach2018-03-191-1/+1
| | | | | | | | | | | | | | | | | | | | There are valid cases where there is no way to translate a OF node to a MMIO address via ranges, so do the same as the Linux kernel and don't print an error message in that case, but make it available as a debug message. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | of: partition: fix typo when writing #address-cellsPhilipp Zabel2018-03-291-1/+1
|/ | | | | | | | | | | | On > 4 GiB eMMC devices, barebox writes a 32-bit address and a 64-bit size into the partition reg property, because #address-cells is accidentally written as '#addres-cells'. This causes a fallback to 32-bit address size. Fix the typo and thereby of_partition_fixup for 64-bit partitions. Fixes: a2fa18f9f483 ("mtd: of: Make used partition binding configurable") Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: Make locally used function staticSascha Hauer2018-03-051-1/+1
| | | | | | | __of_unflatten_dtb is only locally used and has no prototype in include/. Make it static. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: Make locally used function staticSascha Hauer2018-03-051-1/+1
| | | | | | | of_property_get_value is only locally used and has no prototype in include/. Make it static. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/of'Sascha Hauer2018-02-082-23/+120
|\
| * of: fdt: add of_unflatten_dtb_constSascha Hauer2018-01-311-2/+34
| | | | | | | | | | | | | | | | This adds a variant of of_unflatten_dtb() which uses the property data directly from the input tree rather than copying it. This is mainly useful for a single user: FIT images. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * of: Allow for const propertiesSascha Hauer2018-01-311-21/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds support for const properties. We add a const void *value_const to struct property which will not be modified. The value of a property should no longer be used directly, but with the of_property_get_value() accessor which picks the right value. With this we can unflatten dtbs and use the property values directly from the dtb instead of copying them. This is useful for device trees which (ab)use properties to store huge data files, aka FIT images. To create a property whose value is not copied but used from the original input data we introduce of_new_property_const(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | of: mtd: partition: Use reproducible node names for fixupSascha Hauer2018-02-061-1/+4
| | | | | | | | | | | | | | | | | | | | The full names of device nodes are not as stable as we like them to be. Lately the leading zeroes in the i.MX6 device trees were removed which led to the result that we can no longer find the partition nodes in the to be fixed tree. Use reproducible names to overcome this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | of: Add function to find the same node in another treeSascha Hauer2018-02-061-0/+63
|/ | | | | | | | | | | | For our device tree fixups we have to find a node corresponding to another node in another device tree. We used to use the full name to match the nodes, but this falls apart when nodes get renamed or for example a new bus hierarchy is introduced. To make this more robust we create reproducible names from device nodes which mostly depend on the address in MMIO space, the reg property and as a last resort the name of the device node. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: base: fix segfault in of_get_machine_compatible()Aleksander Morgado2018-01-301-0/+2
| | | | | | | | | | | | | | | | | | | | This is running the barebox sandbox: Thread 1 "barebox" received signal SIGSEGV, Segmentation fault. 0x0000555555579e2b in _strchr (s=s@entry=0x0, c=c@entry=44) at lib/string.c:251 251 for(; *s != (char) c; ++s) (gdb) bt #0 0x0000555555579e2b in _strchr (s=s@entry=0x0, c=c@entry=44) at lib/string.c:251 #1 0x000055555556fd91 in of_get_machine_compatible () at drivers/of/base.c:2380 #2 0x000055555556fda8 in of_init_hostname () at drivers/of/base.c:2389 #3 0x000055555555f9e6 in start_barebox () at common/startup.c:106 #4 0x00005555555a291a in main () (gdb) fr 1 #1 0x000055555556fd91 in of_get_machine_compatible () at drivers/of/base.c:2380 2380 p = strchr(name, ','); Signed-off-by: Aleksander Morgado <aleksander@aleksander.es> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: base: use root_node compatible as suggestion for a hostnameOleksij Rempel2018-01-171-0/+32
| | | | | | | | | | | | | | | | on some SoCs we can use generic PLL and RAM initialization. In this cases we create board file only to provide a host name. With this patch host name will be created from device tree compatible. For example: compatible = "board_vendor,board", "chip_vendor,soc" the host name will be: "board" This function will not overwrite a host name which is already set by board or machine code. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2017-10-191-2/+0
|\
| * remove checks for xzalloc() returning NULLUwe Kleine-König2017-09-261-2/+0
| | | | | | | | | | | | | | xzalloc() either returns memory or panics, so checking for NULL is useless. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | of: base: add function to copy a device tree nodeMichael Olbrich2017-10-171-0/+16
| | | | | | | | | | | | Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de> Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | of: populate clock providers before other devicesLucas Stach2017-10-161-1/+1
|/ | | | | | | | | Clocks are a basic resource, which may be needed early by other devices or even the bus driver (as is the case with the ARM AMBA bus). Register them before populating other devices. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: base: port of_device_is_big_endian from linuxOleksij Rempel2017-09-081-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |commit 37786c7fee40771d13901de129af7e084ed48b55 |Author: Kevin Cernekee <cernekee@gmail.com> |Date: Thu Apr 9 13:05:14 2015 -0700 | | of: Add helper function to check MMIO register endianness | | SoC peripherals can come in several different flavors: | | - little-endian: registers always need to be accessed in LE mode (so the | kernel should perform a swap if the CPU is running BE) | | - big-endian: registers always need to be accessed in BE mode (so the | kernel should perform a swap if the CPU is running LE) | | - native-endian: the bus will automatically swap accesses, so the kernel | should never swap | | Introduce a function that checks an OF device node to see whether it | contains a "big-endian" or "native-endian" property. For the former case, | always return true. For the latter case, return true iff the kernel was | built for BE (implying that the BE MMIO accessors do not perform a swap). | Otherwise return false, assuming LE registers. | | LE registers are assumed by default because most existing drivers (libahci, | serial8250, usb) always use readl/writel in the absence of instructions | to the contrary, so that will be our fallback. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: of_path: find device via partuuidSteffen Trumtrar2017-07-101-1/+16
| | | | | | | | When a node is compatible to a fixed-partitions, support searching the corresponding device via the partuuid, if it specified in the device tree. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* of_device_is_stdout_path: split off options and support aliasesUwe Kleine-König2017-06-191-1/+12
| | | | | | | | | | | | | Several device trees use something like: stdout-path = "serial0:115200n8"; Currently of_device_is_stdout_path fails to do the right thing here because it expects an absolute node path and no options. So split off options (everything after the colon) and resolve aliases. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of_device_is_stdout_path: simplifyUwe Kleine-König2017-06-191-6/+4
| | | | | | | | Test for dev->device_node being NULL earlier which at the end of the function allows to simplify the calculation of the return value Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2017-06-141-0/+2
|\
| * of: Search for /memory node by type, if it is not found by nameAndrey Panov2017-05-111-0/+2
| | | | | | | | | | | | | | | | Update of Rockchip dts featured changes of simple "/memory" node to "/memory@6000000". Support this change. Signed-off-by: Andrey Panov <rockford@yandex.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | of: of_find_node_by_devpath: Fix offset in mtd devicesSascha Hauer2017-05-111-1/+4
|/ | | | | | | When a cdev is a mtd device the partition offset must be used from there, not from the cdev. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2017-05-052-24/+10
|\
| * of: base: of_new_property(): use xstrdup() instead of strdup()Antony Pavlov2017-04-281-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | At the moment of_new_property() uses xfunctions for memory allocation so we can use xstrdup() instead of strdup() for code simplification. A side effect of this commmit is that the of_new_property() function can't return NULL anymore if CONFIG_OFTREE is set. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * of: base: exclude memcpy-like code from of_property_write_u8_array()Antony Pavlov2017-04-281-6/+1
| | | | | | | | | | | | | | | | | | The of_new_property() function already has functionality to copy data into of_property so we can make of_property_write_u8_array() simpler. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * of: of_net: use a loopSascha Hauer2017-04-121-12/+8
| | | | | | | | | | | | | | iterate over the different property names rather than having the same code three times. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mtd: of: only add partition layout param when GLOBAL support is enabledLucas Stach2017-04-191-3/+5
|/ | | | | | Fixes: a2fa18f9f483 (mtd: of: Make used partition binding configurable) Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: of_path: add of_find_node_by_devpath()Sascha Hauer2017-03-311-0/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | We already have of_find_path_by_node() which finds a device path for a given device node. This is used by the state framework to find its backend path. This path has to be translated back to a device node when Linux is started. The current approach turned out to be too simple: We assumed that the node path is the same in the tree Linux is started with. This is not true in several cases: - partition nodes should have the name "partition@<offset>", but in several trees they have "partition@<num>" - There are two different partition bindings: The legacy binding and the new one with an additional partitions subnode which has a compatible = "fixed-partitions" property. The node path only stays the same when the internal tree uses the same bindings and node names as the tree Linux is started with. To overcome this limitation we create of_find_node_by_devpath() which converts the device path back to a device node. It does so by finding the device node of the hardware device rather than the partition node. It then parses over the partitions in this device node with the known bindings looking for a partition which matches in offset and size to the barebox partition. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: partitions: flag partitions from a partition tableSascha Hauer2017-03-311-2/+6
| | | | | | | | | We are going to call the of_partition_fixup for regular block devices like MMC/SD aswell. Add a flag to partitions indicating they are instanciated from a on-disk partition table so that they won't be added as device tree partitions during fixup. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>