Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

docs: dt: writing-bindings: describe typical cases

Add a chapter for caveats or typical mistakes. Source: Rob Herring's
(Devicetree bindings maintainer) comments on LKML.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220403081849.8051-1-krzysztof.kozlowski@linaro.org

authored by

Krzysztof Kozlowski and committed by
Rob Herring
44c8a51a d49b3ae4

+25
+25
Documentation/devicetree/bindings/writing-bindings.rst
··· 58 58 - DO define properties in terms of constraints. How many entries? What are 59 59 possible values? What is the order? 60 60 61 + Typical cases and caveats 62 + ========================= 63 + 64 + - Phandle entries, like clocks/dmas/interrupts/resets, should always be 65 + explicitly ordered. Include the {clock,dma,interrupt,reset}-names if there is 66 + more than one phandle. When used, both of these fields need the same 67 + constraints (e.g. list of items). 68 + 69 + - For names used in {clock,dma,interrupt,reset}-names, do not add any suffix, 70 + e.g.: "tx" instead of "txirq" (for interrupt). 71 + 72 + - Properties without schema types (e.g. without standard suffix or not defined 73 + by schema) need the type, even if this is an enum. 74 + 75 + - If schema includes other schema (e.g. /schemas/i2c/i2c-controller.yaml) use 76 + "unevaluatedProperties:false". In other cases, usually use 77 + "additionalProperties:false". 78 + 79 + - For sub-blocks/components of bigger device (e.g. SoC blocks) use rather 80 + device-based compatible (e.g. SoC-based compatible), instead of custom 81 + versioning of that component. 82 + For example use "vendor,soc1234-i2c" instead of "vendor,i2c-v2". 83 + 84 + - "syscon" is not a generic property. Use vendor and type, e.g. 85 + "vendor,power-manager-syscon". 61 86 62 87 Board/SoC .dts Files 63 88 ====================