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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 18, 2021 at 9:22 AM Ansuel Smith <ansuelsmth@xxxxxxxxx> wrote:
>
> On Mon, Oct 18, 2021 at 09:15:12AM -0500, Rob Herring wrote:
> > On Thu, Oct 14, 2021 at 12:39:21AM +0200, Ansuel Smith wrote:
> > > From: Matthew Hagan <mnhagan88@xxxxxxxxx>
> > >
> > > Convert the qca8k bindings to YAML format.
> > >
> > > Signed-off-by: Matthew Hagan <mnhagan88@xxxxxxxxx>
> > > Co-developed-by: Ansuel Smith <ansuelsmth@xxxxxxxxx>
> > > Signed-off-by: Ansuel Smith <ansuelsmth@xxxxxxxxx>
> > > ---
> > >  .../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

> > > +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.



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux