| 1 |
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) |
| 2 |
%YAML 1.2 |
| 3 |
--- |
| 4 |
$id: http://devicetree.org/schemas/graph.yaml# |
| 5 |
$schema: http://devicetree.org/meta-schemas/base.yaml# |
| 6 |
|
| 7 |
title: Device Graphs |
| 8 |
|
| 9 |
description: | |
| 10 |
The hierarchical organisation of the device tree is well suited to describe |
| 11 |
control flow to devices, but there can be more complex connections between |
| 12 |
devices that work together to form a logical compound device, following an |
| 13 |
arbitrarily complex graph. |
| 14 |
There already is a simple directed graph between devices tree nodes using |
| 15 |
phandle properties pointing to other nodes to describe connections that |
| 16 |
can not be inferred from device tree parent-child relationships. The device |
| 17 |
tree graph bindings described herein abstract more complex devices that can |
| 18 |
have multiple specifiable ports, each of which can be linked to one or more |
| 19 |
ports of other devices. |
| 20 |
|
| 21 |
These common bindings do not contain any information about the direction or |
| 22 |
type of the connections, they just map their existence. Specific properties |
| 23 |
may be described by specialized bindings depending on the type of connection. |
| 24 |
|
| 25 |
To see how this binding applies to video pipelines, for example, see |
| 26 |
Documentation/devicetree/bindings/media/video-interfaces.txt. |
| 27 |
Here the ports describe data interfaces, and the links between them are |
| 28 |
the connecting data buses. A single port with multiple connections can |
| 29 |
correspond to multiple devices being connected to the same physical bus. |
| 30 |
|
| 31 |
maintainers: |
| 32 |
- Philipp Zabel <[email protected]> |
| 33 |
|
| 34 |
select: false |
| 35 |
|
| 36 |
$defs: |
| 37 |
endpoint-base: |
| 38 |
type: object |
| 39 |
properties: |
| 40 |
reg: |
| 41 |
maxItems: 1 |
| 42 |
|
| 43 |
remote-endpoint: |
| 44 |
description: | |
| 45 |
phandle to an 'endpoint' subnode of a remote device node. |
| 46 |
$ref: /schemas/types.yaml#/definitions/phandle |
| 47 |
|
| 48 |
port-base: |
| 49 |
type: object |
| 50 |
description: |
| 51 |
If there is more than one endpoint node or 'reg' property present in |
| 52 |
endpoint nodes then '#address-cells' and '#size-cells' properties are |
| 53 |
required. |
| 54 |
|
| 55 |
properties: |
| 56 |
"#address-cells": |
| 57 |
const: 1 |
| 58 |
|
| 59 |
"#size-cells": |
| 60 |
const: 0 |
| 61 |
|
| 62 |
reg: |
| 63 |
maxItems: 1 |
| 64 |
|
| 65 |
endpoint: |
| 66 |
type: object |
| 67 |
|
| 68 |
patternProperties: |
| 69 |
"^endpoint@[0-9a-f]+$": |
| 70 |
$ref: "#/$defs/endpoint-base" |
| 71 |
required: |
| 72 |
- reg |
| 73 |
|
| 74 |
properties: |
| 75 |
endpoint: |
| 76 |
$ref: "#/$defs/endpoint-base" |
| 77 |
unevaluatedProperties: false |
| 78 |
|
| 79 |
port: |
| 80 |
$ref: "#/$defs/port-base" |
| 81 |
unevaluatedProperties: false |
| 82 |
|
| 83 |
patternProperties: |
| 84 |
"^endpoint(@[0-9a-f]+)?$": |
| 85 |
$ref: "#/properties/endpoint" |
| 86 |
|
| 87 |
ports: |
| 88 |
type: object |
| 89 |
description: |
| 90 |
If there is more than one port node or 'reg' property present in port |
| 91 |
nodes then '#address-cells' and '#size-cells' properties are required. |
| 92 |
In such cases all port nodes can be grouped under 'ports' independently |
| 93 |
from any other child device nodes a device might have. |
| 94 |
|
| 95 |
properties: |
| 96 |
"#address-cells": |
| 97 |
const: 1 |
| 98 |
|
| 99 |
"#size-cells": |
| 100 |
const: 0 |
| 101 |
|
| 102 |
port: |
| 103 |
type: object |
| 104 |
|
| 105 |
patternProperties: |
| 106 |
"^port@[0-9a-f]+$": |
| 107 |
type: object |
| 108 |
required: |
| 109 |
- reg |
| 110 |
|
| 111 |
oneOf: |
| 112 |
- required: |
| 113 |
- port |
| 114 |
- required: |
| 115 |
- "#address-cells" |
| 116 |
- "#size-cells" |
| 117 |
|
| 118 |
additionalProperties: false |
| 119 |
|
| 120 |
additionalProperties: true |
| 121 |
|
| 122 |
examples: |
| 123 |
# Organisation of ports and endpoints: |
| 124 |
# |
| 125 |
# Ports are described by child 'port' nodes contained in the device node. |
| 126 |
# Each port node contains an 'endpoint' subnode for each remote device port |
| 127 |
# connected to this port. If a single port is connected to more than one |
| 128 |
# remote device, an 'endpoint' child node must be provided for each link. |
| 129 |
# If more than one port is present in a device node or there is more than |
| 130 |
# one endpoint at a port, or a port node needs to be associated with a |
| 131 |
# selected hardware interface, a common scheme using '#address-cells', |
| 132 |
# '#size-cells' and 'reg' properties is used to number the nodes. |
| 133 |
- | |
| 134 |
device { |
| 135 |
#address-cells = <1>; |
| 136 |
#size-cells = <0>; |
| 137 |
|
| 138 |
port@0 { |
| 139 |
#address-cells = <1>; |
| 140 |
#size-cells = <0>; |
| 141 |
reg = <0>; |
| 142 |
|
| 143 |
endpoint@0 { |
| 144 |
reg = <0>; |
| 145 |
// ... |
| 146 |
}; |
| 147 |
endpoint@1 { |
| 148 |
reg = <1>; |
| 149 |
// ... |
| 150 |
}; |
| 151 |
}; |
| 152 |
|
| 153 |
port@1 { |
| 154 |
reg = <1>; |
| 155 |
|
| 156 |
endpoint { |
| 157 |
// ... |
| 158 |
}; |
| 159 |
}; |
| 160 |
}; |
| 161 |
|
| 162 |
# All 'port' nodes can be grouped under an optional 'ports' node, which |
| 163 |
# allows to specify #address-cells, #size-cells properties for the 'port' |
| 164 |
# nodes independently from any other child device nodes a device might |
| 165 |
# have. |
| 166 |
- | |
| 167 |
device { |
| 168 |
// ... |
| 169 |
ports { |
| 170 |
#address-cells = <1>; |
| 171 |
#size-cells = <0>; |
| 172 |
|
| 173 |
port@0 { |
| 174 |
#address-cells = <1>; |
| 175 |
#size-cells = <0>; |
| 176 |
reg = <0>; |
| 177 |
// ... |
| 178 |
|
| 179 |
endpoint@0 { |
| 180 |
reg = <0>; |
| 181 |
// ... |
| 182 |
}; |
| 183 |
endpoint@1 { |
| 184 |
reg = <1>; |
| 185 |
// ... |
| 186 |
}; |
| 187 |
}; |
| 188 |
|
| 189 |
port@1 { |
| 190 |
#address-cells = <1>; |
| 191 |
#size-cells = <0>; |
| 192 |
reg = <1>; |
| 193 |
// ... |
| 194 |
}; |
| 195 |
}; |
| 196 |
}; |
| 197 |
|
| 198 |
# Links between endpoints: |
| 199 |
# |
| 200 |
# Each endpoint should contain a 'remote-endpoint' phandle property that |
| 201 |
# points to the corresponding endpoint in the port of the remote device. |
| 202 |
# In turn, the remote endpoint should contain a 'remote-endpoint' property. |
| 203 |
# If it has one, it must not point to anything other than the local endpoint. |
| 204 |
# Two endpoints with their 'remote-endpoint' phandles pointing at each other |
| 205 |
# form a link between the containing ports. |
| 206 |
- | |
| 207 |
device-1 { |
| 208 |
port { |
| 209 |
device_1_output: endpoint { |
| 210 |
remote-endpoint = <&device_2_input>; |
| 211 |
}; |
| 212 |
}; |
| 213 |
}; |
| 214 |
|
| 215 |
device-2 { |
| 216 |
port { |
| 217 |
device_2_input: endpoint { |
| 218 |
remote-endpoint = <&device_1_output>; |
| 219 |
}; |
| 220 |
}; |
| 221 |
}; |
| 222 |
|
| 223 |
... |