xref: /OK3568_Linux_fs/kernel/Documentation/devicetree/bindings/graph.txt (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunCommon bindings for device graphs
2*4882a593Smuzhiyun
3*4882a593SmuzhiyunGeneral concept
4*4882a593Smuzhiyun---------------
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunThe hierarchical organisation of the device tree is well suited to describe
7*4882a593Smuzhiyuncontrol flow to devices, but there can be more complex connections between
8*4882a593Smuzhiyundevices that work together to form a logical compound device, following an
9*4882a593Smuzhiyunarbitrarily complex graph.
10*4882a593SmuzhiyunThere already is a simple directed graph between devices tree nodes using
11*4882a593Smuzhiyunphandle properties pointing to other nodes to describe connections that
12*4882a593Smuzhiyuncan not be inferred from device tree parent-child relationships. The device
13*4882a593Smuzhiyuntree graph bindings described herein abstract more complex devices that can
14*4882a593Smuzhiyunhave multiple specifiable ports, each of which can be linked to one or more
15*4882a593Smuzhiyunports of other devices.
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunThese common bindings do not contain any information about the direction or
18*4882a593Smuzhiyuntype of the connections, they just map their existence. Specific properties
19*4882a593Smuzhiyunmay be described by specialized bindings depending on the type of connection.
20*4882a593Smuzhiyun
21*4882a593SmuzhiyunTo see how this binding applies to video pipelines, for example, see
22*4882a593SmuzhiyunDocumentation/devicetree/bindings/media/video-interfaces.txt.
23*4882a593SmuzhiyunHere the ports describe data interfaces, and the links between them are
24*4882a593Smuzhiyunthe connecting data buses. A single port with multiple connections can
25*4882a593Smuzhiyuncorrespond to multiple devices being connected to the same physical bus.
26*4882a593Smuzhiyun
27*4882a593SmuzhiyunOrganisation of ports and endpoints
28*4882a593Smuzhiyun-----------------------------------
29*4882a593Smuzhiyun
30*4882a593SmuzhiyunPorts are described by child 'port' nodes contained in the device node.
31*4882a593SmuzhiyunEach port node contains an 'endpoint' subnode for each remote device port
32*4882a593Smuzhiyunconnected to this port. If a single port is connected to more than one
33*4882a593Smuzhiyunremote device, an 'endpoint' child node must be provided for each link.
34*4882a593SmuzhiyunIf more than one port is present in a device node or there is more than one
35*4882a593Smuzhiyunendpoint at a port, or a port node needs to be associated with a selected
36*4882a593Smuzhiyunhardware interface, a common scheme using '#address-cells', '#size-cells'
37*4882a593Smuzhiyunand 'reg' properties is used to number the nodes.
38*4882a593Smuzhiyun
39*4882a593Smuzhiyundevice {
40*4882a593Smuzhiyun        ...
41*4882a593Smuzhiyun        #address-cells = <1>;
42*4882a593Smuzhiyun        #size-cells = <0>;
43*4882a593Smuzhiyun
44*4882a593Smuzhiyun        port@0 {
45*4882a593Smuzhiyun	        #address-cells = <1>;
46*4882a593Smuzhiyun	        #size-cells = <0>;
47*4882a593Smuzhiyun		reg = <0>;
48*4882a593Smuzhiyun
49*4882a593Smuzhiyun                endpoint@0 {
50*4882a593Smuzhiyun			reg = <0>;
51*4882a593Smuzhiyun			...
52*4882a593Smuzhiyun		};
53*4882a593Smuzhiyun                endpoint@1 {
54*4882a593Smuzhiyun			reg = <1>;
55*4882a593Smuzhiyun			...
56*4882a593Smuzhiyun		};
57*4882a593Smuzhiyun        };
58*4882a593Smuzhiyun
59*4882a593Smuzhiyun        port@1 {
60*4882a593Smuzhiyun		reg = <1>;
61*4882a593Smuzhiyun
62*4882a593Smuzhiyun		endpoint { ... };
63*4882a593Smuzhiyun	};
64*4882a593Smuzhiyun};
65*4882a593Smuzhiyun
66*4882a593SmuzhiyunAll 'port' nodes can be grouped under an optional 'ports' node, which
67*4882a593Smuzhiyunallows to specify #address-cells, #size-cells properties for the 'port'
68*4882a593Smuzhiyunnodes independently from any other child device nodes a device might
69*4882a593Smuzhiyunhave.
70*4882a593Smuzhiyun
71*4882a593Smuzhiyundevice {
72*4882a593Smuzhiyun        ...
73*4882a593Smuzhiyun        ports {
74*4882a593Smuzhiyun                #address-cells = <1>;
75*4882a593Smuzhiyun                #size-cells = <0>;
76*4882a593Smuzhiyun
77*4882a593Smuzhiyun                port@0 {
78*4882a593Smuzhiyun                        ...
79*4882a593Smuzhiyun                        endpoint@0 { ... };
80*4882a593Smuzhiyun                        endpoint@1 { ... };
81*4882a593Smuzhiyun                };
82*4882a593Smuzhiyun
83*4882a593Smuzhiyun                port@1 { ... };
84*4882a593Smuzhiyun        };
85*4882a593Smuzhiyun};
86*4882a593Smuzhiyun
87*4882a593SmuzhiyunLinks between endpoints
88*4882a593Smuzhiyun-----------------------
89*4882a593Smuzhiyun
90*4882a593SmuzhiyunEach endpoint should contain a 'remote-endpoint' phandle property that points
91*4882a593Smuzhiyunto the corresponding endpoint in the port of the remote device. In turn, the
92*4882a593Smuzhiyunremote endpoint should contain a 'remote-endpoint' property. If it has one, it
93*4882a593Smuzhiyunmust not point to anything other than the local endpoint. Two endpoints with
94*4882a593Smuzhiyuntheir 'remote-endpoint' phandles pointing at each other form a link between the
95*4882a593Smuzhiyuncontaining ports.
96*4882a593Smuzhiyun
97*4882a593Smuzhiyundevice-1 {
98*4882a593Smuzhiyun        port {
99*4882a593Smuzhiyun                device_1_output: endpoint {
100*4882a593Smuzhiyun                        remote-endpoint = <&device_2_input>;
101*4882a593Smuzhiyun                };
102*4882a593Smuzhiyun        };
103*4882a593Smuzhiyun};
104*4882a593Smuzhiyun
105*4882a593Smuzhiyundevice-2 {
106*4882a593Smuzhiyun        port {
107*4882a593Smuzhiyun                device_2_input: endpoint {
108*4882a593Smuzhiyun                        remote-endpoint = <&device_1_output>;
109*4882a593Smuzhiyun                };
110*4882a593Smuzhiyun        };
111*4882a593Smuzhiyun};
112*4882a593Smuzhiyun
113*4882a593SmuzhiyunRequired properties
114*4882a593Smuzhiyun-------------------
115*4882a593Smuzhiyun
116*4882a593SmuzhiyunIf there is more than one 'port' or more than one 'endpoint' node or 'reg'
117*4882a593Smuzhiyunproperty present in the port and/or endpoint nodes then the following
118*4882a593Smuzhiyunproperties are required in a relevant parent node:
119*4882a593Smuzhiyun
120*4882a593Smuzhiyun - #address-cells : number of cells required to define port/endpoint
121*4882a593Smuzhiyun                    identifier, should be 1.
122*4882a593Smuzhiyun - #size-cells    : should be zero.
123*4882a593Smuzhiyun
124*4882a593SmuzhiyunOptional endpoint properties
125*4882a593Smuzhiyun----------------------------
126*4882a593Smuzhiyun
127*4882a593Smuzhiyun- remote-endpoint: phandle to an 'endpoint' subnode of a remote device node.
128*4882a593Smuzhiyun
129