diff mbox series

[v3,1/2] dt-bindings: nvmem: skip nodes with compatibles other than "nvmem-cell"

Message ID 20200428111829.2215-2-a.fatoum@pengutronix.de
State Changes Requested, archived
Headers show
Series nvmem: skip nodes with compatibles other than "nvmem-cell" | expand

Checks

Context Check Description
robh/dt-meta-schema success
robh/checkpatch success

Commit Message

Ahmad Fatoum April 28, 2020, 11:18 a.m. UTC
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@pengutronix.de>
---
 Documentation/devicetree/bindings/nvmem/nvmem.yaml | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

Comments

Ahmad Fatoum May 8, 2020, 6:56 a.m. UTC | #1
Hello Srini,
Hello Rob,

On 4/28/20 1:18 PM, Ahmad Fatoum wrote:
> To allow co-existence of nvmem-cells with other nodes, loosen the
> binding to consult an optional compatible property for the cells:

Gentle ping.

Cheers,
Ahmad
diff mbox series

Patch

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: