summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-03-30 16:23:00 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-03-31 18:43:24 +0200
commit12960a57841d5e6ea04fd523611e15a9a4170c89 (patch)
tree306bbcbfcfaa7823b9b424496fca5b2157b17aae /include
parent0d0cee17298576daa35f6d15a53944d36a3b7c4e (diff)
downloadbarebox-12960a57841d5e6ea04fd523611e15a9a4170c89.tar.gz
barebox-12960a57841d5e6ea04fd523611e15a9a4170c89.tar.xz
of: of_path: add of_find_node_by_devpath()
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>
Diffstat (limited to 'include')
-rw-r--r--include/of.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/of.h b/include/of.h
index 87d96055a2..0ba73f197f 100644
--- a/include/of.h
+++ b/include/of.h
@@ -251,6 +251,7 @@ struct device_d *of_find_device_by_node_path(const char *path);
#define OF_FIND_PATH_FLAGS_BB 1 /* return .bb device if available */
int of_find_path(struct device_node *node, const char *propname, char **outpath, unsigned flags);
int of_find_path_by_node(struct device_node *node, char **outpath, unsigned flags);
+struct device_node *of_find_node_by_devpath(struct device_node *root, const char *path);
int of_register_fixup(int (*fixup)(struct device_node *, void *), void *context);
int of_unregister_fixup(int (*fixup)(struct device_node *, void *), void *context);
int of_register_set_status_fixup(const char *node, bool status);