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#include <linux/errno.h>
19
20
21
22
23
24
25
26struct of_endpoint {
27 unsigned int port;
28 unsigned int id;
29 const struct device_node *local_node;
30};
31
32
33
34
35
36
37
38
39#define for_each_endpoint_of_node(parent, child) \
40 for (child = of_graph_get_next_endpoint(parent, NULL); child != NULL; \
41 child = of_graph_get_next_endpoint(parent, child))
42
43#ifdef CONFIG_OF
44int of_graph_parse_endpoint(const struct device_node *node,
45 struct of_endpoint *endpoint);
46struct device_node *of_graph_get_port_by_id(struct device_node *node, u32 id);
47struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
48 struct device_node *previous);
49struct device_node *of_graph_get_endpoint_by_regs(
50 const struct device_node *parent, int port_reg, int reg);
51struct device_node *of_graph_get_remote_port_parent(
52 const struct device_node *node);
53struct device_node *of_graph_get_remote_port(const struct device_node *node);
54#else
55
56static inline int of_graph_parse_endpoint(const struct device_node *node,
57 struct of_endpoint *endpoint)
58{
59 return -ENOSYS;
60}
61
62static inline struct device_node *of_graph_get_port_by_id(
63 struct device_node *node, u32 id)
64{
65 return NULL;
66}
67
68static inline struct device_node *of_graph_get_next_endpoint(
69 const struct device_node *parent,
70 struct device_node *previous)
71{
72 return NULL;
73}
74
75static inline struct device_node *of_graph_get_endpoint_by_regs(
76 const struct device_node *parent, int port_reg, int reg)
77{
78 return NULL;
79}
80
81static inline struct device_node *of_graph_get_remote_port_parent(
82 const struct device_node *node)
83{
84 return NULL;
85}
86
87static inline struct device_node *of_graph_get_remote_port(
88 const struct device_node *node)
89{
90 return NULL;
91}
92
93#endif
94
95#endif
96