summaryrefslogtreecommitdiffstats
path: root/drivers/of/of_path.c
Commit message (Collapse)AuthorAgeFilesLines
* 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: 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: 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>
* 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_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>
* 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>
* | 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>
* string: Fix (v)asprintf prototypesSascha Hauer2016-04-151-1/+1
| | | | | | | | | | Our asprintf and vasprintf have different prototypes than the glibc functions. This causes trouble when we want to share barebox code with userspace code. Change the prototypes for (v)asprintf to match the glibc prototypes. Since the current (v)asprintf are convenient to use change the existing functions to b(v)asprintf. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of_path: Drop possible further extensions of device-path propertySascha Hauer2016-01-081-95/+28
| | | | | | | | | | Originally it was intended to further extend the multi string property device-path further with more elements, like for example a filename. It turned out though that this is too complex and instead of further extending the property we should instead create additional properties, so this mechanism is removed with this patch to make the code simpler. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of_path: Fix bug with partitions, simply codeTrent Piepho2016-01-081-18/+29
| | | | | | | | | | | | | | | | | | | | | | In commit 75b682795eafb2385556a9642f09e0af96a1264a using a path that has a partition description broke. Fix this and simpfy the code some. There is no need to loop over each string in the path property: it's defined to have at most one parition description, no extant dts has more than one, and how it would handle more than one didn't make sense anyway. Once not looping, __of_find_path() just needs the partition description text, not both the original node and property name to look it up from. When using a partition description, don't lookup the cdev of the node just to replace it with the partition's cdev. Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of_path: add of_find_path_by_node()Marc Kleine-Budde2015-11-271-1/+16
| | | | | | | | | This patch adds the function of_find_path_by_node(), which is similar to of_find_path(), but it translates a device tree node into a barebox device path directly. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of_path: of_find_path() factor out device detection logic into separate functionMarc Kleine-Budde2015-11-271-37/+44
| | | | | | | | This patch factors out the device detection logic into separate function, so that it can be used from another function. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of_path: Allow pointing directly to the partitionSascha Hauer2015-09-011-5/+9
| | | | | | | | We could only point to partitions in the device tree by using &norflash, "partname:barebox-environment". Allow to point to the partition directly without having to parse the partition labels. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of_path: of_find_path(): add possibility to return .bb deviceMarc Kleine-Budde2015-04-231-2/+10
| | | | | | | | | This patch adds a flags argument to the of_find_path() function. The only flag defined for now is OF_FIND_PATH_FLAGS_BB. When used on NAND devices, the function returns the bad block aware device (the ".bb" device). Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of_path: of_find_path(): remove unused variable lenMarc Kleine-Budde2015-03-031-2/+2
| | | | | Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Fix spelling: pathes -> pathsWadim Egorov2015-01-281-1/+1
| | | | | Signed-off-by: Wadim Egorov <w.egorov@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of_path: Allow to specify path with phandle onlySascha Hauer2014-04-281-0/+3
| | | | | | | | Instead of just allowing to specify an OF path with additional partname: property allow to specify a phandle to the partition directly. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: move of_find_device_by_node_path to drivers/of/of_path.cSascha Hauer2014-04-281-0/+14
| | | | | | | As it's generic helper function which should not stay in driver specific code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Add configurability via devicetreeSascha Hauer2013-07-181-0/+155
This adds the possibility to configure the place for the environment from the devicetree and to partition devices from the devicetree. Configuration has the general form of devices with a regular compatible property. This allows to later add additional drivers or drivers with different behaviour (for example to add support for redundant environment). The configuration is all in the /chosen/barebox/ hierarchy of the devicetree. This separates the configuration from the hardware description. Also it makes it possible to store the configuration in a completely separate devicetree (or devicetree overlay). For the same reason all configuration is done using nodepathes rather than phandles. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>