All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/1] dt-bindings: net: dsa: Add DSA yaml binding
@ 2020-07-10  9:06 Kurt Kanzenbach
  2020-07-10  9:06 ` [PATCH v1 1/1] " Kurt Kanzenbach
  0 siblings, 1 reply; 15+ messages in thread
From: Kurt Kanzenbach @ 2020-07-10  9:06 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli
  Cc: David S. Miller, Jakub Kicinski, Rob Herring, netdev, devicetree,
	Kurt Kanzenbach

Hi,

as discussed [1] it makes sense to add a DSA yaml binding. So here it
is. Feedback is highly welcome. Tested in combination with the hellcreek.yaml
file.

Thanks,
Kurt

[1] - https://lkml.kernel.org/netdev/449f0a03-a91d-ae82-b31f-59dfd1457ec5@gmail.com/

Kurt Kanzenbach (1):
  dt-bindings: net: dsa: Add DSA yaml binding

 .../devicetree/bindings/net/dsa/dsa.yaml      | 80 +++++++++++++++++++
 1 file changed, 80 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/dsa/dsa.yaml

-- 
2.20.1


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

* [PATCH v1 1/1] dt-bindings: net: dsa: Add DSA yaml binding
  2020-07-10  9:06 [PATCH v1 0/1] dt-bindings: net: dsa: Add DSA yaml binding Kurt Kanzenbach
@ 2020-07-10  9:06 ` Kurt Kanzenbach
  2020-07-10 16:39   ` Rob Herring
  2020-07-10 16:45   ` Rob Herring
  0 siblings, 2 replies; 15+ messages in thread
From: Kurt Kanzenbach @ 2020-07-10  9:06 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli
  Cc: David S. Miller, Jakub Kicinski, Rob Herring, netdev, devicetree,
	Kurt Kanzenbach

For future DSA drivers it makes sense to add a generic DSA yaml binding which
can be used then. This was created using the properties from dsa.txt. It
includes the ports and the dsa,member property.

Suggested-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
---
 .../devicetree/bindings/net/dsa/dsa.yaml      | 80 +++++++++++++++++++
 1 file changed, 80 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/dsa/dsa.yaml

diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.yaml b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
new file mode 100644
index 000000000000..bec257231bf8
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
@@ -0,0 +1,80 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/dsa/dsa.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Distributed Switch Architecture Device Tree Bindings
+
+maintainers:
+  - Andrew Lunn <andrew@lunn.ch>
+  - Florian Fainelli <f.fainelli@gmail.com>
+  - Vivien Didelot <vivien.didelot@gmail.com>
+
+description:
+  Switches are true Linux devices and can be probed by any means. Once probed,
+  they register to the DSA framework, passing a node pointer. This node is
+  expected to fulfil the following binding, and may contain additional
+  properties as required by the device it is embedded within.
+
+properties:
+  $nodename:
+    pattern: "^switch(@.*)?$"
+
+  dsa,member:
+    minItems: 2
+    maxItems: 2
+    description:
+      A two element list indicates which DSA cluster, and position within the
+      cluster a switch takes. <0 0> is cluster 0, switch 0. <0 1> is cluster 0,
+      switch 1. <1 0> is cluster 1, switch 0. A switch not part of any cluster
+      (single device hanging off a CPU port) must not specify this property
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+
+  ports:
+    type: object
+    properties:
+      '#address-cells':
+        const: 1
+      '#size-cells':
+        const: 0
+
+    patternProperties:
+      "^port@[0-9]+$":
+          type: object
+          description: DSA switch ports
+
+          allOf:
+            - $ref: ../ethernet-controller.yaml#
+
+          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
+
+          required:
+            - reg
+
+required:
+  - ports
+
+...
-- 
2.20.1


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

* Re: [PATCH v1 1/1] dt-bindings: net: dsa: Add DSA yaml binding
  2020-07-10  9:06 ` [PATCH v1 1/1] " Kurt Kanzenbach
@ 2020-07-10 16:39   ` Rob Herring
  2020-07-11 11:35     ` Kurt Kanzenbach
  2020-07-10 16:45   ` Rob Herring
  1 sibling, 1 reply; 15+ messages in thread
From: Rob Herring @ 2020-07-10 16:39 UTC (permalink / raw)
  To: Kurt Kanzenbach
  Cc: Andrew Lunn, Florian Fainelli, David S. Miller, netdev,
	devicetree, Vivien Didelot, Jakub Kicinski, Rob Herring

On Fri, 10 Jul 2020 11:06:18 +0200, Kurt Kanzenbach wrote:
> For future DSA drivers it makes sense to add a generic DSA yaml binding which
> can be used then. This was created using the properties from dsa.txt. It
> includes the ports and the dsa,member property.
> 
> Suggested-by: Florian Fainelli <f.fainelli@gmail.com>
> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
> ---
>  .../devicetree/bindings/net/dsa/dsa.yaml      | 80 +++++++++++++++++++
>  1 file changed, 80 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/net/dsa/dsa.yaml
> 


My bot found errors running 'make dt_binding_check' on your patch:

/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/net/ti,cpsw-switch.example.dt.yaml: switch@0: 'ports' is a required property
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.example.dt.yaml: switch@10: 'ports' is a required property


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

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

pip3 install git+https://github.com/devicetree-org/dt-schema.git@master --upgrade

Please check and re-submit.


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

* Re: [PATCH v1 1/1] dt-bindings: net: dsa: Add DSA yaml binding
  2020-07-10  9:06 ` [PATCH v1 1/1] " Kurt Kanzenbach
  2020-07-10 16:39   ` Rob Herring
@ 2020-07-10 16:45   ` Rob Herring
  2020-07-10 17:20     ` Florian Fainelli
  2020-07-10 17:39     ` Andrew Lunn
  1 sibling, 2 replies; 15+ messages in thread
From: Rob Herring @ 2020-07-10 16:45 UTC (permalink / raw)
  To: Kurt Kanzenbach
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, David S. Miller,
	Jakub Kicinski, netdev, devicetree

On Fri, Jul 10, 2020 at 11:06:18AM +0200, Kurt Kanzenbach wrote:
> For future DSA drivers it makes sense to add a generic DSA yaml binding which
> can be used then. This was created using the properties from dsa.txt. It
> includes the ports and the dsa,member property.
> 
> Suggested-by: Florian Fainelli <f.fainelli@gmail.com>
> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
> ---
>  .../devicetree/bindings/net/dsa/dsa.yaml      | 80 +++++++++++++++++++
>  1 file changed, 80 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/net/dsa/dsa.yaml
> 
> diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.yaml b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> new file mode 100644
> index 000000000000..bec257231bf8
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> @@ -0,0 +1,80 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/net/dsa/dsa.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Distributed Switch Architecture Device Tree Bindings

DSA is a Linuxism, right?

> +
> +maintainers:
> +  - Andrew Lunn <andrew@lunn.ch>
> +  - Florian Fainelli <f.fainelli@gmail.com>
> +  - Vivien Didelot <vivien.didelot@gmail.com>
> +
> +description:
> +  Switches are true Linux devices and can be probed by any means. Once probed,

Bindings are OS independent.

> +  they register to the DSA framework, passing a node pointer. This node is
> +  expected to fulfil the following binding, and may contain additional
> +  properties as required by the device it is embedded within.

Describe what type of h/w should use this binding.

> +
> +properties:
> +  $nodename:
> +    pattern: "^switch(@.*)?$"
> +
> +  dsa,member:
> +    minItems: 2
> +    maxItems: 2
> +    description:
> +      A two element list indicates which DSA cluster, and position within the
> +      cluster a switch takes. <0 0> is cluster 0, switch 0. <0 1> is cluster 0,
> +      switch 1. <1 0> is cluster 1, switch 0. A switch not part of any cluster
> +      (single device hanging off a CPU port) must not specify this property
> +    $ref: /schemas/types.yaml#/definitions/uint32-array
> +
> +  ports:
> +    type: object
> +    properties:
> +      '#address-cells':
> +        const: 1
> +      '#size-cells':
> +        const: 0
> +
> +    patternProperties:
> +      "^port@[0-9]+$":

As ports and port are OF graph nodes, it would be better if we 
standardized on a different name for these. I think we've used 
'ethernet-port' some.

> +          type: object
> +          description: DSA switch ports
> +
> +          allOf:
> +            - $ref: ../ethernet-controller.yaml#

How does this and 'ethernet' both apply?

> +
> +          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
> +
> +          required:
> +            - reg
> +
> +required:
> +  - ports
> +
> +...
> -- 
> 2.20.1
> 

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

* Re: [PATCH v1 1/1] dt-bindings: net: dsa: Add DSA yaml binding
  2020-07-10 16:45   ` Rob Herring
@ 2020-07-10 17:20     ` Florian Fainelli
  2020-07-10 19:38       ` Rob Herring
  2020-07-10 17:39     ` Andrew Lunn
  1 sibling, 1 reply; 15+ messages in thread
From: Florian Fainelli @ 2020-07-10 17:20 UTC (permalink / raw)
  To: Rob Herring, Kurt Kanzenbach
  Cc: Andrew Lunn, Vivien Didelot, David S. Miller, Jakub Kicinski,
	netdev, devicetree



On 7/10/2020 9:45 AM, Rob Herring wrote:
> On Fri, Jul 10, 2020 at 11:06:18AM +0200, Kurt Kanzenbach wrote:
>> For future DSA drivers it makes sense to add a generic DSA yaml binding which
>> can be used then. This was created using the properties from dsa.txt. It
>> includes the ports and the dsa,member property.
>>
>> Suggested-by: Florian Fainelli <f.fainelli@gmail.com>
>> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
>> ---
>>  .../devicetree/bindings/net/dsa/dsa.yaml      | 80 +++++++++++++++++++
>>  1 file changed, 80 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/net/dsa/dsa.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.yaml b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
>> new file mode 100644
>> index 000000000000..bec257231bf8
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
>> @@ -0,0 +1,80 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/net/dsa/dsa.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Distributed Switch Architecture Device Tree Bindings
> 
> DSA is a Linuxism, right?

Not really, it is a Marvell term that describes their proprietary
switching protocol. Since then DSA within Linux expands well beyond just
Marvell switches, so the terms have been blurred a little bit.

> 
>> +
>> +maintainers:
>> +  - Andrew Lunn <andrew@lunn.ch>
>> +  - Florian Fainelli <f.fainelli@gmail.com>
>> +  - Vivien Didelot <vivien.didelot@gmail.com>
>> +
>> +description:
>> +  Switches are true Linux devices and can be probed by any means. Once probed,
> 
> Bindings are OS independent.
> 
>> +  they register to the DSA framework, passing a node pointer. This node is
>> +  expected to fulfil the following binding, and may contain additional
>> +  properties as required by the device it is embedded within.
> 
> Describe what type of h/w should use this binding.
> 
>> +
>> +properties:
>> +  $nodename:
>> +    pattern: "^switch(@.*)?$"
>> +
>> +  dsa,member:
>> +    minItems: 2
>> +    maxItems: 2
>> +    description:
>> +      A two element list indicates which DSA cluster, and position within the
>> +      cluster a switch takes. <0 0> is cluster 0, switch 0. <0 1> is cluster 0,
>> +      switch 1. <1 0> is cluster 1, switch 0. A switch not part of any cluster
>> +      (single device hanging off a CPU port) must not specify this property
>> +    $ref: /schemas/types.yaml#/definitions/uint32-array
>> +
>> +  ports:
>> +    type: object
>> +    properties:
>> +      '#address-cells':
>> +        const: 1
>> +      '#size-cells':
>> +        const: 0
>> +
>> +    patternProperties:
>> +      "^port@[0-9]+$":
> 
> As ports and port are OF graph nodes, it would be better if we 
> standardized on a different name for these. I think we've used 
> 'ethernet-port' some.

Yes we did talk about that before, however when the original DSA binding
was introduced about 7 years ago (or maybe more recently, my memory
fails me now), "ports" was chosen as the encapsulating node. We should
be accepting both ethernet-ports and ports.

> 
>> +          type: object
>> +          description: DSA switch ports
>> +
>> +          allOf:
>> +            - $ref: ../ethernet-controller.yaml#
> 
> How does this and 'ethernet' both apply?

I think the intent here was to mean that some of the properties from the
Ethernet controller such as phy-mode, phy-handle, fixed-link also apply
here since the switch port is a simplified Ethernet MAC on a number of
counts.
-- 
Florian

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

* Re: [PATCH v1 1/1] dt-bindings: net: dsa: Add DSA yaml binding
  2020-07-10 16:45   ` Rob Herring
  2020-07-10 17:20     ` Florian Fainelli
@ 2020-07-10 17:39     ` Andrew Lunn
  1 sibling, 0 replies; 15+ messages in thread
From: Andrew Lunn @ 2020-07-10 17:39 UTC (permalink / raw)
  To: Rob Herring
  Cc: Kurt Kanzenbach, Vivien Didelot, Florian Fainelli,
	David S. Miller, Jakub Kicinski, netdev, devicetree

On Fri, Jul 10, 2020 at 10:45:00AM -0600, Rob Herring wrote:
> On Fri, Jul 10, 2020 at 11:06:18AM +0200, Kurt Kanzenbach wrote:
> > For future DSA drivers it makes sense to add a generic DSA yaml binding which
> > can be used then. This was created using the properties from dsa.txt. It
> > includes the ports and the dsa,member property.
> > 
> > Suggested-by: Florian Fainelli <f.fainelli@gmail.com>
> > Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
> > ---
> >  .../devicetree/bindings/net/dsa/dsa.yaml      | 80 +++++++++++++++++++
> >  1 file changed, 80 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/net/dsa/dsa.yaml
> > 
> > diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.yaml b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> > new file mode 100644
> > index 000000000000..bec257231bf8
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> > @@ -0,0 +1,80 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/net/dsa/dsa.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Distributed Switch Architecture Device Tree Bindings
> 
> DSA is a Linuxism, right?

Hi Rob

Marvell'ism actually. They came up the idea for how you can
interconnect multiple switches to form a distributed switch fabric. So
far, the Marvell driver is the only driver that makes use of D in
DSA. But it seems like some other vendors have similar concepts. And
those which don't allow D in DSA can use a simplified version of the
architecture for a single switch.

> Describe what type of h/w should use this binding.
> 
> > +
> > +properties:
> > +  $nodename:
> > +    pattern: "^switch(@.*)?$"
> > +
> > +  dsa,member:
> > +    minItems: 2
> > +    maxItems: 2
> > +    description:
> > +      A two element list indicates which DSA cluster, and position within the
> > +      cluster a switch takes. <0 0> is cluster 0, switch 0. <0 1> is cluster 0,
> > +      switch 1. <1 0> is cluster 1, switch 0. A switch not part of any cluster
> > +      (single device hanging off a CPU port) must not specify this property
> > +    $ref: /schemas/types.yaml#/definitions/uint32-array
> > +
> > +  ports:
> > +    type: object
> > +    properties:
> > +      '#address-cells':
> > +        const: 1
> > +      '#size-cells':
> > +        const: 0
> > +
> > +    patternProperties:
> > +      "^port@[0-9]+$":
> 
> As ports and port are OF graph nodes, it would be better if we 
> standardized on a different name for these. I think we've used 
> 'ethernet-port' some.

I suspect DSA was using port before OF graph came along. Yep:

commit 5e95329b701c4edf6c4d72487ec0369fa148c0bd
Author: Florian Fainelli <florian@openwrt.org>
Date:   Fri Mar 22 10:50:50 2013 +0000

    dsa: add device tree bindings to register DSA switches

commit 4d56ed5a009b7d31ecae1dd26c047b8bb0dd9287
Author: Philipp Zabel <p.zabel@pengutronix.de>
Date:   Tue Feb 25 15:44:49 2014 +0100

    Documentation: of: Document graph bindings

So this usage is will established and it is probably a bit late to
change it now.

   Andrew

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

* Re: [PATCH v1 1/1] dt-bindings: net: dsa: Add DSA yaml binding
  2020-07-10 17:20     ` Florian Fainelli
@ 2020-07-10 19:38       ` Rob Herring
  2020-07-11 11:59         ` Kurt Kanzenbach
  0 siblings, 1 reply; 15+ messages in thread
From: Rob Herring @ 2020-07-10 19:38 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Kurt Kanzenbach, Andrew Lunn, Vivien Didelot, David S. Miller,
	Jakub Kicinski, netdev, devicetree

On Fri, Jul 10, 2020 at 11:20 AM Florian Fainelli <f.fainelli@gmail.com> wrote:
>
>
>
> On 7/10/2020 9:45 AM, Rob Herring wrote:
> > On Fri, Jul 10, 2020 at 11:06:18AM +0200, Kurt Kanzenbach wrote:
> >> For future DSA drivers it makes sense to add a generic DSA yaml binding which
> >> can be used then. This was created using the properties from dsa.txt. It
> >> includes the ports and the dsa,member property.
> >>
> >> Suggested-by: Florian Fainelli <f.fainelli@gmail.com>
> >> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
> >> ---
> >>  .../devicetree/bindings/net/dsa/dsa.yaml      | 80 +++++++++++++++++++
> >>  1 file changed, 80 insertions(+)
> >>  create mode 100644 Documentation/devicetree/bindings/net/dsa/dsa.yaml
> >>
> >> diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.yaml b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> >> new file mode 100644
> >> index 000000000000..bec257231bf8
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> >> @@ -0,0 +1,80 @@
> >> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> >> +%YAML 1.2
> >> +---
> >> +$id: http://devicetree.org/schemas/net/dsa/dsa.yaml#
> >> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> >> +
> >> +title: Distributed Switch Architecture Device Tree Bindings
> >
> > DSA is a Linuxism, right?
>
> Not really, it is a Marvell term that describes their proprietary
> switching protocol. Since then DSA within Linux expands well beyond just
> Marvell switches, so the terms have been blurred a little bit.

Either way, sounds like the terminology here should be more general.

Though I missed that this is really just a conversion of dsa.txt which
should be removed in this patch. Otherwise, you'll get me re-reviewing
the binding.

> >> +
> >> +maintainers:
> >> +  - Andrew Lunn <andrew@lunn.ch>
> >> +  - Florian Fainelli <f.fainelli@gmail.com>
> >> +  - Vivien Didelot <vivien.didelot@gmail.com>
> >> +
> >> +description:
> >> +  Switches are true Linux devices and can be probed by any means. Once probed,
> >
> > Bindings are OS independent.
> >
> >> +  they register to the DSA framework, passing a node pointer. This node is
> >> +  expected to fulfil the following binding, and may contain additional
> >> +  properties as required by the device it is embedded within.
> >
> > Describe what type of h/w should use this binding.
> >
> >> +
> >> +properties:
> >> +  $nodename:
> >> +    pattern: "^switch(@.*)?$"
> >> +
> >> +  dsa,member:
> >> +    minItems: 2
> >> +    maxItems: 2
> >> +    description:
> >> +      A two element list indicates which DSA cluster, and position within the
> >> +      cluster a switch takes. <0 0> is cluster 0, switch 0. <0 1> is cluster 0,
> >> +      switch 1. <1 0> is cluster 1, switch 0. A switch not part of any cluster
> >> +      (single device hanging off a CPU port) must not specify this property
> >> +    $ref: /schemas/types.yaml#/definitions/uint32-array
> >> +
> >> +  ports:
> >> +    type: object
> >> +    properties:
> >> +      '#address-cells':
> >> +        const: 1
> >> +      '#size-cells':
> >> +        const: 0
> >> +
> >> +    patternProperties:
> >> +      "^port@[0-9]+$":
> >
> > As ports and port are OF graph nodes, it would be better if we
> > standardized on a different name for these. I think we've used
> > 'ethernet-port' some.
>
> Yes we did talk about that before, however when the original DSA binding
> was introduced about 7 years ago (or maybe more recently, my memory
> fails me now), "ports" was chosen as the encapsulating node. We should
> be accepting both ethernet-ports and ports.

Yes, I'm aware of the history. Back then it was a free-for-all on node
names. Now we're trying to be more disciplined. Ideally, we pick
something unique to standardize on and fix the dts files to match as
long as the node name is generally a don't care for the OS.

The schema says only port/ports is allowed, so at a minimum
ethernet-port/ethernet-ports needs to be added here.

>
> >
> >> +          type: object
> >> +          description: DSA switch ports
> >> +
> >> +          allOf:
> >> +            - $ref: ../ethernet-controller.yaml#
> >
> > How does this and 'ethernet' both apply?
>
> I think the intent here was to mean that some of the properties from the
> Ethernet controller such as phy-mode, phy-handle, fixed-link also apply
> here since the switch port is a simplified Ethernet MAC on a number of
> counts.

Okay, it's good to explicitly define which of those apply as I imagine
some don't. Just need "<prop>: true" to do that.

Rob

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

* Re: [PATCH v1 1/1] dt-bindings: net: dsa: Add DSA yaml binding
  2020-07-10 16:39   ` Rob Herring
@ 2020-07-11 11:35     ` Kurt Kanzenbach
  2020-07-11 16:52       ` Andrew Lunn
  0 siblings, 1 reply; 15+ messages in thread
From: Kurt Kanzenbach @ 2020-07-11 11:35 UTC (permalink / raw)
  To: Rob Herring
  Cc: Andrew Lunn, Florian Fainelli, David S. Miller, netdev,
	devicetree, Vivien Didelot, Jakub Kicinski, Rob Herring

[-- Attachment #1: Type: text/plain, Size: 1088 bytes --]

On Fri Jul 10 2020, Rob Herring wrote:
> On Fri, 10 Jul 2020 11:06:18 +0200, Kurt Kanzenbach wrote:
>> For future DSA drivers it makes sense to add a generic DSA yaml binding which
>> can be used then. This was created using the properties from dsa.txt. It
>> includes the ports and the dsa,member property.
>> 
>> Suggested-by: Florian Fainelli <f.fainelli@gmail.com>
>> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
>> ---
>>  .../devicetree/bindings/net/dsa/dsa.yaml      | 80 +++++++++++++++++++
>>  1 file changed, 80 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/net/dsa/dsa.yaml
>> 
>
>
> My bot found errors running 'make dt_binding_check' on your patch:
>
> /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/net/ti,cpsw-switch.example.dt.yaml: switch@0: 'ports' is a required property
> /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.example.dt.yaml: switch@10: 'ports' is a required property

Okay, the requirement for 'ports' has be to removed.

Thanks,
Kurt

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: [PATCH v1 1/1] dt-bindings: net: dsa: Add DSA yaml binding
  2020-07-10 19:38       ` Rob Herring
@ 2020-07-11 11:59         ` Kurt Kanzenbach
  2020-07-11 16:42           ` Andrew Lunn
  2020-07-13 20:41           ` Rob Herring
  0 siblings, 2 replies; 15+ messages in thread
From: Kurt Kanzenbach @ 2020-07-11 11:59 UTC (permalink / raw)
  To: Rob Herring, Florian Fainelli
  Cc: Andrew Lunn, Vivien Didelot, David S. Miller, Jakub Kicinski,
	netdev, devicetree

[-- Attachment #1: Type: text/plain, Size: 5642 bytes --]

Hi,

On Fri Jul 10 2020, Rob Herring wrote:
> On Fri, Jul 10, 2020 at 11:20 AM Florian Fainelli <f.fainelli@gmail.com> wrote:
>>
>>
>>
>> On 7/10/2020 9:45 AM, Rob Herring wrote:
>> > On Fri, Jul 10, 2020 at 11:06:18AM +0200, Kurt Kanzenbach wrote:
>> >> For future DSA drivers it makes sense to add a generic DSA yaml binding which
>> >> can be used then. This was created using the properties from dsa.txt. It
>> >> includes the ports and the dsa,member property.
>> >>
>> >> Suggested-by: Florian Fainelli <f.fainelli@gmail.com>
>> >> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
>> >> ---
>> >>  .../devicetree/bindings/net/dsa/dsa.yaml      | 80 +++++++++++++++++++
>> >>  1 file changed, 80 insertions(+)
>> >>  create mode 100644 Documentation/devicetree/bindings/net/dsa/dsa.yaml
>> >>
>> >> diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.yaml b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
>> >> new file mode 100644
>> >> index 000000000000..bec257231bf8
>> >> --- /dev/null
>> >> +++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
>> >> @@ -0,0 +1,80 @@
>> >> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> >> +%YAML 1.2
>> >> +---
>> >> +$id: http://devicetree.org/schemas/net/dsa/dsa.yaml#
>> >> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> >> +
>> >> +title: Distributed Switch Architecture Device Tree Bindings
>> >
>> > DSA is a Linuxism, right?
>>
>> Not really, it is a Marvell term that describes their proprietary
>> switching protocol. Since then DSA within Linux expands well beyond just
>> Marvell switches, so the terms have been blurred a little bit.
>
> Either way, sounds like the terminology here should be more general.

How?

>
> Though I missed that this is really just a conversion of dsa.txt which
> should be removed in this patch. Otherwise, you'll get me re-reviewing
> the binding.

Yes, it's a conversion of the dsa.txt. I should have stated that more
clearly. I didn't remove the .txt file, because it's referenced in all
the different switch bindings such as b53.txt, ksz.txt and so on. How to
handle that?

>
>> >> +
>> >> +maintainers:
>> >> +  - Andrew Lunn <andrew@lunn.ch>
>> >> +  - Florian Fainelli <f.fainelli@gmail.com>
>> >> +  - Vivien Didelot <vivien.didelot@gmail.com>
>> >> +
>> >> +description:
>> >> +  Switches are true Linux devices and can be probed by any means. Once probed,
>> >
>> > Bindings are OS independent.

OK.

>> >
>> >> +  they register to the DSA framework, passing a node pointer. This node is
>> >> +  expected to fulfil the following binding, and may contain additional
>> >> +  properties as required by the device it is embedded within.
>> >
>> > Describe what type of h/w should use this binding.

I took the description from the dsa.txt. However, it makes sense to
adjust that description. Basically all Ethernet switches with a
dedicated CPU port should use DSA and this binding.

>> >
>> >> +
>> >> +properties:
>> >> +  $nodename:
>> >> +    pattern: "^switch(@.*)?$"
>> >> +
>> >> +  dsa,member:
>> >> +    minItems: 2
>> >> +    maxItems: 2
>> >> +    description:
>> >> +      A two element list indicates which DSA cluster, and position within the
>> >> +      cluster a switch takes. <0 0> is cluster 0, switch 0. <0 1> is cluster 0,
>> >> +      switch 1. <1 0> is cluster 1, switch 0. A switch not part of any cluster
>> >> +      (single device hanging off a CPU port) must not specify this property
>> >> +    $ref: /schemas/types.yaml#/definitions/uint32-array
>> >> +
>> >> +  ports:
>> >> +    type: object
>> >> +    properties:
>> >> +      '#address-cells':
>> >> +        const: 1
>> >> +      '#size-cells':
>> >> +        const: 0
>> >> +
>> >> +    patternProperties:
>> >> +      "^port@[0-9]+$":
>> >
>> > As ports and port are OF graph nodes, it would be better if we
>> > standardized on a different name for these. I think we've used
>> > 'ethernet-port' some.
>>
>> Yes we did talk about that before, however when the original DSA binding
>> was introduced about 7 years ago (or maybe more recently, my memory
>> fails me now), "ports" was chosen as the encapsulating node. We should
>> be accepting both ethernet-ports and ports.
>
> Yes, I'm aware of the history. Back then it was a free-for-all on node
> names. Now we're trying to be more disciplined. Ideally, we pick
> something unique to standardize on and fix the dts files to match as
> long as the node name is generally a don't care for the OS.
>
> The schema says only port/ports is allowed,

Yes, it does.

> so at a minimum
> ethernet-port/ethernet-ports needs to be added here.

Just to be sure. Instead of

  ports {
    port@1 {
      ...
    }
  }

The following should be possible as well?

  ethernet-ports {
    port@1 {
      ...
    }
  }

Is there an easy way to add that alternative to the schema? Or does the
ethernet-ports property has to be defined as well?

>
>>
>> >
>> >> +          type: object
>> >> +          description: DSA switch ports
>> >> +
>> >> +          allOf:
>> >> +            - $ref: ../ethernet-controller.yaml#
>> >
>> > How does this and 'ethernet' both apply?
>>
>> I think the intent here was to mean that some of the properties from the
>> Ethernet controller such as phy-mode, phy-handle, fixed-link also apply
>> here since the switch port is a simplified Ethernet MAC on a number of
>> counts.
>
> Okay, it's good to explicitly define which of those apply as I imagine
> some don't. Just need "<prop>: true" to do that.

Yes, that was my intent. Only a few properties from the Ethernet
controller are needed. I'll add them like you suggested.

>
> Rob

Thanks,
Kurt

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: [PATCH v1 1/1] dt-bindings: net: dsa: Add DSA yaml binding
  2020-07-11 11:59         ` Kurt Kanzenbach
@ 2020-07-11 16:42           ` Andrew Lunn
  2020-07-13 20:41           ` Rob Herring
  1 sibling, 0 replies; 15+ messages in thread
From: Andrew Lunn @ 2020-07-11 16:42 UTC (permalink / raw)
  To: Kurt Kanzenbach
  Cc: Rob Herring, Florian Fainelli, Vivien Didelot, David S. Miller,
	Jakub Kicinski, netdev, devicetree

> > Though I missed that this is really just a conversion of dsa.txt which
> > should be removed in this patch. Otherwise, you'll get me re-reviewing
> > the binding.
> 
> Yes, it's a conversion of the dsa.txt. I should have stated that more
> clearly. I didn't remove the .txt file, because it's referenced in all
> the different switch bindings such as b53.txt, ksz.txt and so on. How to
> handle that?

~/linux$ cat Documentation/devicetree/bindings/net/ethernet.txt 
This file has moved to ethernet-controller.yaml.

As an example. Once all the other files which reference it have been
converted, we can come back and remove the .txt file.

   Andrew

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

* Re: [PATCH v1 1/1] dt-bindings: net: dsa: Add DSA yaml binding
  2020-07-11 11:35     ` Kurt Kanzenbach
@ 2020-07-11 16:52       ` Andrew Lunn
  2020-07-12 10:29         ` Kurt Kanzenbach
  2020-07-13 20:56         ` Rob Herring
  0 siblings, 2 replies; 15+ messages in thread
From: Andrew Lunn @ 2020-07-11 16:52 UTC (permalink / raw)
  To: Kurt Kanzenbach
  Cc: Rob Herring, Florian Fainelli, David S. Miller, netdev,
	devicetree, Vivien Didelot, Jakub Kicinski, Rob Herring

On Sat, Jul 11, 2020 at 01:35:12PM +0200, Kurt Kanzenbach wrote:
> On Fri Jul 10 2020, Rob Herring wrote:
> > On Fri, 10 Jul 2020 11:06:18 +0200, Kurt Kanzenbach wrote:
> >> For future DSA drivers it makes sense to add a generic DSA yaml binding which
> >> can be used then. This was created using the properties from dsa.txt. It
> >> includes the ports and the dsa,member property.
> >> 
> >> Suggested-by: Florian Fainelli <f.fainelli@gmail.com>
> >> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
> >> ---
> >>  .../devicetree/bindings/net/dsa/dsa.yaml      | 80 +++++++++++++++++++
> >>  1 file changed, 80 insertions(+)
> >>  create mode 100644 Documentation/devicetree/bindings/net/dsa/dsa.yaml
> >> 
> >
> >
> > My bot found errors running 'make dt_binding_check' on your patch:
> >
> > /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/net/ti,cpsw-switch.example.dt.yaml: switch@0: 'ports' is a required property
> > /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.example.dt.yaml: switch@10: 'ports' is a required property
> 
> Okay, the requirement for 'ports' has be to removed.

Hummm....

ti.cpsw is not a DSA switch. So this binding should not apply to
it. It is a plain switchdev switch.

The qcom,ipq806 is just an MDIO bus master. The DSA binding might
apply, for a specific .dts file, if that dts file has a DSA switch on
the bus. But in general, it should not apply.

So i actually think you need to work out why this binding is being
applied when it should not be.

I suspect it is the keyword 'switch'. switch does not imply it is a
DSA switch. There are other sorts of switches as well.

	Andrew

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

* Re: [PATCH v1 1/1] dt-bindings: net: dsa: Add DSA yaml binding
  2020-07-11 16:52       ` Andrew Lunn
@ 2020-07-12 10:29         ` Kurt Kanzenbach
  2020-07-13 20:56         ` Rob Herring
  1 sibling, 0 replies; 15+ messages in thread
From: Kurt Kanzenbach @ 2020-07-12 10:29 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Rob Herring, Florian Fainelli, David S. Miller, netdev,
	devicetree, Vivien Didelot, Jakub Kicinski, Rob Herring

[-- Attachment #1: Type: text/plain, Size: 1781 bytes --]

On Sat Jul 11 2020, Andrew Lunn wrote:
> On Sat, Jul 11, 2020 at 01:35:12PM +0200, Kurt Kanzenbach wrote:
>> On Fri Jul 10 2020, Rob Herring wrote:
>> > My bot found errors running 'make dt_binding_check' on your patch:
>> >
>> > /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/net/ti,cpsw-switch.example.dt.yaml: switch@0: 'ports' is a required property
>> > /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.example.dt.yaml: switch@10: 'ports' is a required property
>> 
>> Okay, the requirement for 'ports' has be to removed.
>
> Hummm....
>
> ti.cpsw is not a DSA switch. So this binding should not apply to
> it. It is a plain switchdev switch.
>
> The qcom,ipq806 is just an MDIO bus master. The DSA binding might
> apply, for a specific .dts file, if that dts file has a DSA switch on
> the bus. But in general, it should not apply.
>
> So i actually think you need to work out why this binding is being
> applied when it should not be.
>
> I suspect it is the keyword 'switch'. switch does not imply it is a
> DSA switch. There are other sorts of switches as well.

OK, makes sense. It seems like the nodename is responsible for that.

This fixes the problem:

|diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.yaml b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
|index bec257231bf8..4c360f8b170e 100644
|--- a/Documentation/devicetree/bindings/net/dsa/dsa.yaml
|+++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
|@@ -18,9 +18,6 @@ description:
|   properties as required by the device it is embedded within.
| 
| properties:
|-  $nodename:
|-    pattern: "^switch(@.*)?$"
|-
|   dsa,member:
|     minItems: 2
|     maxItems: 2

Thanks,
Kurt

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: [PATCH v1 1/1] dt-bindings: net: dsa: Add DSA yaml binding
  2020-07-11 11:59         ` Kurt Kanzenbach
  2020-07-11 16:42           ` Andrew Lunn
@ 2020-07-13 20:41           ` Rob Herring
  2020-07-14  6:18             ` Kurt Kanzenbach
  1 sibling, 1 reply; 15+ messages in thread
From: Rob Herring @ 2020-07-13 20:41 UTC (permalink / raw)
  To: Kurt Kanzenbach
  Cc: Florian Fainelli, Andrew Lunn, Vivien Didelot, David S. Miller,
	Jakub Kicinski, netdev, devicetree

On Sat, Jul 11, 2020 at 5:59 AM Kurt Kanzenbach <kurt@linutronix.de> wrote:
>
> Hi,
>
> On Fri Jul 10 2020, Rob Herring wrote:
> > On Fri, Jul 10, 2020 at 11:20 AM Florian Fainelli <f.fainelli@gmail.com> wrote:
> >>
> >>
> >>
> >> On 7/10/2020 9:45 AM, Rob Herring wrote:
> >> > On Fri, Jul 10, 2020 at 11:06:18AM +0200, Kurt Kanzenbach wrote:
> >> >> For future DSA drivers it makes sense to add a generic DSA yaml binding which
> >> >> can be used then. This was created using the properties from dsa.txt. It
> >> >> includes the ports and the dsa,member property.
> >> >>
> >> >> Suggested-by: Florian Fainelli <f.fainelli@gmail.com>
> >> >> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
> >> >> ---
> >> >>  .../devicetree/bindings/net/dsa/dsa.yaml      | 80 +++++++++++++++++++
> >> >>  1 file changed, 80 insertions(+)
> >> >>  create mode 100644 Documentation/devicetree/bindings/net/dsa/dsa.yaml
> >> >>
> >> >> diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.yaml b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> >> >> new file mode 100644
> >> >> index 000000000000..bec257231bf8
> >> >> --- /dev/null
> >> >> +++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> >> >> @@ -0,0 +1,80 @@
> >> >> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> >> >> +%YAML 1.2
> >> >> +---
> >> >> +$id: http://devicetree.org/schemas/net/dsa/dsa.yaml#
> >> >> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> >> >> +
> >> >> +title: Distributed Switch Architecture Device Tree Bindings
> >> >
> >> > DSA is a Linuxism, right?
> >>
> >> Not really, it is a Marvell term that describes their proprietary
> >> switching protocol. Since then DSA within Linux expands well beyond just
> >> Marvell switches, so the terms have been blurred a little bit.
> >
> > Either way, sounds like the terminology here should be more general.
>
> How?

I don't know, just call it 'ethernet switch' binding or something.
>
> >
> > Though I missed that this is really just a conversion of dsa.txt which
> > should be removed in this patch. Otherwise, you'll get me re-reviewing
> > the binding.
>
> Yes, it's a conversion of the dsa.txt. I should have stated that more
> clearly. I didn't remove the .txt file, because it's referenced in all
> the different switch bindings such as b53.txt, ksz.txt and so on. How to
> handle that?

Either update them if not many, or make dsa.txt just point to dsa.yaml
as Andrew mentioned. I haven't looked, but seems like this would be a
small number.

Updating all the users to schema is also welcome. :)

> >> >> +
> >> >> +maintainers:
> >> >> +  - Andrew Lunn <andrew@lunn.ch>
> >> >> +  - Florian Fainelli <f.fainelli@gmail.com>
> >> >> +  - Vivien Didelot <vivien.didelot@gmail.com>
> >> >> +
> >> >> +description:
> >> >> +  Switches are true Linux devices and can be probed by any means. Once probed,
> >> >
> >> > Bindings are OS independent.
>
> OK.
>
> >> >
> >> >> +  they register to the DSA framework, passing a node pointer. This node is
> >> >> +  expected to fulfil the following binding, and may contain additional
> >> >> +  properties as required by the device it is embedded within.
> >> >
> >> > Describe what type of h/w should use this binding.
>
> I took the description from the dsa.txt. However, it makes sense to
> adjust that description. Basically all Ethernet switches with a
> dedicated CPU port should use DSA and this binding.
>
> >> >
> >> >> +
> >> >> +properties:
> >> >> +  $nodename:
> >> >> +    pattern: "^switch(@.*)?$"
> >> >> +
> >> >> +  dsa,member:
> >> >> +    minItems: 2
> >> >> +    maxItems: 2
> >> >> +    description:
> >> >> +      A two element list indicates which DSA cluster, and position within the
> >> >> +      cluster a switch takes. <0 0> is cluster 0, switch 0. <0 1> is cluster 0,
> >> >> +      switch 1. <1 0> is cluster 1, switch 0. A switch not part of any cluster
> >> >> +      (single device hanging off a CPU port) must not specify this property
> >> >> +    $ref: /schemas/types.yaml#/definitions/uint32-array
> >> >> +
> >> >> +  ports:
> >> >> +    type: object
> >> >> +    properties:
> >> >> +      '#address-cells':
> >> >> +        const: 1
> >> >> +      '#size-cells':
> >> >> +        const: 0
> >> >> +
> >> >> +    patternProperties:
> >> >> +      "^port@[0-9]+$":
> >> >
> >> > As ports and port are OF graph nodes, it would be better if we
> >> > standardized on a different name for these. I think we've used
> >> > 'ethernet-port' some.
> >>
> >> Yes we did talk about that before, however when the original DSA binding
> >> was introduced about 7 years ago (or maybe more recently, my memory
> >> fails me now), "ports" was chosen as the encapsulating node. We should
> >> be accepting both ethernet-ports and ports.
> >
> > Yes, I'm aware of the history. Back then it was a free-for-all on node
> > names. Now we're trying to be more disciplined. Ideally, we pick
> > something unique to standardize on and fix the dts files to match as
> > long as the node name is generally a don't care for the OS.
> >
> > The schema says only port/ports is allowed,
>
> Yes, it does.
>
> > so at a minimum
> > ethernet-port/ethernet-ports needs to be added here.
>
> Just to be sure. Instead of
>
>   ports {
>     port@1 {
>       ...
>     }
>   }
>
> The following should be possible as well?
>
>   ethernet-ports {
>     port@1 {

Yes, but probably 'ethernet-port@1' here. Or both can be allowed.

>       ...
>     }
>   }
>
> Is there an easy way to add that alternative to the schema? Or does the
> ethernet-ports property has to be defined as well?

You need a pattern like:

patternProperties:
  "^(ethernet-)?ports$":
    ...

You could also make one property a $ref to another, but I prefer the above.

Rob

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

* Re: [PATCH v1 1/1] dt-bindings: net: dsa: Add DSA yaml binding
  2020-07-11 16:52       ` Andrew Lunn
  2020-07-12 10:29         ` Kurt Kanzenbach
@ 2020-07-13 20:56         ` Rob Herring
  1 sibling, 0 replies; 15+ messages in thread
From: Rob Herring @ 2020-07-13 20:56 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Kurt Kanzenbach, Florian Fainelli, David S. Miller, netdev,
	devicetree, Vivien Didelot, Jakub Kicinski

On Sat, Jul 11, 2020 at 10:52 AM Andrew Lunn <andrew@lunn.ch> wrote:
>
> On Sat, Jul 11, 2020 at 01:35:12PM +0200, Kurt Kanzenbach wrote:
> > On Fri Jul 10 2020, Rob Herring wrote:
> > > On Fri, 10 Jul 2020 11:06:18 +0200, Kurt Kanzenbach wrote:
> > >> For future DSA drivers it makes sense to add a generic DSA yaml binding which
> > >> can be used then. This was created using the properties from dsa.txt. It
> > >> includes the ports and the dsa,member property.
> > >>
> > >> Suggested-by: Florian Fainelli <f.fainelli@gmail.com>
> > >> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
> > >> ---
> > >>  .../devicetree/bindings/net/dsa/dsa.yaml      | 80 +++++++++++++++++++
> > >>  1 file changed, 80 insertions(+)
> > >>  create mode 100644 Documentation/devicetree/bindings/net/dsa/dsa.yaml
> > >>
> > >
> > >
> > > My bot found errors running 'make dt_binding_check' on your patch:
> > >
> > > /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/net/ti,cpsw-switch.example.dt.yaml: switch@0: 'ports' is a required property
> > > /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.example.dt.yaml: switch@10: 'ports' is a required property
> >
> > Okay, the requirement for 'ports' has be to removed.
>
> Hummm....
>
> ti.cpsw is not a DSA switch. So this binding should not apply to
> it. It is a plain switchdev switch.

Well, the binding looks very similar with the same
ethernet-ports/port@X structure. So maybe we need a switch schema that
covers both and then a DSA schema.

> The qcom,ipq806 is just an MDIO bus master. The DSA binding might
> apply, for a specific .dts file, if that dts file has a DSA switch on
> the bus. But in general, it should not apply.
>
> So i actually think you need to work out why this binding is being
> applied when it should not be.
>
> I suspect it is the keyword 'switch'. switch does not imply it is a
> DSA switch. There are other sorts of switches as well.

Yes, by default, we match on compatible or node name if no compatible.
The simple solution here is adding 'select: false' and then dsa.yaml
will only be applied when explicitly referenced by the h/w specific
bindings.

There's also mscc-ocelot which is not yet a schema.

Rob

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

* Re: [PATCH v1 1/1] dt-bindings: net: dsa: Add DSA yaml binding
  2020-07-13 20:41           ` Rob Herring
@ 2020-07-14  6:18             ` Kurt Kanzenbach
  0 siblings, 0 replies; 15+ messages in thread
From: Kurt Kanzenbach @ 2020-07-14  6:18 UTC (permalink / raw)
  To: Rob Herring
  Cc: Florian Fainelli, Andrew Lunn, Vivien Didelot, David S. Miller,
	Jakub Kicinski, netdev, devicetree

[-- Attachment #1: Type: text/plain, Size: 1647 bytes --]

Hi Rob,

On Mon Jul 13 2020, Rob Herring wrote:
> On Sat, Jul 11, 2020 at 5:59 AM Kurt Kanzenbach <kurt@linutronix.de> wrote:
>> How?
>
> I don't know, just call it 'ethernet switch' binding or something.

OK.

>> Yes, it's a conversion of the dsa.txt. I should have stated that more
>> clearly. I didn't remove the .txt file, because it's referenced in all
>> the different switch bindings such as b53.txt, ksz.txt and so on. How to
>> handle that?
>
> Either update them if not many, or make dsa.txt just point to dsa.yaml
> as Andrew mentioned. I haven't looked, but seems like this would be a
> small number.

OK.

>
> Updating all the users to schema is also welcome. :)
>
>> Just to be sure. Instead of
>>
>>   ports {
>>     port@1 {
>>       ...
>>     }
>>   }
>>
>> The following should be possible as well?
>>
>>   ethernet-ports {
>>     port@1 {
>
> Yes, but probably 'ethernet-port@1' here. Or both can be allowed.

I think both should be allowed. No binding is using
ethernet-port. They're all using ethernet-ports and port within
(example: ti,cpsw-switch.yaml).

But, if the binding does allow for ethernet-ports, then the DSA core has
to be adjusted, or? The current code searches only for "ports" (in
dsa_switch_parse_ports_of()).

>
>>       ...
>>     }
>>   }
>>
>> Is there an easy way to add that alternative to the schema? Or does the
>> ethernet-ports property has to be defined as well?
>
> You need a pattern like:
>
> patternProperties:
>   "^(ethernet-)?ports$":
>     ...

I see. Thanks!

>
> You could also make one property a $ref to another, but I prefer the
> above.

That's what I wanted to avoid.

Thanks,
Kurt

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

end of thread, other threads:[~2020-07-14  6:19 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-10  9:06 [PATCH v1 0/1] dt-bindings: net: dsa: Add DSA yaml binding Kurt Kanzenbach
2020-07-10  9:06 ` [PATCH v1 1/1] " Kurt Kanzenbach
2020-07-10 16:39   ` Rob Herring
2020-07-11 11:35     ` Kurt Kanzenbach
2020-07-11 16:52       ` Andrew Lunn
2020-07-12 10:29         ` Kurt Kanzenbach
2020-07-13 20:56         ` Rob Herring
2020-07-10 16:45   ` Rob Herring
2020-07-10 17:20     ` Florian Fainelli
2020-07-10 19:38       ` Rob Herring
2020-07-11 11:59         ` Kurt Kanzenbach
2020-07-11 16:42           ` Andrew Lunn
2020-07-13 20:41           ` Rob Herring
2020-07-14  6:18             ` Kurt Kanzenbach
2020-07-10 17:39     ` Andrew Lunn

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.