All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/5] Bindings for NVMEM layouts
@ 2022-11-14  8:56 Miquel Raynal
  2022-11-14  8:56 ` [PATCH v4 1/5] dt-bindings: nvmem: Introduce the nvmem-layout container Miquel Raynal
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Miquel Raynal @ 2022-11-14  8:56 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, devicetree
  Cc: Robert Marko, Luka Perkov, Thomas Petazzoni, Michael Walle,
	Bartosz Golaszewski, Srinivas Kandagatla, linux-kernel,
	Miquel Raynal

Hello,

A month ago, Michael was sending a new iteration of his series bringing
nvmem layout support. The idea is: we currently can produce nvmem cells
statically defined on top of nvmem devices (which themselves may be MTD
devices sometimes) but in some cases we may need more advanced parsing,
which is possible thanks to the introduction of nvmem layout parsers.

I am not taking over the entire series but I recently tried to make use
of these layouts for the ONIE tlv table layout and Rob (rightfully)
pointed out that the description was messy, because of the mix between
nvmem devices and nvmem parsers. This was known to Michael which
initially argued that it was simpler to handle like that.

So here is a new proposal for the bindings which is described in details
within "dt-bindings: nvmem: Introduce the nvmem-layout container". The
idea to avoid mixing different node contents is to use a container node
when relevant (suggested by Rob) which I named nvmem-layout. This
container will have a compatible that describes the parser (plus
possible additional properties).

Michael, I have a few fixup! patches which apply directly to your former
series in order to support this additional container. I propose we first
settle the bindings (including the two direct use cases as examples) and
once merged, we can move forward and respin both the nvmem series + the
layout drivers.

# Original series (v2) from Michael
Link: https://lore.kernel.org/linux-arm-kernel/20220921115813.208ff789@xps-13/T/#mb97d5376647ff3e686b9c55e3d5e0dc80879e84a

Cheers, Miquèl

Changes since v3:
* Added 'select: false' into the sl28 vpd layout
* Added 'type: objec' and 'additionalProperties: false' to each and
  every nvmem-cell that could be produced by the onie layout to properly
  describe all the subnodes.

Michael Walle (1):
  dt-bindings: nvmem: add YAML schema for the sl28 vpd layout

Miquel Raynal (4):
  dt-bindings: nvmem: Introduce the nvmem-layout container
  dt-bindings: eeprom: Inherit from nvmem.yaml
  dt-bindings: vendor-prefixes: Add ONIE
  dt-bindings: nvmem: add YAML schema for the ONIE tlv layout

 .../devicetree/bindings/eeprom/at24.yaml      |   5 +-
 .../devicetree/bindings/eeprom/at25.yaml      |   1 +
 .../bindings/eeprom/microchip,93lc46b.yaml    |   1 +
 .../nvmem/layouts/kontron,sl28-vpd.yaml       |  62 ++++++++
 .../bindings/nvmem/layouts/nvmem-layout.yaml  |  34 ++++
 .../nvmem/layouts/onie,tlv-layout.yaml        | 147 ++++++++++++++++++
 .../devicetree/bindings/nvmem/nvmem.yaml      |   7 +
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 8 files changed, 258 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/nvmem/layouts/kontron,sl28-vpd.yaml
 create mode 100644 Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml
 create mode 100644 Documentation/devicetree/bindings/nvmem/layouts/onie,tlv-layout.yaml

-- 
2.34.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v4 1/5] dt-bindings: nvmem: Introduce the nvmem-layout container
  2022-11-14  8:56 [PATCH v4 0/5] Bindings for NVMEM layouts Miquel Raynal
@ 2022-11-14  8:56 ` Miquel Raynal
  2022-11-16 20:52   ` Rob Herring
  2022-11-14  8:56 ` [PATCH v4 2/5] dt-bindings: eeprom: Inherit from nvmem.yaml Miquel Raynal
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Miquel Raynal @ 2022-11-14  8:56 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, devicetree
  Cc: Robert Marko, Luka Perkov, Thomas Petazzoni, Michael Walle,
	Bartosz Golaszewski, Srinivas Kandagatla, linux-kernel,
	Miquel Raynal

The nvmem devices description works like this:

* Most cases (EEPROM & co):

eeprom@x {
	 compatible = "<eeprom-compatible>";
	 ...
};

* MTD case:

flash@y {
	compatible = "<flash-compatible>";
	...
	otp {
		compatible = "user-otp"; /* or "factory-otp" */
		...
	};
};

In the former case, the nvmem device is "eeprom@x", while in the latter
case the nvmem device is "otp".

Nvmem devices can produce nvmem cells. The current way to describe nvmem
cells is to locate them by providing their static byte and bit offset
and length. These information are stored in subnodes of the nvmem
device.

It is now a fact that such description does not fit more advanced use
cases where the location or the size of the cells may vary. There are
currently three known situations which require being described
differently: Kontron's SL28 VPD, ONIE's TLV table and U-Boot's
environment variables.

Hence, we need a way to describe the parsers that must be used in order
to make the dynamic discovery of the nvmem cells. This new description
must fit both use cases (the generic situation and the MTD case).

Let's create in both cases a container node named nvmem-layout whose
content will depend on the parser. Right now nvmem-layout.yaml is
"empty", but references to additional layout parser bindings will be
inserted in the near future. The final goal being something that looks
like:

* Most cases (EEPROM & co):

eeprom@x {
	compatible = "<eeprom-compatible>";
	...
	nvmem-layout {
		compatible = "<parser-compatible>";
		...
	};
};

* MTD case:

flash@y {
	compatible = "<flash-compatible>";
	...
	otp {
		compatible = "user-otp"; /* or "factory-otp" */
		...
		nvmem-layout {
			compatible = "<parser-compatible>";
			...
		};
	};
};

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 .../bindings/nvmem/layouts/nvmem-layout.yaml  | 30 +++++++++++++++++++
 .../devicetree/bindings/nvmem/nvmem.yaml      |  7 +++++
 2 files changed, 37 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml

diff --git a/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml b/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml
new file mode 100644
index 000000000000..ecc7c37cbc1f
--- /dev/null
+++ b/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml
@@ -0,0 +1,30 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/nvmem/layouts/nvmem-layout.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NVMEM (Non Volatile Memory) layouts
+
+maintainers:
+  - Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
+  - Michael Walle <michael@walle.cc>
+  - Miquel Raynal <miquel.raynal@bootlin.com>
+
+description: |
+  Most NVMEM layouts are static and thus do not require additional description
+  besides the bytes/bits offset and length. Other layouts can be less statically
+  define and might require dynamic reading of the NVMEM device in order to
+  perform their parsing. The nvmem-layout container is here to describe these.
+
+properties:
+  compatible: true
+
+  '#address-cells': false
+
+  '#size-cells': false
+
+required:
+  - compatible
+
+unevaluatedProperties: false
diff --git a/Documentation/devicetree/bindings/nvmem/nvmem.yaml b/Documentation/devicetree/bindings/nvmem/nvmem.yaml
index 0455506fc30f..75bb93dda9df 100644
--- a/Documentation/devicetree/bindings/nvmem/nvmem.yaml
+++ b/Documentation/devicetree/bindings/nvmem/nvmem.yaml
@@ -39,6 +39,13 @@ properties:
       when it's driven low (logical '0') to allow writing.
     maxItems: 1
 
+  nvmem-layout:
+    $ref: /schemas/nvmem/layouts/nvmem-layout.yaml
+    description:
+      Alternative to the statically defined nvmem cells, this
+      container may reference more advanced (dynamic) layout
+      parsers.
+
 patternProperties:
   "@[0-9a-f]+(,[0-7])?$":
     type: object
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v4 2/5] dt-bindings: eeprom: Inherit from nvmem.yaml
  2022-11-14  8:56 [PATCH v4 0/5] Bindings for NVMEM layouts Miquel Raynal
  2022-11-14  8:56 ` [PATCH v4 1/5] dt-bindings: nvmem: Introduce the nvmem-layout container Miquel Raynal
@ 2022-11-14  8:56 ` Miquel Raynal
  2022-11-14 12:21   ` Bartosz Golaszewski
  2022-11-16 20:52   ` Rob Herring
  2022-11-14  8:56 ` [PATCH v4 3/5] dt-bindings: nvmem: add YAML schema for the sl28 vpd layout Miquel Raynal
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 13+ messages in thread
From: Miquel Raynal @ 2022-11-14  8:56 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, devicetree
  Cc: Robert Marko, Luka Perkov, Thomas Petazzoni, Michael Walle,
	Bartosz Golaszewski, Srinivas Kandagatla, linux-kernel,
	Miquel Raynal

EEPROMs can be nvmem providers. Let's make all EEPROM bindings
reference nvmem.yaml as they should, so that nvmem cells and layout
parsers can be safely described within the EEPROM nodes.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 Documentation/devicetree/bindings/eeprom/at24.yaml           | 5 ++++-
 Documentation/devicetree/bindings/eeprom/at25.yaml           | 1 +
 .../devicetree/bindings/eeprom/microchip,93lc46b.yaml        | 1 +
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/eeprom/at24.yaml b/Documentation/devicetree/bindings/eeprom/at24.yaml
index d14e0accbda8..84af0d5f52aa 100644
--- a/Documentation/devicetree/bindings/eeprom/at24.yaml
+++ b/Documentation/devicetree/bindings/eeprom/at24.yaml
@@ -10,6 +10,9 @@ title: I2C EEPROMs compatible with Atmel's AT24
 maintainers:
   - Bartosz Golaszewski <bgolaszewski@baylibre.com>
 
+allOf:
+  - $ref: /schemas/nvmem/nvmem.yaml
+
 select:
   properties:
     compatible:
@@ -183,7 +186,7 @@ required:
   - compatible
   - reg
 
-additionalProperties: false
+unevaluatedProperties: false
 
 examples:
   - |
diff --git a/Documentation/devicetree/bindings/eeprom/at25.yaml b/Documentation/devicetree/bindings/eeprom/at25.yaml
index 8b1c997caac1..0f5a8ef996d3 100644
--- a/Documentation/devicetree/bindings/eeprom/at25.yaml
+++ b/Documentation/devicetree/bindings/eeprom/at25.yaml
@@ -104,6 +104,7 @@ required:
 
 allOf:
   - $ref: /schemas/spi/spi-peripheral-props.yaml#
+  - $ref: /schemas/nvmem/nvmem.yaml
   - if:
       properties:
         compatible:
diff --git a/Documentation/devicetree/bindings/eeprom/microchip,93lc46b.yaml b/Documentation/devicetree/bindings/eeprom/microchip,93lc46b.yaml
index 0c2f5ddb79c5..64cfd971c9c5 100644
--- a/Documentation/devicetree/bindings/eeprom/microchip,93lc46b.yaml
+++ b/Documentation/devicetree/bindings/eeprom/microchip,93lc46b.yaml
@@ -47,6 +47,7 @@ required:
 
 allOf:
   - $ref: /schemas/spi/spi-peripheral-props.yaml#
+  - $ref: /schemas/nvmem/nvmem.yaml
 
 unevaluatedProperties: false
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v4 3/5] dt-bindings: nvmem: add YAML schema for the sl28 vpd layout
  2022-11-14  8:56 [PATCH v4 0/5] Bindings for NVMEM layouts Miquel Raynal
  2022-11-14  8:56 ` [PATCH v4 1/5] dt-bindings: nvmem: Introduce the nvmem-layout container Miquel Raynal
  2022-11-14  8:56 ` [PATCH v4 2/5] dt-bindings: eeprom: Inherit from nvmem.yaml Miquel Raynal
@ 2022-11-14  8:56 ` Miquel Raynal
  2022-11-16 20:52   ` Rob Herring
  2022-11-14  8:56 ` [PATCH v4 4/5] dt-bindings: vendor-prefixes: Add ONIE Miquel Raynal
  2022-11-14  8:56 ` [PATCH v4 5/5] dt-bindings: nvmem: add YAML schema for the ONIE tlv layout Miquel Raynal
  4 siblings, 1 reply; 13+ messages in thread
From: Miquel Raynal @ 2022-11-14  8:56 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, devicetree
  Cc: Robert Marko, Luka Perkov, Thomas Petazzoni, Michael Walle,
	Bartosz Golaszewski, Srinivas Kandagatla, linux-kernel,
	Miquel Raynal

From: Michael Walle <michael@walle.cc>

Add a schema for the NVMEM layout on Kontron's sl28 boards.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 .../nvmem/layouts/kontron,sl28-vpd.yaml       | 62 +++++++++++++++++++
 .../bindings/nvmem/layouts/nvmem-layout.yaml  |  3 +
 2 files changed, 65 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/nvmem/layouts/kontron,sl28-vpd.yaml

diff --git a/Documentation/devicetree/bindings/nvmem/layouts/kontron,sl28-vpd.yaml b/Documentation/devicetree/bindings/nvmem/layouts/kontron,sl28-vpd.yaml
new file mode 100644
index 000000000000..fef795e79c36
--- /dev/null
+++ b/Documentation/devicetree/bindings/nvmem/layouts/kontron,sl28-vpd.yaml
@@ -0,0 +1,62 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/nvmem/layouts/kontron,sl28-vpd.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NVMEM layout of the Kontron SMARC-sAL28 vital product data
+
+maintainers:
+  - Michael Walle <michael@walle.cc>
+
+description:
+  The vital product data (VPD) of the sl28 boards contains a serial
+  number and a base MAC address. The actual MAC addresses for the
+  on-board ethernet devices are derived from this base MAC address by
+  adding an offset.
+
+select: false
+
+properties:
+  compatible:
+    const: kontron,sl28-vpd
+
+  serial-number:
+    type: object
+    description: The board's serial number
+
+  base-mac-address:
+    type: object
+    description:
+      Base MAC address for all on-module network interfaces. The first
+      argument of the phandle will be treated as an offset.
+
+    properties:
+      "#nvmem-cell-cells":
+        const: 1
+
+    additionalProperties: false
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+      otp-1 {
+          compatible = "user-otp";
+
+          nvmem-layout {
+              compatible = "kontron,sl28-vpd";
+
+              serial_number: serial-number {
+              };
+
+              base_mac_address: base-mac-address {
+                  #nvmem-cell-cells = <1>;
+              };
+          };
+      };
+
+...
diff --git a/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml b/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml
index ecc7c37cbc1f..f64ea2fa362d 100644
--- a/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml
+++ b/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml
@@ -17,6 +17,9 @@ description: |
   define and might require dynamic reading of the NVMEM device in order to
   perform their parsing. The nvmem-layout container is here to describe these.
 
+oneOf:
+  - $ref: kontron,sl28-vpd.yaml
+
 properties:
   compatible: true
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v4 4/5] dt-bindings: vendor-prefixes: Add ONIE
  2022-11-14  8:56 [PATCH v4 0/5] Bindings for NVMEM layouts Miquel Raynal
                   ` (2 preceding siblings ...)
  2022-11-14  8:56 ` [PATCH v4 3/5] dt-bindings: nvmem: add YAML schema for the sl28 vpd layout Miquel Raynal
@ 2022-11-14  8:56 ` Miquel Raynal
  2022-11-14  8:56 ` [PATCH v4 5/5] dt-bindings: nvmem: add YAML schema for the ONIE tlv layout Miquel Raynal
  4 siblings, 0 replies; 13+ messages in thread
From: Miquel Raynal @ 2022-11-14  8:56 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, devicetree
  Cc: Robert Marko, Luka Perkov, Thomas Petazzoni, Michael Walle,
	Bartosz Golaszewski, Srinivas Kandagatla, linux-kernel,
	Miquel Raynal, Rob Herring

As described on their website (see link below),

   "The Open Network Install Environment (ONIE) is an open source
    initiative that defines an open “install environment” for modern
    networking hardware."

It is not a proper corporation per-se but rather more a group which
tries to spread the use of open source standards in the networking
hardware world.

Link: https://opencomputeproject.github.io/onie/
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Rob Herring <robh@kernel.org>
---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
index 6e323a380294..65a74026cf2b 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
+++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
@@ -927,6 +927,8 @@ patternProperties:
     description: One Laptop Per Child
   "^oneplus,.*":
     description: OnePlus Technology (Shenzhen) Co., Ltd.
+  "^onie,.*":
+    description: Open Network Install Environment group
   "^onion,.*":
     description: Onion Corporation
   "^onnn,.*":
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v4 5/5] dt-bindings: nvmem: add YAML schema for the ONIE tlv layout
  2022-11-14  8:56 [PATCH v4 0/5] Bindings for NVMEM layouts Miquel Raynal
                   ` (3 preceding siblings ...)
  2022-11-14  8:56 ` [PATCH v4 4/5] dt-bindings: vendor-prefixes: Add ONIE Miquel Raynal
@ 2022-11-14  8:56 ` Miquel Raynal
  2022-11-16 20:54   ` Rob Herring
  4 siblings, 1 reply; 13+ messages in thread
From: Miquel Raynal @ 2022-11-14  8:56 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, devicetree
  Cc: Robert Marko, Luka Perkov, Thomas Petazzoni, Michael Walle,
	Bartosz Golaszewski, Srinivas Kandagatla, linux-kernel,
	Miquel Raynal

Add a schema for the ONIE tlv NVMEM layout that can be found on any ONIE
compatible networking device.

Describe all the possible NVMEM cells that can be produced by this
layout parser.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 .../bindings/nvmem/layouts/nvmem-layout.yaml  |   1 +
 .../nvmem/layouts/onie,tlv-layout.yaml        | 147 ++++++++++++++++++
 2 files changed, 148 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/nvmem/layouts/onie,tlv-layout.yaml

diff --git a/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml b/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml
index f64ea2fa362d..8512ee538c4c 100644
--- a/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml
+++ b/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml
@@ -19,6 +19,7 @@ description: |
 
 oneOf:
   - $ref: kontron,sl28-vpd.yaml
+  - $ref: onie,tlv-layout.yaml
 
 properties:
   compatible: true
diff --git a/Documentation/devicetree/bindings/nvmem/layouts/onie,tlv-layout.yaml b/Documentation/devicetree/bindings/nvmem/layouts/onie,tlv-layout.yaml
new file mode 100644
index 000000000000..5a0e7671aa3f
--- /dev/null
+++ b/Documentation/devicetree/bindings/nvmem/layouts/onie,tlv-layout.yaml
@@ -0,0 +1,147 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/nvmem/layouts/onie,tlv-layout.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NVMEM layout of the ONIE tlv table
+
+maintainers:
+  - Miquel Raynal <miquel.raynal@bootlin.com>
+
+description:
+  Modern networking hardware implementing the Open Compute Project ONIE
+  infrastructure shall provide a non-volatile memory with a table whose the
+  content is well specified and gives many information about the manufacturer
+  (name, country of manufacture, etc) as well as device caracteristics (serial
+  number, hardware version, mac addresses, etc). The underlaying device type
+  (flash, EEPROM,...) is not specified. The exact location of each value is also
+  dynamic and should be discovered at run time because it depends on the
+  parameters the manufacturer decided to embed.
+
+select: false
+
+properties:
+  compatible:
+    const: onie,tlv-layout
+
+  product-name:
+    type: object
+    additionalProperties: false
+
+  part-number:
+    type: object
+    additionalProperties: false
+
+  serial-number:
+    type: object
+    additionalProperties: false
+
+  mac-address:
+    type: object
+    description:
+      Base MAC address for all on-module network interfaces. The first
+      argument of the phandle will be treated as an offset.
+
+    properties:
+      "#nvmem-cell-cells":
+        const: 1
+
+    additionalProperties: false
+
+  manufacture-date:
+    type: object
+    additionalProperties: false
+
+  device-version:
+    type: object
+    additionalProperties: false
+
+  label-revision:
+    type: object
+    additionalProperties: false
+
+  platforn-name:
+    type: object
+    additionalProperties: false
+
+  onie-version:
+    type: object
+    additionalProperties: false
+
+  num-macs:
+    type: object
+    additionalProperties: false
+
+  manufacturer:
+    type: object
+    additionalProperties: false
+
+  country-code:
+    type: object
+    additionalProperties: false
+
+  vendor:
+    type: object
+    additionalProperties: false
+
+  diag-version:
+    type: object
+    additionalProperties: false
+
+  service-tag:
+    type: object
+    additionalProperties: false
+
+  vendor-extension:
+    type: object
+    additionalProperties: false
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        eeprom@56 {
+            compatible = "atmel,24c64";
+            read-only;
+            reg = <0x56>;
+
+            nvmem-layout {
+                compatible = "onie,tlv-layout";
+
+                serial-number {
+                };
+            };
+        };
+    };
+
+  - |
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        flash@0 {
+            compatible = "m25p80", "jedec,spi-nor";
+            reg = <0>;
+
+            otp {
+                compatible = "user-otp";
+
+                nvmem-layout {
+                    compatible = "onie,tlv-layout";
+
+                    mac-address {
+                        #nvmem-cell-cells = <1>;
+                    };
+                };
+            };
+        };
+    };
+...
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 2/5] dt-bindings: eeprom: Inherit from nvmem.yaml
  2022-11-14  8:56 ` [PATCH v4 2/5] dt-bindings: eeprom: Inherit from nvmem.yaml Miquel Raynal
@ 2022-11-14 12:21   ` Bartosz Golaszewski
  2022-11-16 20:52   ` Rob Herring
  1 sibling, 0 replies; 13+ messages in thread
From: Bartosz Golaszewski @ 2022-11-14 12:21 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Rob Herring, Krzysztof Kozlowski, devicetree, Robert Marko,
	Luka Perkov, Thomas Petazzoni, Michael Walle,
	Srinivas Kandagatla, linux-kernel

On Mon, Nov 14, 2022 at 9:57 AM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>
> EEPROMs can be nvmem providers. Let's make all EEPROM bindings
> reference nvmem.yaml as they should, so that nvmem cells and layout
> parsers can be safely described within the EEPROM nodes.
>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---

Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 3/5] dt-bindings: nvmem: add YAML schema for the sl28 vpd layout
  2022-11-14  8:56 ` [PATCH v4 3/5] dt-bindings: nvmem: add YAML schema for the sl28 vpd layout Miquel Raynal
@ 2022-11-16 20:52   ` Rob Herring
  2022-11-16 21:28     ` Miquel Raynal
  0 siblings, 1 reply; 13+ messages in thread
From: Rob Herring @ 2022-11-16 20:52 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Krzysztof Kozlowski, devicetree, Robert Marko, Luka Perkov,
	Thomas Petazzoni, Michael Walle, Bartosz Golaszewski,
	Srinivas Kandagatla, linux-kernel

On Mon, Nov 14, 2022 at 09:56:57AM +0100, Miquel Raynal wrote:
> From: Michael Walle <michael@walle.cc>
> 
> Add a schema for the NVMEM layout on Kontron's sl28 boards.
> 
> Signed-off-by: Michael Walle <michael@walle.cc>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
>  .../nvmem/layouts/kontron,sl28-vpd.yaml       | 62 +++++++++++++++++++
>  .../bindings/nvmem/layouts/nvmem-layout.yaml  |  3 +
>  2 files changed, 65 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/nvmem/layouts/kontron,sl28-vpd.yaml
> 
> diff --git a/Documentation/devicetree/bindings/nvmem/layouts/kontron,sl28-vpd.yaml b/Documentation/devicetree/bindings/nvmem/layouts/kontron,sl28-vpd.yaml
> new file mode 100644
> index 000000000000..fef795e79c36
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/nvmem/layouts/kontron,sl28-vpd.yaml
> @@ -0,0 +1,62 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/nvmem/layouts/kontron,sl28-vpd.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: NVMEM layout of the Kontron SMARC-sAL28 vital product data
> +
> +maintainers:
> +  - Michael Walle <michael@walle.cc>
> +
> +description:
> +  The vital product data (VPD) of the sl28 boards contains a serial
> +  number and a base MAC address. The actual MAC addresses for the
> +  on-board ethernet devices are derived from this base MAC address by
> +  adding an offset.
> +
> +select: false
> +
> +properties:
> +  compatible:
> +    const: kontron,sl28-vpd
> +
> +  serial-number:
> +    type: object

       additionalProperties: false

With that,

Reviewed-by: Rob Herring <robh@kernel.org>

> +    description: The board's serial number
> +
> +  base-mac-address:
> +    type: object
> +    description:
> +      Base MAC address for all on-module network interfaces. The first
> +      argument of the phandle will be treated as an offset.
> +
> +    properties:
> +      "#nvmem-cell-cells":
> +        const: 1
> +
> +    additionalProperties: false
> +
> +required:
> +  - compatible
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +      otp-1 {
> +          compatible = "user-otp";
> +
> +          nvmem-layout {
> +              compatible = "kontron,sl28-vpd";
> +
> +              serial_number: serial-number {
> +              };
> +
> +              base_mac_address: base-mac-address {
> +                  #nvmem-cell-cells = <1>;
> +              };
> +          };
> +      };
> +
> +...
> diff --git a/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml b/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml
> index ecc7c37cbc1f..f64ea2fa362d 100644
> --- a/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml
> +++ b/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml
> @@ -17,6 +17,9 @@ description: |
>    define and might require dynamic reading of the NVMEM device in order to
>    perform their parsing. The nvmem-layout container is here to describe these.
>  
> +oneOf:
> +  - $ref: kontron,sl28-vpd.yaml
> +
>  properties:
>    compatible: true
>  
> -- 
> 2.34.1
> 
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 1/5] dt-bindings: nvmem: Introduce the nvmem-layout container
  2022-11-14  8:56 ` [PATCH v4 1/5] dt-bindings: nvmem: Introduce the nvmem-layout container Miquel Raynal
@ 2022-11-16 20:52   ` Rob Herring
  0 siblings, 0 replies; 13+ messages in thread
From: Rob Herring @ 2022-11-16 20:52 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: linux-kernel, Luka Perkov, Krzysztof Kozlowski, Robert Marko,
	Bartosz Golaszewski, Rob Herring, devicetree, Thomas Petazzoni,
	Michael Walle, Srinivas Kandagatla


On Mon, 14 Nov 2022 09:56:55 +0100, Miquel Raynal wrote:
> The nvmem devices description works like this:
> 
> * Most cases (EEPROM & co):
> 
> eeprom@x {
> 	 compatible = "<eeprom-compatible>";
> 	 ...
> };
> 
> * MTD case:
> 
> flash@y {
> 	compatible = "<flash-compatible>";
> 	...
> 	otp {
> 		compatible = "user-otp"; /* or "factory-otp" */
> 		...
> 	};
> };
> 
> In the former case, the nvmem device is "eeprom@x", while in the latter
> case the nvmem device is "otp".
> 
> Nvmem devices can produce nvmem cells. The current way to describe nvmem
> cells is to locate them by providing their static byte and bit offset
> and length. These information are stored in subnodes of the nvmem
> device.
> 
> It is now a fact that such description does not fit more advanced use
> cases where the location or the size of the cells may vary. There are
> currently three known situations which require being described
> differently: Kontron's SL28 VPD, ONIE's TLV table and U-Boot's
> environment variables.
> 
> Hence, we need a way to describe the parsers that must be used in order
> to make the dynamic discovery of the nvmem cells. This new description
> must fit both use cases (the generic situation and the MTD case).
> 
> Let's create in both cases a container node named nvmem-layout whose
> content will depend on the parser. Right now nvmem-layout.yaml is
> "empty", but references to additional layout parser bindings will be
> inserted in the near future. The final goal being something that looks
> like:
> 
> * Most cases (EEPROM & co):
> 
> eeprom@x {
> 	compatible = "<eeprom-compatible>";
> 	...
> 	nvmem-layout {
> 		compatible = "<parser-compatible>";
> 		...
> 	};
> };
> 
> * MTD case:
> 
> flash@y {
> 	compatible = "<flash-compatible>";
> 	...
> 	otp {
> 		compatible = "user-otp"; /* or "factory-otp" */
> 		...
> 		nvmem-layout {
> 			compatible = "<parser-compatible>";
> 			...
> 		};
> 	};
> };
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
>  .../bindings/nvmem/layouts/nvmem-layout.yaml  | 30 +++++++++++++++++++
>  .../devicetree/bindings/nvmem/nvmem.yaml      |  7 +++++
>  2 files changed, 37 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml
> 

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 2/5] dt-bindings: eeprom: Inherit from nvmem.yaml
  2022-11-14  8:56 ` [PATCH v4 2/5] dt-bindings: eeprom: Inherit from nvmem.yaml Miquel Raynal
  2022-11-14 12:21   ` Bartosz Golaszewski
@ 2022-11-16 20:52   ` Rob Herring
  1 sibling, 0 replies; 13+ messages in thread
From: Rob Herring @ 2022-11-16 20:52 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Bartosz Golaszewski, Thomas Petazzoni, Robert Marko, devicetree,
	Rob Herring, Srinivas Kandagatla, linux-kernel,
	Krzysztof Kozlowski, Michael Walle, Luka Perkov


On Mon, 14 Nov 2022 09:56:56 +0100, Miquel Raynal wrote:
> EEPROMs can be nvmem providers. Let's make all EEPROM bindings
> reference nvmem.yaml as they should, so that nvmem cells and layout
> parsers can be safely described within the EEPROM nodes.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
>  Documentation/devicetree/bindings/eeprom/at24.yaml           | 5 ++++-
>  Documentation/devicetree/bindings/eeprom/at25.yaml           | 1 +
>  .../devicetree/bindings/eeprom/microchip,93lc46b.yaml        | 1 +
>  3 files changed, 6 insertions(+), 1 deletion(-)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 5/5] dt-bindings: nvmem: add YAML schema for the ONIE tlv layout
  2022-11-14  8:56 ` [PATCH v4 5/5] dt-bindings: nvmem: add YAML schema for the ONIE tlv layout Miquel Raynal
@ 2022-11-16 20:54   ` Rob Herring
  0 siblings, 0 replies; 13+ messages in thread
From: Rob Herring @ 2022-11-16 20:54 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Michael Walle, Krzysztof Kozlowski, Srinivas Kandagatla,
	Thomas Petazzoni, Luka Perkov, Bartosz Golaszewski, Rob Herring,
	Robert Marko, devicetree, linux-kernel


On Mon, 14 Nov 2022 09:56:59 +0100, Miquel Raynal wrote:
> Add a schema for the ONIE tlv NVMEM layout that can be found on any ONIE
> compatible networking device.
> 
> Describe all the possible NVMEM cells that can be produced by this
> layout parser.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
>  .../bindings/nvmem/layouts/nvmem-layout.yaml  |   1 +
>  .../nvmem/layouts/onie,tlv-layout.yaml        | 147 ++++++++++++++++++
>  2 files changed, 148 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/nvmem/layouts/onie,tlv-layout.yaml
> 

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 3/5] dt-bindings: nvmem: add YAML schema for the sl28 vpd layout
  2022-11-16 20:52   ` Rob Herring
@ 2022-11-16 21:28     ` Miquel Raynal
  2022-11-16 22:44       ` Srinivas Kandagatla
  0 siblings, 1 reply; 13+ messages in thread
From: Miquel Raynal @ 2022-11-16 21:28 UTC (permalink / raw)
  To: Rob Herring
  Cc: Krzysztof Kozlowski, devicetree, Robert Marko, Luka Perkov,
	Thomas Petazzoni, Michael Walle, Bartosz Golaszewski,
	Srinivas Kandagatla, linux-kernel

Hi Rob, Srinivas,

robh@kernel.org wrote on Wed, 16 Nov 2022 14:52:03 -0600:

> On Mon, Nov 14, 2022 at 09:56:57AM +0100, Miquel Raynal wrote:
> > From: Michael Walle <michael@walle.cc>
> > 
> > Add a schema for the NVMEM layout on Kontron's sl28 boards.
> > 
> > Signed-off-by: Michael Walle <michael@walle.cc>
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > ---
> >  .../nvmem/layouts/kontron,sl28-vpd.yaml       | 62 +++++++++++++++++++
> >  .../bindings/nvmem/layouts/nvmem-layout.yaml  |  3 +
> >  2 files changed, 65 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/nvmem/layouts/kontron,sl28-vpd.yaml
> > 
> > diff --git a/Documentation/devicetree/bindings/nvmem/layouts/kontron,sl28-vpd.yaml b/Documentation/devicetree/bindings/nvmem/layouts/kontron,sl28-vpd.yaml
> > new file mode 100644
> > index 000000000000..fef795e79c36
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/nvmem/layouts/kontron,sl28-vpd.yaml
> > @@ -0,0 +1,62 @@
> > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/nvmem/layouts/kontron,sl28-vpd.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: NVMEM layout of the Kontron SMARC-sAL28 vital product data
> > +
> > +maintainers:
> > +  - Michael Walle <michael@walle.cc>
> > +
> > +description:
> > +  The vital product data (VPD) of the sl28 boards contains a serial
> > +  number and a base MAC address. The actual MAC addresses for the
> > +  on-board ethernet devices are derived from this base MAC address by
> > +  adding an offset.
> > +
> > +select: false
> > +
> > +properties:
> > +  compatible:
> > +    const: kontron,sl28-vpd
> > +
> > +  serial-number:
> > +    type: object  
> 
>        additionalProperties: false

Right, I missed that one.

> With that,
> 
> Reviewed-by: Rob Herring <robh@kernel.org>

Thanks for all the reviews!

Srinivas, would you add the above property while applying or do you
prefer me to send a v5?

Thanks,
Miquèl

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v4 3/5] dt-bindings: nvmem: add YAML schema for the sl28 vpd layout
  2022-11-16 21:28     ` Miquel Raynal
@ 2022-11-16 22:44       ` Srinivas Kandagatla
  0 siblings, 0 replies; 13+ messages in thread
From: Srinivas Kandagatla @ 2022-11-16 22:44 UTC (permalink / raw)
  To: Miquel Raynal, Rob Herring
  Cc: Krzysztof Kozlowski, devicetree, Robert Marko, Luka Perkov,
	Thomas Petazzoni, Michael Walle, Bartosz Golaszewski,
	linux-kernel



On 16/11/2022 21:28, Miquel Raynal wrote:
> Hi Rob, Srinivas,
> 
> robh@kernel.org wrote on Wed, 16 Nov 2022 14:52:03 -0600:
> 
>> On Mon, Nov 14, 2022 at 09:56:57AM +0100, Miquel Raynal wrote:
>>> From: Michael Walle <michael@walle.cc>
>>>
>>> Add a schema for the NVMEM layout on Kontron's sl28 boards.
>>>
>>> Signed-off-by: Michael Walle <michael@walle.cc>
>>> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
>>> ---
>>>   .../nvmem/layouts/kontron,sl28-vpd.yaml       | 62 +++++++++++++++++++
>>>   .../bindings/nvmem/layouts/nvmem-layout.yaml  |  3 +
>>>   2 files changed, 65 insertions(+)
>>>   create mode 100644 Documentation/devicetree/bindings/nvmem/layouts/kontron,sl28-vpd.yaml
>>>
>>> diff --git a/Documentation/devicetree/bindings/nvmem/layouts/kontron,sl28-vpd.yaml b/Documentation/devicetree/bindings/nvmem/layouts/kontron,sl28-vpd.yaml
>>> new file mode 100644
>>> index 000000000000..fef795e79c36
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/nvmem/layouts/kontron,sl28-vpd.yaml
>>> @@ -0,0 +1,62 @@
>>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>>> +%YAML 1.2
>>> +---
>>> +$id: http://devicetree.org/schemas/nvmem/layouts/kontron,sl28-vpd.yaml#
>>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>>> +
>>> +title: NVMEM layout of the Kontron SMARC-sAL28 vital product data
>>> +
>>> +maintainers:
>>> +  - Michael Walle <michael@walle.cc>
>>> +
>>> +description:
>>> +  The vital product data (VPD) of the sl28 boards contains a serial
>>> +  number and a base MAC address. The actual MAC addresses for the
>>> +  on-board ethernet devices are derived from this base MAC address by
>>> +  adding an offset.
>>> +
>>> +select: false
>>> +
>>> +properties:
>>> +  compatible:
>>> +    const: kontron,sl28-vpd
>>> +
>>> +  serial-number:
>>> +    type: object
>>
>>         additionalProperties: false
> 
> Right, I missed that one.
> 
>> With that,
>>
>> Reviewed-by: Rob Herring <robh@kernel.org>
> 
> Thanks for all the reviews!
> 
> Srinivas, would you add the above property while applying or do you
> prefer me to send a v5?

Applied the series after adding the property.

--srini
> 
> Thanks,
> Miquèl

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-11-16 22:45 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-14  8:56 [PATCH v4 0/5] Bindings for NVMEM layouts Miquel Raynal
2022-11-14  8:56 ` [PATCH v4 1/5] dt-bindings: nvmem: Introduce the nvmem-layout container Miquel Raynal
2022-11-16 20:52   ` Rob Herring
2022-11-14  8:56 ` [PATCH v4 2/5] dt-bindings: eeprom: Inherit from nvmem.yaml Miquel Raynal
2022-11-14 12:21   ` Bartosz Golaszewski
2022-11-16 20:52   ` Rob Herring
2022-11-14  8:56 ` [PATCH v4 3/5] dt-bindings: nvmem: add YAML schema for the sl28 vpd layout Miquel Raynal
2022-11-16 20:52   ` Rob Herring
2022-11-16 21:28     ` Miquel Raynal
2022-11-16 22:44       ` Srinivas Kandagatla
2022-11-14  8:56 ` [PATCH v4 4/5] dt-bindings: vendor-prefixes: Add ONIE Miquel Raynal
2022-11-14  8:56 ` [PATCH v4 5/5] dt-bindings: nvmem: add YAML schema for the ONIE tlv layout Miquel Raynal
2022-11-16 20:54   ` Rob Herring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.