Thread (21 messages) flat view 21 messages, 3 authors, 2021-10-19

Re: [net-next PATCH v7 16/16] dt-bindings: net: dsa: qca8k: convert to YAML schema

From: Rob Herring <robh@kernel.org>
Date: 2021-10-19 16:18:32
Also in: linux-arm-msm, linux-devicetree, lkml

On Mon, Oct 18, 2021 at 9:22 AM Ansuel Smith [off-list ref] wrote:
On Mon, Oct 18, 2021 at 09:15:12AM -0500, Rob Herring wrote:
quoted
On Thu, Oct 14, 2021 at 12:39:21AM +0200, Ansuel Smith wrote:
quoted
From: Matthew Hagan <redacted>

Convert the qca8k bindings to YAML format.

Signed-off-by: Matthew Hagan <redacted>
Co-developed-by: Ansuel Smith <ansuelsmth@gmail.com>
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
---
 .../devicetree/bindings/net/dsa/qca8k.txt     | 245 ------------
 .../devicetree/bindings/net/dsa/qca8k.yaml    | 362 ++++++++++++++++++
 2 files changed, 362 insertions(+), 245 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/net/dsa/qca8k.txt
 create mode 100644 Documentation/devicetree/bindings/net/dsa/qca8k.yaml
quoted
quoted
+patternProperties:
+  "^(ethernet-)?ports$":
+    type: object
+    properties:
+      '#address-cells':
+        const: 1
+      '#size-cells':
+        const: 0
+
+    patternProperties:
+      "^(ethernet-)?port@[0-6]$":
+        type: object
+        description: Ethernet switch ports
+
+        properties:
+          reg:
+            description: Port number
+
+          label:
+            description:
+              Describes the label associated with this port, which will become
+              the netdev name
+            $ref: /schemas/types.yaml#/definitions/string
+
+          link:
+            description:
+              Should be a list of phandles to other switch's DSA port. This
+              port is used as the outgoing port towards the phandle ports. The
+              full routing information must be given, not just the one hop
+              routes to neighbouring switches
+            $ref: /schemas/types.yaml#/definitions/phandle-array
+
+          ethernet:
+            description:
+              Should be a phandle to a valid Ethernet device node.  This host
+              device is what the switch port is connected to
+            $ref: /schemas/types.yaml#/definitions/phandle
All of this is defined in dsa.yaml. Add a $ref to it and don't duplicate
it here.
The reason I redefined it is because I didn't manage to find a way on
how to add additional bindings for the qca,sgmii... . Any hint about
that?
The problem is we can't have a single schema for parent and child
nodes and then allow additional properties in a child node at least if
we want to make sure all child properties are defined.

The port part of dsa.yaml needs to be split out either to a separate
file or under '$defs' in the same file so that you can reference it
and add properties.

As a separate file, you can then do:

"^(ethernet-)?port@[0-9]+$":
  $ref: dsa-port.yaml#
  unevaluatedProperties: false
  properties:
    a-custom-prop: ...
I tried with allOf but the make check still printed errors in the
example with not valid binding about qca,sgmii.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help