1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef __LINUX_OF_GRAPH_H
15#define __LINUX_OF_GRAPH_H
16
17#include <linux/types.h>
18
19
20
21
22
23
24
25struct of_endpoint {
26 unsigned int port;
27 unsigned int id;
28 const struct device_node *local_node;
29};
30
31
32
33
34
35
36
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
42#ifdef CONFIG_OF
43int of_graph_parse_endpoint(const struct device_node *node,
44 struct of_endpoint *endpoint);
45struct device_node *of_graph_get_port_by_id(struct device_node *node, u32 id);
46struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
47 struct device_node *previous);
48struct device_node *of_graph_get_endpoint_by_regs(
49 const struct device_node *parent, int port_reg, int reg);
50struct device_node *of_graph_get_remote_port_parent(
51 const struct device_node *node);
52struct device_node *of_graph_get_remote_port(const struct device_node *node);
53#else
54
55static inline int of_graph_parse_endpoint(const struct device_node *node,
56 struct of_endpoint *endpoint)
57{
58 return -ENOSYS;
59}
60
61static inline struct device_node *of_graph_get_port_by_id(
62 struct device_node *node, u32 id)
63{
64 return NULL;
65}
66
67static inline struct device_node *of_graph_get_next_endpoint(
68 const struct device_node *parent,
69 struct device_node *previous)
70{
71 return NULL;
72}
73
74static inline struct device_node *of_graph_get_endpoint_by_regs(
75 const struct device_node *parent, int port_reg, int reg)
76{
77 return NULL;
78}
79
80static inline struct device_node *of_graph_get_remote_port_parent(
81 const struct device_node *node)
82{
83 return NULL;
84}
85
86static inline struct device_node *of_graph_get_remote_port(
87 const struct device_node *node)
88{
89 return NULL;
90}
91
92#endif
93
94#endif
95