aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/of_graph.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/of_graph.h')
-rw-r--r--include/linux/of_graph.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/of_graph.h b/include/linux/of_graph.h
index befef42e015b..7bc92e050608 100644
--- a/include/linux/of_graph.h
+++ b/include/linux/of_graph.h
@@ -14,6 +14,8 @@
14#ifndef __LINUX_OF_GRAPH_H 14#ifndef __LINUX_OF_GRAPH_H
15#define __LINUX_OF_GRAPH_H 15#define __LINUX_OF_GRAPH_H
16 16
17#include <linux/types.h>
18
17/** 19/**
18 * struct of_endpoint - the OF graph endpoint data structure 20 * struct of_endpoint - the OF graph endpoint data structure
19 * @port: identifier (value of reg property) of a port this endpoint belongs to 21 * @port: identifier (value of reg property) of a port this endpoint belongs to
@@ -26,9 +28,21 @@ struct of_endpoint {
26 const struct device_node *local_node; 28 const struct device_node *local_node;
27}; 29};
28 30
31/**
32 * for_each_endpoint_of_node - iterate over every endpoint in a device node
33 * @parent: parent device node containing ports and endpoints
34 * @child: loop variable pointing to the current endpoint node
35 *
36 * When breaking out of the loop, of_node_put(child) has to be called manually.
37 */
38#define for_each_endpoint_of_node(parent, child) \
39 for (child = of_graph_get_next_endpoint(parent, NULL); child != NULL; \
40 child = of_graph_get_next_endpoint(parent, child))
41
29#ifdef CONFIG_OF 42#ifdef CONFIG_OF
30int of_graph_parse_endpoint(const struct device_node *node, 43int of_graph_parse_endpoint(const struct device_node *node,
31 struct of_endpoint *endpoint); 44 struct of_endpoint *endpoint);
45struct device_node *of_graph_get_port_by_id(struct device_node *node, u32 id);
32struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, 46struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
33 struct device_node *previous); 47 struct device_node *previous);
34struct device_node *of_graph_get_remote_port_parent( 48struct device_node *of_graph_get_remote_port_parent(
@@ -42,6 +56,12 @@ static inline int of_graph_parse_endpoint(const struct device_node *node,
42 return -ENOSYS; 56 return -ENOSYS;
43} 57}
44 58
59static inline struct device_node *of_graph_get_port_by_id(
60 struct device_node *node, u32 id)
61{
62 return NULL;
63}
64
45static inline struct device_node *of_graph_get_next_endpoint( 65static inline struct device_node *of_graph_get_next_endpoint(
46 const struct device_node *parent, 66 const struct device_node *parent,
47 struct device_node *previous) 67 struct device_node *previous)