diff options
Diffstat (limited to 'include/linux/of_graph.h')
-rw-r--r-- | include/linux/of_graph.h | 20 |
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 |
30 | int of_graph_parse_endpoint(const struct device_node *node, | 43 | int of_graph_parse_endpoint(const struct device_node *node, |
31 | struct of_endpoint *endpoint); | 44 | struct of_endpoint *endpoint); |
45 | struct device_node *of_graph_get_port_by_id(struct device_node *node, u32 id); | ||
32 | struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, | 46 | struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, |
33 | struct device_node *previous); | 47 | struct device_node *previous); |
34 | struct device_node *of_graph_get_remote_port_parent( | 48 | struct 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 | ||
59 | static inline struct device_node *of_graph_get_port_by_id( | ||
60 | struct device_node *node, u32 id) | ||
61 | { | ||
62 | return NULL; | ||
63 | } | ||
64 | |||
45 | static inline struct device_node *of_graph_get_next_endpoint( | 65 | static 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) |