mbox series

[v3,net-next,00/10] dt-binding preparation for ocelot switches

Message ID 20221127224734.885526-1-colin.foster@in-advantage.com
Headers show
Series dt-binding preparation for ocelot switches | expand

Message

Colin Foster Nov. 27, 2022, 10:47 p.m. UTC
Ocelot switches have the abilitiy to be used internally via
memory-mapped IO or externally via SPI or PCIe. This brings up issues
for documentation, where the same chip might be accessed internally in a
switchdev manner, or externally in a DSA configuration. This patch set
is perparation to bring DSA functionality to the VSC7512, utilizing as
much as possible with an almost identical VSC7514 chip.

This patch set changed quite a bit from v2, so I'll omit the background
of how those sets came to be. Rob offered a lot of very useful guidance.
My thanks.

At the end of the day, with this patch set, there should be a framework
to document Ocelot switches (and any switch) in scenarios where they can
be controlled internally (ethernet-switch) or externally (dsa-switch).

---

v2 -> v3
  * Restructured everything to use a "base" iref for devices that don't
    have additional properties, and simply a "ref" for devices that do.
  * New patches to fix up brcm,sf2, qca8k, and mt7530
  * Fix unevaluatedProperties errors from previous sets (see specific
    patches for more detail)
  * Removed redundant "Device Tree Binding" from titles, where applicable.

v1 -> v2
  * Two MFD patches were brought into the MFD tree, so are dropped
  * Add first patch 1/6 to allow DSA devices to add ports and port
    properties
  * Test qca8k against new dt-bindings and fix warnings. (patch 2/6)
  * Add tags (patch 3/6)
  * Fix vsc7514 refs and properties

---

Colin Foster (10):
  dt-bindings: net: dsa: sf2: fix brcm,use-bcm-hdr documentation
  dt-bindings: net: dsa: qca8k: remove address-cells and size-cells from
    switch node
  dt-bindings: net: dsa: utilize base definitions for standard dsa
    switches
  dt-bindings: net: dsa: allow additional ethernet-port properties
  dt-bindings: net: dsa: qca8k: utilize shared dsa.yaml
  dt-bindings: net: dsa: mediatek,mt7530: fix port description location
  dt-bindings: net: dsa: mediatek,mt7530: remove unnecessary dsa-port
    reference
  dt-bindings: net: add generic ethernet-switch
  dt-bindings: net: add generic ethernet-switch-port binding
  dt-bindings: net: mscc,vsc7514-switch: utilize generic
    ethernet-switch.yaml

 .../bindings/net/dsa/arrow,xrs700x.yaml       |  2 +-
 .../devicetree/bindings/net/dsa/brcm,b53.yaml |  2 +-
 .../devicetree/bindings/net/dsa/brcm,sf2.yaml | 15 +++--
 .../devicetree/bindings/net/dsa/dsa-port.yaml | 24 +------
 .../devicetree/bindings/net/dsa/dsa.yaml      | 37 +++++------
 .../net/dsa/hirschmann,hellcreek.yaml         |  2 +-
 .../bindings/net/dsa/mediatek,mt7530.yaml     | 17 ++---
 .../bindings/net/dsa/microchip,ksz.yaml       |  2 +-
 .../bindings/net/dsa/microchip,lan937x.yaml   |  2 +-
 .../bindings/net/dsa/mscc,ocelot.yaml         |  2 +-
 .../bindings/net/dsa/nxp,sja1105.yaml         |  2 +-
 .../devicetree/bindings/net/dsa/qca8k.yaml    | 15 +----
 .../devicetree/bindings/net/dsa/realtek.yaml  |  2 +-
 .../bindings/net/dsa/renesas,rzn1-a5psw.yaml  |  2 +-
 .../bindings/net/ethernet-switch-port.yaml    | 25 ++++++++
 .../bindings/net/ethernet-switch.yaml         | 62 +++++++++++++++++++
 .../bindings/net/mscc,vsc7514-switch.yaml     | 31 +---------
 MAINTAINERS                                   |  2 +
 18 files changed, 134 insertions(+), 112 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/ethernet-switch-port.yaml
 create mode 100644 Documentation/devicetree/bindings/net/ethernet-switch.yaml

Comments

Florian Fainelli Nov. 28, 2022, 8:42 p.m. UTC | #1
On 11/27/22 14:47, Colin Foster wrote:
> Explicitly allow additional properties for both the ethernet-port and
> ethernet-ports properties. This specifically will allow the qca8k.yaml
> binding to use shared properties.
> 
> Signed-off-by: Colin Foster <colin.foster@in-advantage.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Florian Fainelli Nov. 28, 2022, 8:43 p.m. UTC | #2
On 11/27/22 14:47, Colin Foster wrote:
> dsa.yaml contains a reference to dsa-port.yaml, so a duplicate reference to
> the binding isn't necessary. Remove this unnecessary reference.
> 
> Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
> Suggested-by: Vladimir Oltean <olteanv@gmail.com>
> Reviewed-by: Arınç ÜNAL <arinc.unal@arinc9.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Florian Fainelli Nov. 28, 2022, 8:47 p.m. UTC | #3
On 11/27/22 14:47, Colin Foster wrote:
> The dsa-port.yaml binding had several references that can be common to all
> ethernet ports, not just dsa-specific ones. Break out the generic bindings
> to ethernet-switch-port.yaml they can be used by non-dsa drivers.
> 
> Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
> Suggested-by: Vladimir Oltean <olteanv@gmail.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Rob Herring (Arm) Dec. 1, 2022, 10:22 p.m. UTC | #4
On Sun, 27 Nov 2022 14:47:25 -0800, Colin Foster wrote:
> The property use-bcm-hdr was documented as an entry under the ports node
> for the bcm_sf2 DSA switch. This property is actually evaluated for each
> port. Correct the documentation to match the actual behavior and properly
> reference dsa-port.yaml for additional properties of the node.
> 
> Suggested-by: Rob Herring <robh@kernel.org>
> Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
> ---
> 
> v3
>   * New patch
> 
> ---
>  .../devicetree/bindings/net/dsa/brcm,sf2.yaml     | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 

Reviewed-by: Rob Herring <robh@kernel.org>
Rob Herring (Arm) Dec. 1, 2022, 10:42 p.m. UTC | #5
On Sun, Nov 27, 2022 at 02:47:29PM -0800, Colin Foster wrote:
> The dsa.yaml binding contains duplicated bindings for address and size
> cells, as well as the reference to dsa-port.yaml. Instead of duplicating
> this information, remove the reference to dsa-port.yaml and include the
> full reference to dsa.yaml.
> 
> Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
> Suggested-by: Vladimir Oltean <olteanv@gmail.com>
> ---
> 
> v2 -> v3
>   * Remove #address-cells and #size-cells from v2. The examples were
>     incorrect and fixed elsewhere.
>   * Remove erroneous unevaluatedProperties: true under Ethernet Port.
>   * Add back ref: dsa-port.yaml#.
> 
> v1 -> v2
>   * Add #address-cells and #size-cells to the switch layer. They aren't
>     part of dsa.yaml.
>   * Add unevaluatedProperties: true to the ethernet-port layer so it can
>     correctly read properties from dsa.yaml.
> 
> ---
>  Documentation/devicetree/bindings/net/dsa/qca8k.yaml | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
> index 6fc9bc985726..93a9ddebcac8 100644
> --- a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
> @@ -66,20 +66,15 @@ properties:
>                   With the legacy mapping the reg corresponding to the internal
>                   mdio is the switch reg with an offset of -1.
>  
> +$ref: "dsa.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
> -
>          $ref: dsa-port.yaml#

So here you need 'unevaluatedProperties: false'.

unevaluatedProperties only applies to the properties defined in a single 
node level, and child nodes properties from 2 schemas can't 'see' each 
other. IOW, what dsa.yaml has in child nodes has no effect on this node. 

>  
>          properties:
> @@ -116,7 +111,7 @@ required:
>    - compatible
>    - reg
>  
> -additionalProperties: true
> +unevaluatedProperties: false

So this has no effect on anything within "^(ethernet-)?port@[0-6]$" and 
below.

Rob
Colin Foster Dec. 2, 2022, 7:31 p.m. UTC | #6
Hi Rob,

On Thu, Dec 01, 2022 at 04:42:40PM -0600, Rob Herring wrote:
> On Sun, Nov 27, 2022 at 02:47:29PM -0800, Colin Foster wrote:
> > The dsa.yaml binding contains duplicated bindings for address and size
> > cells, as well as the reference to dsa-port.yaml. Instead of duplicating
> > this information, remove the reference to dsa-port.yaml and include the
> > full reference to dsa.yaml.
> > 
> > Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
> > Suggested-by: Vladimir Oltean <olteanv@gmail.com>
> > ---
> > 
> > v2 -> v3
> >   * Remove #address-cells and #size-cells from v2. The examples were
> >     incorrect and fixed elsewhere.
> >   * Remove erroneous unevaluatedProperties: true under Ethernet Port.
> >   * Add back ref: dsa-port.yaml#.
> > 
> > v1 -> v2
> >   * Add #address-cells and #size-cells to the switch layer. They aren't
> >     part of dsa.yaml.
> >   * Add unevaluatedProperties: true to the ethernet-port layer so it can
> >     correctly read properties from dsa.yaml.
> > 
> > ---
> >  Documentation/devicetree/bindings/net/dsa/qca8k.yaml | 11 +++--------
> >  1 file changed, 3 insertions(+), 8 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
> > index 6fc9bc985726..93a9ddebcac8 100644
> > --- a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
> > +++ b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
> > @@ -66,20 +66,15 @@ properties:
> >                   With the legacy mapping the reg corresponding to the internal
> >                   mdio is the switch reg with an offset of -1.
> >  
> > +$ref: "dsa.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
> > -
> >          $ref: dsa-port.yaml#
> 
> So here you need 'unevaluatedProperties: false'.
> 
> unevaluatedProperties only applies to the properties defined in a single 
> node level, and child nodes properties from 2 schemas can't 'see' each 
> other. IOW, what dsa.yaml has in child nodes has no effect on this node. 

I'm buttoning up v4 right now and removing this line deletion.
unevaluatedProperties: false exists under the etherent-port node, just
at the end of the properties list.

Since the etherent-ports node in net/dsa/dsa.yaml has
unevaluatedProperties: false, I understand that isn't necessary here.

> 
> >  
> >          properties:
> > @@ -116,7 +111,7 @@ required:
> >    - compatible
> >    - reg
> >  
> > -additionalProperties: true
> > +unevaluatedProperties: false
> 
> So this has no effect on anything within "^(ethernet-)?port@[0-6]$" and 
> below.
> 
> Rob