diff mbox series

[3/5] dt-bindings: nvmem: allow referencing device defined cells by names

Message ID 20211223110755.22722-4-zajec5@gmail.com
State New
Headers show
Series nvmem: support more NVMEM cells variants | expand

Commit Message

Rafał Miłecki Dec. 23, 2021, 11:07 a.m. UTC
From: Rafał Miłecki <rafal@milecki.pl>

Not every NVMEM has predefined cells at hardcoded addresses. Some
devices store cells in internal structs and custom formats. Referencing
such cells is still required to let other bindings use them.

Modify binding to require "reg" xor "label". The later one can be used
to match "dynamic" NVMEM cells by their names.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 Documentation/devicetree/bindings/nvmem/nvmem.yaml | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

Comments

Rob Herring Dec. 23, 2021, 9:18 p.m. UTC | #1
On Thu, Dec 23, 2021 at 7:08 AM Rafał Miłecki <zajec5@gmail.com> wrote:
>
> From: Rafał Miłecki <rafal@milecki.pl>
>
> Not every NVMEM has predefined cells at hardcoded addresses. Some
> devices store cells in internal structs and custom formats. Referencing
> such cells is still required to let other bindings use them.
>
> Modify binding to require "reg" xor "label". The later one can be used
> to match "dynamic" NVMEM cells by their names.

'label' is supposed to correspond to a sticker on a port or something
human identifiable. It generally should be something optional to
making the OS functional. Yes, there are already some abuses of that,
but this case is too far for me.

Rob
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/nvmem/nvmem.yaml b/Documentation/devicetree/bindings/nvmem/nvmem.yaml
index 3392405ee010..83154df25c27 100644
--- a/Documentation/devicetree/bindings/nvmem/nvmem.yaml
+++ b/Documentation/devicetree/bindings/nvmem/nvmem.yaml
@@ -43,6 +43,12 @@  patternProperties:
   "@[0-9a-f]+(,[0-7])?$":
     type: object
 
+    description: |
+      NVMEM cell - a part of NVMEM containing one specific information.
+
+      Cells can be fully defined by a binding or stored in NVMEM device specific
+      data and just referenced in DT by a name (label).
+
     properties:
       reg:
         maxItems: 1
@@ -64,8 +70,11 @@  patternProperties:
               description:
                 Size in bit within the address range specified by reg.
 
-    required:
-      - reg
+    oneOf:
+      - required:
+          - reg
+      - required:
+          - label
 
 additionalProperties: true