[2/5] dt-bindings: nvmem: add YAML schema for the ONIE tlv layout

Message ID 20221028092337.822840-3-miquel.raynal@bootlin.com
State New
Headers
Series ONIE tlv nvmem layout support |

Commit Message

Miquel Raynal Oct. 28, 2022, 9:23 a.m. UTC
  Add a schema for the ONIE tlv NVMEM layout that can be found on any ONIE
compatible networking device.

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

Comments

Rob Herring Oct. 28, 2022, 12:20 p.m. UTC | #1
On Fri, 28 Oct 2022 11:23:34 +0200, Miquel Raynal wrote:
> Add a schema for the ONIE tlv NVMEM layout that can be found on any ONIE
> compatible networking device.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
>  .../nvmem/layouts/onie,tlv-layout.yaml        | 96 +++++++++++++++++++
>  1 file changed, 96 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/nvmem/layouts/onie,tlv-layout.yaml
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/nvmem/layouts/onie,tlv-layout.example.dtb:0:0: /example-0/onie: failed to match any schema with compatible: ['onie,tlv-layout', 'vendor,device']

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.
  
Miquel Raynal Oct. 28, 2022, 1:44 p.m. UTC | #2
Hi Rob & Krzysztof,

robh@kernel.org wrote on Fri, 28 Oct 2022 07:20:05 -0500:

> On Fri, 28 Oct 2022 11:23:34 +0200, Miquel Raynal wrote:
> > Add a schema for the ONIE tlv NVMEM layout that can be found on any ONIE
> > compatible networking device.
> > 
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > ---
> >  .../nvmem/layouts/onie,tlv-layout.yaml        | 96 +++++++++++++++++++
> >  1 file changed, 96 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/nvmem/layouts/onie,tlv-layout.yaml
> >   
> 
> My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> on your patch (DT_CHECKER_FLAGS is new in v5.13):
> 
> yamllint warnings/errors:
> 
> dtschema/dtc warnings/errors:
> Documentation/devicetree/bindings/nvmem/layouts/onie,tlv-layout.example.dtb:0:0: /example-0/onie: failed to match any schema with compatible: ['onie,tlv-layout', 'vendor,device']

Oh right, I wanted to ask about this under the three --- but I forgot.
Here was my question:

How do we make the checker happy with an example where the second
compatible can be almost anything (any nvmem-compatible device) but the
first one should be the layout? (this is currently what Michael's
proposal uses).

> doc reference errors (make refcheckdocs):
> 
> See https://patchwork.ozlabs.org/patch/
> 
> This check can fail if there are any dependencies. The base for a patch
> series is generally the most recent rc1.
> 
> If you already ran 'make dt_binding_check' and didn't see the above
> error(s), then make sure 'yamllint' is installed and dt-schema is up to
> date:
> 
> pip3 install dtschema --upgrade
> 
> Please check and re-submit.
> 


Thanks,
Miquèl
  
Rob Herring Oct. 28, 2022, 9:35 p.m. UTC | #3
On Fri, Oct 28, 2022 at 03:44:31PM +0200, Miquel Raynal wrote:
> Hi Rob & Krzysztof,
> 
> robh@kernel.org wrote on Fri, 28 Oct 2022 07:20:05 -0500:
> 
> > On Fri, 28 Oct 2022 11:23:34 +0200, Miquel Raynal wrote:
> > > Add a schema for the ONIE tlv NVMEM layout that can be found on any ONIE
> > > compatible networking device.
> > > 
> > > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > > ---
> > >  .../nvmem/layouts/onie,tlv-layout.yaml        | 96 +++++++++++++++++++
> > >  1 file changed, 96 insertions(+)
> > >  create mode 100644 Documentation/devicetree/bindings/nvmem/layouts/onie,tlv-layout.yaml
> > >   
> > 
> > My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> > on your patch (DT_CHECKER_FLAGS is new in v5.13):
> > 
> > yamllint warnings/errors:
> > 
> > dtschema/dtc warnings/errors:
> > Documentation/devicetree/bindings/nvmem/layouts/onie,tlv-layout.example.dtb:0:0: /example-0/onie: failed to match any schema with compatible: ['onie,tlv-layout', 'vendor,device']
> 
> Oh right, I wanted to ask about this under the three --- but I forgot.
> Here was my question:
> 
> How do we make the checker happy with an example where the second
> compatible can be almost anything (any nvmem-compatible device) but the
> first one should be the layout? (this is currently what Michael's
> proposal uses).

That seems like mixing 2 different meanings for compatibles. Perhaps 
that should be split with the nvmem stuff going into a child container 
node.

Rob

P.S. Any compatible string starting with 'foo' will pass, but I probably 
won't be happy to see that used.
  
Miquel Raynal Nov. 4, 2022, 10:56 a.m. UTC | #4
Hi Rob,

robh@kernel.org wrote on Fri, 28 Oct 2022 16:35:56 -0500:

> On Fri, Oct 28, 2022 at 03:44:31PM +0200, Miquel Raynal wrote:
> > Hi Rob & Krzysztof,
> > 
> > robh@kernel.org wrote on Fri, 28 Oct 2022 07:20:05 -0500:
> >   
> > > On Fri, 28 Oct 2022 11:23:34 +0200, Miquel Raynal wrote:  
> > > > Add a schema for the ONIE tlv NVMEM layout that can be found on any ONIE
> > > > compatible networking device.
> > > > 
> > > > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > > > ---
> > > >  .../nvmem/layouts/onie,tlv-layout.yaml        | 96 +++++++++++++++++++
> > > >  1 file changed, 96 insertions(+)
> > > >  create mode 100644 Documentation/devicetree/bindings/nvmem/layouts/onie,tlv-layout.yaml
> > > >     
> > > 
> > > My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> > > on your patch (DT_CHECKER_FLAGS is new in v5.13):
> > > 
> > > yamllint warnings/errors:
> > > 
> > > dtschema/dtc warnings/errors:
> > > Documentation/devicetree/bindings/nvmem/layouts/onie,tlv-layout.example.dtb:0:0: /example-0/onie: failed to match any schema with compatible: ['onie,tlv-layout', 'vendor,device']  
> > 
> > Oh right, I wanted to ask about this under the three --- but I forgot.
> > Here was my question:
> > 
> > How do we make the checker happy with an example where the second
> > compatible can be almost anything (any nvmem-compatible device) but the
> > first one should be the layout? (this is currently what Michael's
> > proposal uses).  
> 
> That seems like mixing 2 different meanings for compatibles. Perhaps 
> that should be split with the nvmem stuff going into a child container 
> node.
> 
> Rob
> 
> P.S. Any compatible string starting with 'foo' will pass, but I probably 
> won't be happy to see that used.

Ok, I've scratched my forehead a little bit and came with something (I
hope) better. I've taken over the binding patches from Michael's
original series to show how they conform with my changes. Basically
I've introduced an nvmem-layout container node which will improve a lot
the description without mixing everything. More details in the upcoming
series.

Thanks, Miquèl
  

Patch

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..388547d46646
--- /dev/null
+++ b/Documentation/devicetree/bindings/nvmem/layouts/onie,tlv-layout.yaml
@@ -0,0 +1,96 @@ 
+# 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.
+
+allOf:
+  - $ref: "../nvmem.yaml#"
+
+select:
+  properties:
+    compatible:
+      contains:
+        const: onie,tlv-layout
+  required:
+    - compatible
+
+properties:
+  compatible: true
+
+  product-name: true
+
+  part-number: true
+
+  serial-number: true
+
+  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: true
+
+  device-version: true
+
+  label-revision: true
+
+  platforn-name: true
+
+  onie-version: true
+
+  num-macs: true
+
+  manufacturer: true
+
+  country-code: true
+
+  vendor: true
+
+  diag-version: true
+
+  service-tag: true
+
+  vendor-extension: true
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+        onie {
+            compatible = "onie,tlv-layout", "vendor,device";
+
+            serial_number: serial-number {
+            };
+
+            mac_address: mac-address {
+                #nvmem-cell-cells = <1>;
+            };
+        };
+
+...