]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - include/linux/of_graph.h
block: provide bio_uninit() free freeing integrity/task associations
[mirror_ubuntu-artful-kernel.git] / include / linux / of_graph.h
CommitLineData
fd9fdb78
PZ
1/*
2 * OF graph binding parsing helpers
3 *
4 * Copyright (C) 2012 - 2013 Samsung Electronics Co., Ltd.
5 * Author: Sylwester Nawrocki <s.nawrocki@samsung.com>
6 *
7 * Copyright (C) 2012 Renesas Electronics Corp.
8 * Author: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as
12 * published by the Free Software Foundation.
13 */
14#ifndef __LINUX_OF_GRAPH_H
15#define __LINUX_OF_GRAPH_H
16
01218bf1 17#include <linux/types.h>
011d6f5c 18#include <linux/errno.h>
01218bf1 19
f2a575f6
PZ
20/**
21 * struct of_endpoint - the OF graph endpoint data structure
22 * @port: identifier (value of reg property) of a port this endpoint belongs to
23 * @id: identifier (value of reg property) of this endpoint
24 * @local_node: pointer to device_node of this endpoint
25 */
26struct of_endpoint {
27 unsigned int port;
28 unsigned int id;
29 const struct device_node *local_node;
30};
31
ee890596
PZ
32/**
33 * for_each_endpoint_of_node - iterate over every endpoint in a device node
34 * @parent: parent device node containing ports and endpoints
35 * @child: loop variable pointing to the current endpoint node
36 *
37 * When breaking out of the loop, of_node_put(child) has to be called manually.
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
fd9fdb78 43#ifdef CONFIG_OF
f2a575f6
PZ
44int of_graph_parse_endpoint(const struct device_node *node,
45 struct of_endpoint *endpoint);
bfe446e3 46struct device_node *of_graph_get_port_by_id(struct device_node *node, u32 id);
fd9fdb78
PZ
47struct device_node *of_graph_get_next_endpoint(const struct device_node *parent,
48 struct device_node *previous);
8ccd0d0c
HH
49struct device_node *of_graph_get_endpoint_by_regs(
50 const struct device_node *parent, int port_reg, int reg);
fd9fdb78
PZ
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);
b85ad494
RH
54struct device_node *of_graph_get_remote_node(const struct device_node *node,
55 u32 port, u32 endpoint);
fd9fdb78
PZ
56#else
57
f2a575f6 58static inline int of_graph_parse_endpoint(const struct device_node *node,
00fd9619 59 struct of_endpoint *endpoint)
f2a575f6
PZ
60{
61 return -ENOSYS;
62}
63
bfe446e3
PZ
64static inline struct device_node *of_graph_get_port_by_id(
65 struct device_node *node, u32 id)
66{
67 return NULL;
68}
69
fd9fdb78
PZ
70static inline struct device_node *of_graph_get_next_endpoint(
71 const struct device_node *parent,
72 struct device_node *previous)
73{
74 return NULL;
75}
76
ce0bdb84 77static inline struct device_node *of_graph_get_endpoint_by_regs(
8ccd0d0c
HH
78 const struct device_node *parent, int port_reg, int reg)
79{
80 return NULL;
81}
82
fd9fdb78
PZ
83static inline struct device_node *of_graph_get_remote_port_parent(
84 const struct device_node *node)
85{
86 return NULL;
87}
88
89static inline struct device_node *of_graph_get_remote_port(
90 const struct device_node *node)
91{
92 return NULL;
93}
b85ad494
RH
94static inline struct device_node *of_graph_get_remote_node(
95 const struct device_node *node,
96 u32 port, u32 endpoint)
97{
98 return NULL;
99}
fd9fdb78
PZ
100
101#endif /* CONFIG_OF */
102
103#endif /* __LINUX_OF_GRAPH_H */