dt-bindings: nvmem: layouts: add fixed-layout
Subsystems (2)
PATCH 1/1 dt-bindings: nvmem: layouts: add fixed-layout
From: Rafał Miłecki <[email protected]>
With the introduction of NVMEM layouts I believe we should prefer and support describing all NVMEM devices content in the "nvmem-layout" node. Inluding fixed NVMEM cells (those with hardcoded offset & size).
This seems to be cleaner design and more explicit.
Introduce a binding allowing fixed NVMEM cells as a type of layout.
--- .../bindings/nvmem/layouts/fixed-layout.yaml | 52 +++++++++++++++++++ .../bindings/nvmem/layouts/nvmem-layout.yaml | 1 + 2 files changed, 53 insertions(+) create mode 100644 Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.yaml
Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.yaml new file +52 -0
@@ -0,0 +1,52 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/nvmem/layouts/fixed-layout.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NVMEM layout for fixed NVMEM cells + +description: + Many NVMEM devices have hardcoded cells layout (offset and size of specific + NVMEM content doesn't change). + + This binding allows defining such cells using NVMEM layout. It can be used on + top of any NVMEM device. + +maintainers: + - Rafał Miłecki <[email protected]> + +properties: + compatible: + const: fixed-layout + + "#address-cells": + const: 1 + + "#size-cells": + const: 1 + +patternProperties: + "@[a-f0-9]+$": + type: object + description: NVMEM cell + properties: + reg: + maxItems: 1 + +required: + - compatible + +additionalProperties: false + +examples: + - | + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + calibration@4000 { + reg = <0x4000 0x100>; + }; + };
Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml +1 -0
@@ -18,6 +18,7 @@ description: | perform their parsing. The nvmem-layout container is here to describe these. oneOf: + - $ref: fixed-layout.yaml - $ref: kontron,sl28-vpd.yaml - $ref: onie,tlv-layout.yaml
Signature · 1 line
2.34.1
Quoted 7 lines · Rafał Miłecki
With the introduction of NVMEM layouts I believe we should prefer and support describing all NVMEM devices content in the "nvmem-layout" node. Inluding fixed NVMEM cells (those with hardcoded offset & size).
This seems to be cleaner design and more explicit.
Introduce a binding allowing fixed NVMEM cells as a type of layout.
While this is obvious to me I should make it clear anyway:
We must not break backward compatibility. Old binding should remain supported. We may want to deprecate old binding but we have to support existing DT files.
Hi,
Am 2023-03-09 10:34, schrieb Rafał Miłecki:
Quoted 53 lines
From: Rafał Miłecki <[email protected]>
With the introduction of NVMEM layouts I believe we should prefer and support describing all NVMEM devices content in the "nvmem-layout" node. Inluding fixed NVMEM cells (those with hardcoded offset & size).
This seems to be cleaner design and more explicit.
Introduce a binding allowing fixed NVMEM cells as a type of layout.
Signed-off-by Rafał Miłecki <[email protected]>--- .../bindings/nvmem/layouts/fixed-layout.yaml | 52 +++++++++++++++++++ .../bindings/nvmem/layouts/nvmem-layout.yaml | 1 + 2 files changed, 53 insertions(+) create mode 100644
Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.yamldiff --git
a/Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.yamlb/Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.yamlnew file mode 100644
index 000000000000..7eb86c999a5eDocumentation/devicetree/bindings/nvmem/layouts/fixed-layout.yaml new file +10
-0@@ -0,0 +1,52 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/nvmem/layouts/fixed-layout.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NVMEM layout for fixed NVMEM cells + +description: + Many NVMEM devices have hardcoded cells layout (offset and size ofspecific
Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.yaml new file +3
-0+ NVMEM content doesn't change). + + This binding allows defining such cells using NVMEM layout. It canbe used on
Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.yaml new file +12
-0+ top of any NVMEM device. + +maintainers: + - Rafał Miłecki <[email protected]> + +properties: + compatible: + const: fixed-layout + + "#address-cells": + const: 1 +
Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.yaml line 35
Quoted 10 lines
Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.yaml new file +10
-0+ "#size-cells": + const: 1 + +patternProperties: + "@[a-f0-9]+$": + type: object + description: NVMEM cell + properties: + reg: + maxItems: 1
Looking at Documentation/devicetree/bindings/nvmem/nvmem.yaml this is missing the bits property. Also, can we share that information between the old style and the new style somehow so we don't duplicate that here?
-michael
Quoted 31 lines
Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.yaml new file +17
-0+ +required: + - compatible + +additionalProperties: false + +examples: + - | + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + calibration@4000 { + reg = <0x4000 0x100>; + }; + };diff --git
a/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yamlb/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yamlindex8512ee538c4c..03da7848c713100644Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml +0
-0@@ -18,6 +18,7 @@ description: | perform their parsing. The nvmem-layout container is here todescribe these.
oneOf:
+ - $ref:fixed-layout.yaml
- $ref: kontron,sl28-vpd.yaml
- $ref: onie,tlv-layout.yaml