[PATCH v3 1/2] dt-bindings: nvmem: skip nodes with compatibles other than "nvmem-cell"
From: Ahmad Fatoum
Date: Tue Apr 28 2020 - 07:18:53 EST
For nodes matching the nvmem binding, all child objects matching
"^.*@[0-9a-f]+$" are assumed to be nvmem cells, without taking a
compatible into account.
This precludes:
- future extension of e.g. eeprom nodes by any child nodes other
than nvmem cells
- extending the NVMEM binding to nodes that already have other
child nodes, e.g., MTD and its partitions
To allow co-existence of nvmem-cells with other nodes, loosen the
binding to consult an optional compatible property for the cells:
- if a compatible exists, it must be "nvmem-cell"
- if none exists, it's assumed to be a nvmem cell, like before
As additionalProperties: false was specified for nvmem-cell bindings,
a compatible property was so far invalid. This means no already
compliant device tree should be reinterpreted differently after
this binding adjustment and in that regard, the change is completely
backwards-compatible.
This resolves an existing clash between this nvmem-cell binding and
the barebox bootloader binding that extends the fixed-partitions MTD
binding to EEPROMs.
Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
Documentation/devicetree/bindings/nvmem/nvmem.yaml | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/nvmem/nvmem.yaml b/Documentation/devicetree/bindings/nvmem/nvmem.yaml
index 65980224d550..c39f5dd7e1aa 100644
--- a/Documentation/devicetree/bindings/nvmem/nvmem.yaml
+++ b/Documentation/devicetree/bindings/nvmem/nvmem.yaml
@@ -44,9 +44,21 @@ properties:
patternProperties:
"^.*@[0-9a-f]+$":
- type: object
+ if:
+ properties:
+ compatible:
+ items:
+ const: nvmem-cell
+ then:
+ $ref: "#/definitions/nvmem-cell"
+definitions:
+ nvmem-cell:
properties:
+ compatible:
+ items:
+ const: nvmem-cell
+
reg:
maxItems: 1
description:
--
2.26.2