# Device Graphs

_Peios Kernel / Hardware and drivers / Device-tree binding reference / Shared binding definitions_

> Device-tree binding reference for Device Graphs.

<!-- SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) -->


<a id="dt-root"></a>

**Schema identifier (<code>&#36;id</code>):** <span id="dt-09f478f44eb202ea573e"><code>&#34;http&#58;&#47;&#47;devicetree&#46;org&#47;schemas&#47;graph&#46;yaml&#35;&#34;</code></span>

**Schema dialect (<code>&#36;schema</code>):** <span id="dt-dcb375baab6014763a68"><code>&#34;http&#58;&#47;&#47;devicetree&#46;org&#47;meta&#45;schemas&#47;base&#46;yaml&#35;&#34;</code></span>

<a id="dt-e46b5a5dd81dbd751c9f"></a>

<div id="dt-6d1c5ef59f0239d38c02">
<p style="white-space: pre-wrap">The hierarchical organisation of the device tree is well suited to describe
control flow to devices, but there can be more complex connections between
devices that work together to form a logical compound device, following an
arbitrarily complex graph.
There already is a simple directed graph between devices tree nodes using
phandle properties pointing to other nodes to describe connections that
can not be inferred from device tree parent-child relationships. The device
tree graph bindings described herein abstract more complex devices that can
have multiple specifiable ports, each of which can be linked to one or more
ports of other devices.</p>
<p style="white-space: pre-wrap">These common bindings do not contain any information about the direction or
type of the connections, they just map their existence. Specific properties
may be described by specialized bindings depending on the type of connection.</p>
<p style="white-space: pre-wrap">To see how this binding applies to video pipelines, for example, see
Documentation/devicetree/bindings/media/video-interfaces.txt.
Here the ports describe data interfaces, and the links between them are
the connecting data buses. A single port with multiple connections can
correspond to multiple devices being connected to the same physical bus.</p>
</div>

**Maintainers (<code>maintainers</code>):** <a id="dt-fbc39820abb8bb999095"></a> <span id="dt-fb78ddfc22abfc6fe56d"><code>&#34;Philipp Zabel &#60;p&#46;zabel&#64;pengutronix&#46;de&#62;&#34;</code></span>

<a id="dt-7fcd144dee0d1b44122a"></a>

## Reusable definitions (<code>&#36;defs</code>)

<a id="dt-7415ffe8e57fb59e2968"></a>

### <code>endpoint&#45;base</code>

**Value type (<code>type</code>):** <span id="dt-a3efa881461412be049c"><code>&#34;object&#34;</code></span>

<a id="dt-2ea30d1079a7c620a383"></a>

#### Properties and child nodes (<code>properties</code>)

<a id="dt-55d330d14b476a5a562b"></a>

**<code>reg</code> — not listed as required here**

**Maximum number of items (<code>maxItems</code>):** <span id="dt-afc05327546877696c6b"><code>1</code></span>

<a id="dt-7000411f6d819f15f929"></a>

**<code>remote&#45;endpoint</code> — not listed as required here**

<div id="dt-6d4595b0673e1eb78fa7">
<p style="white-space: pre-wrap">phandle to an 'endpoint' subnode of a remote device node.</p>
</div>

**Shared schema rule (<code>&#36;ref</code>):** <span id="dt-9bcac94bc7b423224b6a">[<code>&#47;schemas&#47;types&#46;yaml&#35;&#47;definitions&#47;phandle</code>](</kernel/hardware/devicetree-bindings/dt-shared/types.md#dt-2533fa46618221e83225>)</span>

<a id="dt-61dbefbf4cdd7cc4556a"></a>

### <code>port&#45;base</code>

**Value type (<code>type</code>):** <span id="dt-80a4b6d865654de061a1"><code>&#34;object&#34;</code></span>

<div id="dt-9d389a054079f9ef8ce1">
<p style="white-space: pre-wrap">If there is more than one endpoint node or 'reg' property present in endpoint nodes then '#address-cells' and '#size-cells' properties are required.</p>
</div>

<a id="dt-eaea5108374f8637d0ae"></a>

#### Properties and child nodes (<code>properties</code>)

<a id="dt-2dda6c90fd36708113e7"></a>

**<code>&#35;address&#45;cells</code> — not listed as required here**

**Exact value (<code>const</code>):** <span id="dt-e2b5eaecef85b7e2848d"><code>1</code></span>

<a id="dt-0e32bff8df082d941049"></a>

**<code>&#35;size&#45;cells</code> — not listed as required here**

**Exact value (<code>const</code>):** <span id="dt-5fb0ccb14372b8253e44"><code>0</code></span>

<a id="dt-454c717cdd4d496f73d4"></a>

**<code>reg</code> — not listed as required here**

**Maximum number of items (<code>maxItems</code>):** <span id="dt-57522f9135f1fc9e1383"><code>1</code></span>

<a id="dt-f1022d5bc1cfbb63cf4e"></a>

**<code>endpoint</code> — not listed as required here**

**Value type (<code>type</code>):** <span id="dt-1160ae7f8948b887939d"><code>&#34;object&#34;</code></span>

<a id="dt-fa441c91cab41bc0f5d2"></a>

#### Properties matching a name pattern (<code>patternProperties</code>)

<a id="dt-3f84332eaef719bffc57"></a>

**<code>&#94;endpoint&#64;&#91;0&#45;9a&#45;f&#93;&#43;&#36;</code> — name matches this regular expression**

**Shared schema rule (<code>&#36;ref</code>):** <span id="dt-a9b019a20c1ae9216226">[<code>&#35;&#47;&#36;defs&#47;endpoint&#45;base</code>](<#dt-7415ffe8e57fb59e2968>)</span>

**Required in this object (<code>required</code>):** <a id="dt-2ee560353092657d402b"></a> <span id="dt-e0961c9bdc89f9ae0d05"><code>&#34;reg&#34;</code></span>

<a id="dt-e1f655ed0ff4d595dadc"></a>

## Properties and child nodes (<code>properties</code>)

<a id="dt-2ab1997bd22b86975b95"></a>

### <code>endpoint</code> — not listed as required here

**Shared schema rule (<code>&#36;ref</code>):** <span id="dt-978f93e5a4293b3a3ac7">[<code>&#35;&#47;&#36;defs&#47;endpoint&#45;base</code>](<#dt-7415ffe8e57fb59e2968>)</span>

<a id="dt-b84862b75ca9e0f1ec8d"></a>

#### Properties not evaluated by applicable rules (<code>unevaluatedProperties</code>)

<code>false</code>

Not allowed by this rule.

<a id="dt-1d845f0617b4072cef77"></a>

### <code>port</code> — not listed as required here

**Shared schema rule (<code>&#36;ref</code>):** <span id="dt-1ed24d3512fbe8ce2017">[<code>&#35;&#47;&#36;defs&#47;port&#45;base</code>](<#dt-61dbefbf4cdd7cc4556a>)</span>

<a id="dt-a216b653a8bb94beac4f"></a>

#### Properties not evaluated by applicable rules (<code>unevaluatedProperties</code>)

<code>false</code>

Not allowed by this rule.

<a id="dt-fefd2108afe5d1ea216f"></a>

#### Properties matching a name pattern (<code>patternProperties</code>)

<a id="dt-97b91646fe545cfeb52b"></a>

**<code>&#94;endpoint&#40;&#64;&#91;0&#45;9a&#45;f&#93;&#43;&#41;&#63;&#36;</code> — name matches this regular expression**

**Shared schema rule (<code>&#36;ref</code>):** <span id="dt-2435a015e3c2f39d7547">[<code>&#35;&#47;properties&#47;endpoint</code>](<#dt-2ab1997bd22b86975b95>)</span>

<a id="dt-638717a7c9bbf1878b7e"></a>

### <code>ports</code> — not listed as required here

**Value type (<code>type</code>):** <span id="dt-d8c866f361590420a70f"><code>&#34;object&#34;</code></span>

<div id="dt-a74919f01bfec2b08490">
<p style="white-space: pre-wrap">If there is more than one port node or 'reg' property present in port nodes then '#address-cells' and '#size-cells' properties are required. In such cases all port nodes can be grouped under 'ports' independently from any other child device nodes a device might have.</p>
</div>

<a id="dt-076265030fa616d9c245"></a>

#### Properties and child nodes (<code>properties</code>)

<a id="dt-3b2bf6c38e4a7e21ab5d"></a>

**<code>&#35;address&#45;cells</code> — not listed as required here**

**Exact value (<code>const</code>):** <span id="dt-3aa2950f6bbc1161d1aa"><code>1</code></span>

<a id="dt-b5ae5a1dc29ae41448a6"></a>

**<code>&#35;size&#45;cells</code> — not listed as required here**

**Exact value (<code>const</code>):** <span id="dt-3df1007a0ea22e24c143"><code>0</code></span>

<a id="dt-b1cba4e02a94dd73d32a"></a>

**<code>port</code> — not listed as required here**

**Value type (<code>type</code>):** <span id="dt-470407e52c51b7f98b3a"><code>&#34;object&#34;</code></span>

<a id="dt-bd319faf13454f764484"></a>

#### Properties matching a name pattern (<code>patternProperties</code>)

<a id="dt-6a1ff8bf2aab819e29f2"></a>

**<code>&#94;port&#64;&#91;0&#45;9a&#45;f&#93;&#43;&#36;</code> — name matches this regular expression**

**Value type (<code>type</code>):** <span id="dt-2aae40be5a3a19fc51ee"><code>&#34;object&#34;</code></span>

**Required in this object (<code>required</code>):** <a id="dt-3932859d53e2f2db2403"></a> <span id="dt-b06974dee86d6e8bf7d1"><code>&#34;reg&#34;</code></span>

<a id="dt-8357022135109be9a877"></a>

#### Exactly one of these rules must match (<code>oneOf</code>)

<a id="dt-24e6a08c354c5a626b57"></a>

**Rule 1**

> **Required in this object (<code>required</code>):** <a id="dt-55054ae2ba9ad8cbefda"></a> <span id="dt-f2c81f428ecdee99fe90"><code>&#34;port&#34;</code></span>

<a id="dt-b1c8d000d6c4d4d94aca"></a>

**Rule 2**

> **Required in this object (<code>required</code>):** <a id="dt-9eaddd72bcc90616be73"></a> <span id="dt-3eabc8a59524a4449370"><code>&#34;&#35;address&#45;cells&#34;</code></span>, <span id="dt-aa425a356048f87faa55"><code>&#34;&#35;size&#45;cells&#34;</code></span>

<a id="dt-18c2da209a8b13bb2e5d"></a>

#### Properties not matched by properties or patternProperties in this schema (<code>additionalProperties</code>)

<code>false</code>

Not allowed by this rule.

<a id="dt-738c4b4f9e483441138b"></a>

## Properties not matched by properties or patternProperties in this schema (<code>additionalProperties</code>)

<code>true</code>

Allowed by this rule.

<a id="dt-1a130cabaa8a47b058bf"></a>

## Examples (<code>examples</code>)

<pre id="dt-0bd6510295af0c95ff2d"><code class="language-dts">device {
    #address-cells = &lt;1&gt;;
    #size-cells = &lt;0&gt;;

    port@0 {
        #address-cells = &lt;1&gt;;
        #size-cells = &lt;0&gt;;
        reg = &lt;0&gt;;

        endpoint@0 {
            reg = &lt;0&gt;;
            // ...
        };
        endpoint@1 {
            reg = &lt;1&gt;;
            // ...
        };
    };

    port@1 {
        reg = &lt;1&gt;;

        endpoint {
            // ...
        };
    };
};
</code></pre>

<pre id="dt-bae0d43ea48e35208b4a"><code class="language-dts">device {
    // ...
    ports {
        #address-cells = &lt;1&gt;;
        #size-cells = &lt;0&gt;;

        port@0 {
            #address-cells = &lt;1&gt;;
            #size-cells = &lt;0&gt;;
            reg = &lt;0&gt;;
            // ...

            endpoint@0 {
                reg = &lt;0&gt;;
                // ...
            };
            endpoint@1 {
                reg = &lt;1&gt;;
                // ...
            };
        };

        port@1 {
            #address-cells = &lt;1&gt;;
            #size-cells = &lt;0&gt;;
            reg = &lt;1&gt;;
            // ...
        };
    };
};
</code></pre>

<pre id="dt-d0212a4cd671f89a0b40"><code class="language-dts">device-1 {
    port {
        device_1_output: endpoint {
            remote-endpoint = &lt;&amp;device_2_input&gt;;
        };
    };
};

device-2 {
    port {
        device_2_input: endpoint {
            remote-endpoint = &lt;&amp;device_1_output&gt;;
        };
    };
};
</code></pre>

## Source notes

<details>
<summary>Annotations retained from the schema source</summary>

<p id="dt-comment-0"><strong>Line 1:</strong> <span> SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)</span></p>

<p id="dt-comment-1"><strong>Line 121:</strong> <span> Organisation of ports and endpoints:</span></p>

<p id="dt-comment-2"><strong>Line 122:</strong> <span></span></p>

<p id="dt-comment-3"><strong>Line 123:</strong> <span> Ports are described by child 'port' nodes contained in the device node.</span></p>

<p id="dt-comment-4"><strong>Line 124:</strong> <span> Each port node contains an 'endpoint' subnode for each remote device port</span></p>

<p id="dt-comment-5"><strong>Line 125:</strong> <span> connected to this port. If a single port is connected to more than one</span></p>

<p id="dt-comment-6"><strong>Line 126:</strong> <span> remote device, an 'endpoint' child node must be provided for each link.</span></p>

<p id="dt-comment-7"><strong>Line 127:</strong> <span> If more than one port is present in a device node or there is more than</span></p>

<p id="dt-comment-8"><strong>Line 128:</strong> <span> one endpoint at a port, or a port node needs to be associated with a</span></p>

<p id="dt-comment-9"><strong>Line 129:</strong> <span> selected hardware interface, a common scheme using '#address-cells',</span></p>

<p id="dt-comment-10"><strong>Line 130:</strong> <span> '#size-cells' and 'reg' properties is used to number the nodes.</span></p>

<p id="dt-comment-11"><strong>Line 160:</strong> <span> All 'port' nodes can be grouped under an optional 'ports' node, which</span></p>

<p id="dt-comment-12"><strong>Line 161:</strong> <span> allows to specify #address-cells, #size-cells properties for the 'port'</span></p>

<p id="dt-comment-13"><strong>Line 162:</strong> <span> nodes independently from any other child device nodes a device might</span></p>

<p id="dt-comment-14"><strong>Line 163:</strong> <span> have.</span></p>

<p id="dt-comment-15"><strong>Line 196:</strong> <span> Links between endpoints:</span></p>

<p id="dt-comment-16"><strong>Line 197:</strong> <span></span></p>

<p id="dt-comment-17"><strong>Line 198:</strong> <span> Each endpoint should contain a 'remote-endpoint' phandle property that</span></p>

<p id="dt-comment-18"><strong>Line 199:</strong> <span> points to the corresponding endpoint in the port of the remote device.</span></p>

<p id="dt-comment-19"><strong>Line 200:</strong> <span> In turn, the remote endpoint should contain a 'remote-endpoint' property.</span></p>

<p id="dt-comment-20"><strong>Line 201:</strong> <span> If it has one, it must not point to anything other than the local endpoint.</span></p>

<p id="dt-comment-21"><strong>Line 202:</strong> <span> Two endpoints with their 'remote-endpoint' phandles pointing at each other</span></p>

<p id="dt-comment-22"><strong>Line 203:</strong> <span> form a link between the containing ports.</span></p>

</details>
