summaryrefslogtreecommitdiffstats
path: root/drivers/of
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* of: partition: only create partition node when partitions existSascha Hauer2017-03-311-1/+8
| | | | | | | | | With the legacy partition binding we did not modify the device node when no partition exist, but with the new binding we would create the "partitions" node with compatible = "fixed-partitions". Prevent that by catching the absence of partitions early. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: partition: Make partition fixup independent from mtd devicesSascha Hauer2017-03-311-18/+27
| | | | | | | | The of partition parser is not only used for mtd device, but also for regular block devices, so make the of_mtd_fixup code independent of mtd devices also, so that other devices can be fixed up, too. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: partition: support 64bit partition sizesSascha Hauer2017-03-301-4/+13
| | | | | | | | Do not assume that #address-cells and #size-cells are both 1. Parse them appropriately to support devices > 4GuB. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: of: Make used partition binding configurableSascha Hauer2017-03-301-7/+77
| | | | | | | | | | | | | | So far we used the legacy partition binding when fixing up the mtd partition nodes. Change this to default to the new binding with a "partitions" submode. Make this behaviour configurable though: This creates a new of_binding device variable for mtd devices. This can be set to: - "new": Use the new partition binding (default) - "legacy": Use the old partition binding - "donttouch": Do not touch the partition node Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: partition: Move of_mtd_fixup to drivers/of/Sascha Hauer2017-03-301-0/+69
| | | | | | | | Move the fixup code where the parser code is already. Since the code will not only be used for mtd in the future drivers/of/ is a better place than drivers/mtd/. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: Use of_property_write_string() where appropriateSascha Hauer2017-03-301-1/+1
| | | | | | | Replace users which use of_set_property() to set a property to a string with of_property_write_string(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: Add of_property_write_string()Sascha Hauer2017-03-301-0/+22
| | | | | | | Setting a property to a string is used many times. Create a convenience function for it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/efi'Sascha Hauer2017-03-131-1/+1
|\
| * efi: move x86 efi boot support to x86 archJean-Christophe PLAGNIOL-VILLARD2017-02-271-1/+1
| | | | | | | | | | | | | | prepare to drop the efi arch as efi boot up is not arch sepecific Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | of: base: Use scoring in DT device matchingAndrey Smirnov2017-03-091-16/+21
|/ | | | | | | | | | | | | | | | Port Linux kernel algorithm for both of_device_is_compatible() and of_match_node(). With this change former now returns a score on the scale of 0 to INT_MAX/2, and the latter goes through all compatiblity entries and selects the entry that has the best matching score. This is needed for SoCs where IP blocks are backwards compatible and corresponding OF nodes can proclaim compatibility with several entries found in driver's compatiblity table. One such example would be PIO pinctrl block on AT91SAM9x5 SoCs which declare compatibility with with both "atmel,at91sam9x5-pinctrl" and "atmel,at91rm9200-pinctrl". Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/imx'Sascha Hauer2017-02-131-6/+6
|\
| * of: partitions: force "partitions" subnodeSascha Hauer2017-01-191-6/+6
| | | | | | | | | | | | | | | | | | The binding states that a subnode containing partition subnodes should have the name "partitions". Enforce this so that we do not parse nodes with other names which may have partition descriptions for other disks. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | of_path: only handle no driver for device if it is on a busIan Abbott2017-01-131-1/+1
|/ | | | | | | | | | This fixes a regression in __of_find_path() for flash devices created by the cadence-quadspi driver, which do not have 'dev->driver' set. Such devices do not have 'dev->bus' set either, so we can use that to qualify the existing test. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: Use %pa to print resource_size_t typeSascha Hauer2017-01-101-1/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: base: add chosen node if it does not exist when adding initrdPhilipp Zabel2017-01-091-2/+2
| | | | | | | | | If the chosen node does not exist, of_add_initrd fails to pass the initrd to the kernel. Instead it should create the chosen node, just like of_fixup_bootargs does. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/state'Sascha Hauer2016-11-141-0/+3
|\
| * of_path: handle no driver for deviceSascha Hauer2016-10-201-0/+3
| | | | | | | | | | | | | | | | | | in __of_find_path it can happen that there is a device, but there is no driver for this device because it hasn't been probed yet. Return -ENODEV in this case to let the caller know that it has to try later again. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2016-11-142-2/+2
|\ \
| * | of: fix typosAntony Pavlov2016-10-182-2/+2
| |/ | | | | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | of: of_find_path: Add support for new partition bindingSascha Hauer2016-11-111-1/+6
| | | | | | | | | | | | | | The partitions now may be in a subnode of the actual device node. Eventually go another step up in the hierarchy if required. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>