Skip to content

Commit 938df13

Browse files
doc: build: dts: bindings-syntax: clarify compat matching
Clarify the identification and matching of bindings to devicetree node compats. The previous definition implicitly hinted at two bindings with the same compat being allowed, but did not state this clearly. The updated wording should make it clear exactly how bindings may be defined, and how they are matched. Signed-off-by: Bjarki Arge Andreasen <[email protected]>
1 parent 366d45f commit 938df13

File tree

1 file changed

+36
-4
lines changed

1 file changed

+36
-4
lines changed

doc/build/dts/bindings-syntax.rst

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,43 @@ match this node:
124124
compatible = "manufacturer,device-v2", "manufacturer,device";
125125
};
126126
127-
Each node's ``compatible`` property is tried in order. The first matching
128-
binding is used. The :ref:`on-bus: <dt-bindings-on-bus>` key can be used to
129-
refine the search.
127+
Each node's ``compatible`` property is tried in order. The
128+
:ref:`bindings <dt-binding-compat>` are uniquely identified by a pair of
129+
(:ref:`compatible: <dt-bindings-compatible>`,
130+
:ref:`on-bus: <dt-bindings-on-bus>`), where the
131+
:ref:`on-bus: <dt-bindings-on-bus>` may be unspecified. A specified bus
132+
:ref:`on-bus: <dt-bindings-on-bus>` takes precedence over unspecified. The
133+
first matching binding is used.
130134

131-
If more than one binding for a compatible is found, an error is raised.
135+
For the following device:
136+
137+
.. code-block:: devicetree
138+
139+
spi-bus {
140+
device-3 {
141+
compatible = "manufacturer,device";
142+
};
143+
};
144+
145+
The following two bindings can coexist and would match in the following order:
146+
147+
.. code-block:: YAML
148+
149+
compatible: "manufacturer,device"
150+
on-bus: spi
151+
152+
.. code-block:: YAML
153+
154+
compatible: "manufacturer,device"
155+
156+
The following binding can coexist but would not match.
157+
158+
.. code-block:: YAML
159+
160+
compatible: "manufacturer,device"
161+
on-bus: i2c
162+
163+
If more than one matching binding for a compatible is found, an error is raised.
132164

133165
The ``manufacturer`` prefix identifies the device vendor. See
134166
:zephyr_file:`dts/bindings/vendor-prefixes.txt` for a list of accepted vendor

0 commit comments

Comments
 (0)