^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) Common bindings for device graphs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) General concept
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) ---------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) The hierarchical organisation of the device tree is well suited to describe
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) control flow to devices, but there can be more complex connections between
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) devices that work together to form a logical compound device, following an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) arbitrarily complex graph.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) There already is a simple directed graph between devices tree nodes using
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) phandle properties pointing to other nodes to describe connections that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) can not be inferred from device tree parent-child relationships. The device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) tree graph bindings described herein abstract more complex devices that can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) have multiple specifiable ports, each of which can be linked to one or more
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) ports of other devices.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) These common bindings do not contain any information about the direction or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) type of the connections, they just map their existence. Specific properties
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) may be described by specialized bindings depending on the type of connection.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) To see how this binding applies to video pipelines, for example, see
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) Documentation/devicetree/bindings/media/video-interfaces.txt.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) Here the ports describe data interfaces, and the links between them are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) the connecting data buses. A single port with multiple connections can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) correspond to multiple devices being connected to the same physical bus.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) Organisation of ports and endpoints
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) -----------------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) Ports are described by child 'port' nodes contained in the device node.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) Each port node contains an 'endpoint' subnode for each remote device port
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) connected to this port. If a single port is connected to more than one
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) remote device, an 'endpoint' child node must be provided for each link.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) If more than one port is present in a device node or there is more than one
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) endpoint at a port, or a port node needs to be associated with a selected
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) hardware interface, a common scheme using '#address-cells', '#size-cells'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) and 'reg' properties is used to number the nodes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) device {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #address-cells = <1>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #size-cells = <0>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) port@0 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #address-cells = <1>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #size-cells = <0>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) reg = <0>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) endpoint@0 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) reg = <0>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) endpoint@1 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) reg = <1>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) port@1 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) reg = <1>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) endpoint { ... };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) All 'port' nodes can be grouped under an optional 'ports' node, which
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) allows to specify #address-cells, #size-cells properties for the 'port'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) nodes independently from any other child device nodes a device might
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) have.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) device {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) ports {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) #address-cells = <1>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) #size-cells = <0>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) port@0 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) endpoint@0 { ... };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) endpoint@1 { ... };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) port@1 { ... };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) Links between endpoints
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) -----------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) Each endpoint should contain a 'remote-endpoint' phandle property that points
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) to the corresponding endpoint in the port of the remote device. In turn, the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) remote endpoint should contain a 'remote-endpoint' property. If it has one, it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) must not point to anything other than the local endpoint. Two endpoints with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) their 'remote-endpoint' phandles pointing at each other form a link between the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) containing ports.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) device-1 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) port {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) device_1_output: endpoint {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) remote-endpoint = <&device_2_input>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) device-2 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) port {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) device_2_input: endpoint {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) remote-endpoint = <&device_1_output>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) Required properties
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) -------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) If there is more than one 'port' or more than one 'endpoint' node or 'reg'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) property present in the port and/or endpoint nodes then the following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) properties are required in a relevant parent node:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) - #address-cells : number of cells required to define port/endpoint
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) identifier, should be 1.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) - #size-cells : should be zero.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) Optional endpoint properties
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) ----------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) - remote-endpoint: phandle to an 'endpoint' subnode of a remote device node.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)