diff mbox series

[v4,net-next,3/9] dt-bindings: net: dsa: utilize base definitions for standard dsa switches

Message ID 20221202204559.162619-4-colin.foster@in-advantage.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series dt-binding preparation for ocelot switches | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 30 of 30 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 141 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Colin Foster Dec. 2, 2022, 8:45 p.m. UTC
DSA switches can fall into one of two categories: switches where all ports
follow standard '(ethernet-)?port' properties, and switches that have
additional properties for the ports.

The scenario where DSA ports are all standardized can be handled by
swtiches with a reference to the new 'dsa.yaml#/$defs/ethernet-ports'.

The scenario where DSA ports require additional properties can reference
'$dsa.yaml#' directly. This will allow switches to reference these standard
defitions of the DSA switch, but add additional properties under the port
nodes.

Suggested-by: Rob Herring <robh@kernel.org>
Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Alvin Šipraga <alsi@bang-olufsen.dk> # realtek
---

v3 -> v4
  * Rename "$defs/base" to "$defs/ethernet-ports" to avoid implication of a
    "base class" and fix commit message accordingly
  * Add the following to the common etherent-ports node:
      "additionalProperties: false"
      "#address-cells" property
      "#size-cells" property
  * Fix "etherenet-ports@[0-9]+" to correctly be "ethernet-port@[0-9]+"
  * Remove unnecessary newline
  * Apply changes to mediatek,mt7530.yaml that were previously in a separate patch
  * Add Reviewed and Acked tags

v3
  * New patch

---
 .../bindings/net/dsa/arrow,xrs700x.yaml       |  2 +-
 .../devicetree/bindings/net/dsa/brcm,b53.yaml |  2 +-
 .../devicetree/bindings/net/dsa/dsa.yaml      | 25 ++++++++++++++++---
 .../net/dsa/hirschmann,hellcreek.yaml         |  2 +-
 .../bindings/net/dsa/mediatek,mt7530.yaml     | 16 +++---------
 .../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/realtek.yaml  |  2 +-
 .../bindings/net/dsa/renesas,rzn1-a5psw.yaml  |  2 +-
 11 files changed, 35 insertions(+), 24 deletions(-)

Comments

Arınç ÜNAL Dec. 2, 2022, 9:45 p.m. UTC | #1
On 2.12.2022 23:45, Colin Foster wrote:
> DSA switches can fall into one of two categories: switches where all ports
> follow standard '(ethernet-)?port' properties, and switches that have
> additional properties for the ports.
> 
> The scenario where DSA ports are all standardized can be handled by
> swtiches with a reference to the new 'dsa.yaml#/$defs/ethernet-ports'.
> 
> The scenario where DSA ports require additional properties can reference
> '$dsa.yaml#' directly. This will allow switches to reference these standard
> defitions of the DSA switch, but add additional properties under the port
> nodes.
> 
> Suggested-by: Rob Herring <robh@kernel.org>
> Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
> Acked-by: Alvin Šipraga <alsi@bang-olufsen.dk> # realtek
> ---
> 
> v3 -> v4
>    * Rename "$defs/base" to "$defs/ethernet-ports" to avoid implication of a
>      "base class" and fix commit message accordingly
>    * Add the following to the common etherent-ports node:
>        "additionalProperties: false"
>        "#address-cells" property
>        "#size-cells" property
>    * Fix "etherenet-ports@[0-9]+" to correctly be "ethernet-port@[0-9]+"
>    * Remove unnecessary newline
>    * Apply changes to mediatek,mt7530.yaml that were previously in a separate patch
>    * Add Reviewed and Acked tags
> 
> v3
>    * New patch
> 
> ---
>   .../bindings/net/dsa/arrow,xrs700x.yaml       |  2 +-
>   .../devicetree/bindings/net/dsa/brcm,b53.yaml |  2 +-
>   .../devicetree/bindings/net/dsa/dsa.yaml      | 25 ++++++++++++++++---
>   .../net/dsa/hirschmann,hellcreek.yaml         |  2 +-
>   .../bindings/net/dsa/mediatek,mt7530.yaml     | 16 +++---------
>   .../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/realtek.yaml  |  2 +-
>   .../bindings/net/dsa/renesas,rzn1-a5psw.yaml  |  2 +-
>   11 files changed, 35 insertions(+), 24 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml b/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml
> index 259a0c6547f3..5888e3a0169a 100644
> --- a/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml
> @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
>   title: Arrow SpeedChips XRS7000 Series Switch Device Tree Bindings
>   
>   allOf:
> -  - $ref: dsa.yaml#
> +  - $ref: dsa.yaml#/$defs/ethernet-ports
>   
>   maintainers:
>     - George McCollister <george.mccollister@gmail.com>
> diff --git a/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml b/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml
> index 1219b830b1a4..5bef4128d175 100644
> --- a/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml
> @@ -66,7 +66,7 @@ required:
>     - reg
>   
>   allOf:
> -  - $ref: dsa.yaml#
> +  - $ref: dsa.yaml#/$defs/ethernet-ports
>     - if:
>         properties:
>           compatible:
> diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.yaml b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> index b9d48e357e77..b9e366e46aed 100644
> --- a/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> @@ -19,9 +19,6 @@ description:
>   select: false
>   
>   properties:
> -  $nodename:
> -    pattern: "^(ethernet-)?switch(@.*)?$"
> -
>     dsa,member:
>       minItems: 2
>       maxItems: 2
> @@ -58,4 +55,26 @@ oneOf:
>   
>   additionalProperties: true
>   
> +$defs:
> +  ethernet-ports:
> +    description: A DSA switch without any extra port properties
> +    $ref: '#/'
> +
> +    patternProperties:
> +      "^(ethernet-)?ports$":
> +        type: object
> +        additionalProperties: false
> +
> +        properties:
> +          '#address-cells':
> +            const: 1
> +          '#size-cells':
> +            const: 0
> +
> +        patternProperties:
> +          "^(ethernet-)?port@[0-9]+$":
> +            description: Ethernet switch ports
> +            $ref: dsa-port.yaml#
> +            unevaluatedProperties: false
> +
>   ...
> diff --git a/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml b/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml
> index 73b774eadd0b..748ef9983ce2 100644
> --- a/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml
> @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
>   title: Hirschmann Hellcreek TSN Switch Device Tree Bindings
>   
>   allOf:
> -  - $ref: dsa.yaml#
> +  - $ref: dsa.yaml#/$defs/ethernet-ports
>   
>   maintainers:
>     - Andrew Lunn <andrew@lunn.ch>
> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> index f2e9ff3f580b..b815272531fa 100644
> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> @@ -156,17 +156,6 @@ patternProperties:
>   
>       patternProperties:
>         "^(ethernet-)?port@[0-9]+$":
> -        type: object
> -        description: Ethernet switch ports
> -
> -        unevaluatedProperties: false
> -
> -        properties:
> -          reg:
> -            description:
> -              Port address described must be 5 or 6 for CPU port and from 0 to 5
> -              for user ports.

This shouldn't be moved. Please reread our conversation on the previous 
version.

> -
>           allOf:
>             - $ref: dsa-port.yaml#
>             - if:
> @@ -174,6 +163,9 @@ patternProperties:
>               then:
>                 properties:
>                   reg:
> +                  description:
> +                    Port address described must be 5 or 6 for CPU port and from
> +                    0 to 5 for user ports

Arınç
Arınç ÜNAL Dec. 5, 2022, 6:29 p.m. UTC | #2
On 6.12.2022 05:20, Colin Foster wrote:
> On Sat, Dec 03, 2022 at 12:45:34AM +0300, Arınç ÜNAL wrote:
>> On 2.12.2022 23:45, Colin Foster wrote:
>>> DSA switches can fall into one of two categories: switches where all ports
>>> follow standard '(ethernet-)?port' properties, and switches that have
>>> additional properties for the ports.
>>>
>>> The scenario where DSA ports are all standardized can be handled by
>>> swtiches with a reference to the new 'dsa.yaml#/$defs/ethernet-ports'.
>>>
>>> The scenario where DSA ports require additional properties can reference
>>> '$dsa.yaml#' directly. This will allow switches to reference these standard
>>> defitions of the DSA switch, but add additional properties under the port
>>> nodes.
>>>
>>> Suggested-by: Rob Herring <robh@kernel.org>
>>> Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
>>> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
>>> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
>>> Acked-by: Alvin Šipraga <alsi@bang-olufsen.dk> # realtek
>>> ---
>>>
>>> v3 -> v4
>>>     * Rename "$defs/base" to "$defs/ethernet-ports" to avoid implication of a
>>>       "base class" and fix commit message accordingly
>>>     * Add the following to the common etherent-ports node:
>>>         "additionalProperties: false"
>>>         "#address-cells" property
>>>         "#size-cells" property
>>>     * Fix "etherenet-ports@[0-9]+" to correctly be "ethernet-port@[0-9]+"
>>>     * Remove unnecessary newline
>>>     * Apply changes to mediatek,mt7530.yaml that were previously in a separate patch
>>>     * Add Reviewed and Acked tags
>>>
>>> v3
>>>     * New patch
>>>
>>> ---
>>>    .../bindings/net/dsa/arrow,xrs700x.yaml       |  2 +-
>>>    .../devicetree/bindings/net/dsa/brcm,b53.yaml |  2 +-
>>>    .../devicetree/bindings/net/dsa/dsa.yaml      | 25 ++++++++++++++++---
>>>    .../net/dsa/hirschmann,hellcreek.yaml         |  2 +-
>>>    .../bindings/net/dsa/mediatek,mt7530.yaml     | 16 +++---------
>>>    .../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/realtek.yaml  |  2 +-
>>>    .../bindings/net/dsa/renesas,rzn1-a5psw.yaml  |  2 +-
>>>    11 files changed, 35 insertions(+), 24 deletions(-)
>>>
>>> diff --git a/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml b/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml
>>> index 259a0c6547f3..5888e3a0169a 100644
>>> --- a/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml
>>> +++ b/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml
>>> @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
>>>    title: Arrow SpeedChips XRS7000 Series Switch Device Tree Bindings
>>>    allOf:
>>> -  - $ref: dsa.yaml#
>>> +  - $ref: dsa.yaml#/$defs/ethernet-ports
>>>    maintainers:
>>>      - George McCollister <george.mccollister@gmail.com>
>>> diff --git a/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml b/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml
>>> index 1219b830b1a4..5bef4128d175 100644
>>> --- a/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml
>>> +++ b/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml
>>> @@ -66,7 +66,7 @@ required:
>>>      - reg
>>>    allOf:
>>> -  - $ref: dsa.yaml#
>>> +  - $ref: dsa.yaml#/$defs/ethernet-ports
>>>      - if:
>>>          properties:
>>>            compatible:
>>> diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.yaml b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
>>> index b9d48e357e77..b9e366e46aed 100644
>>> --- a/Documentation/devicetree/bindings/net/dsa/dsa.yaml
>>> +++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
>>> @@ -19,9 +19,6 @@ description:
>>>    select: false
>>>    properties:
>>> -  $nodename:
>>> -    pattern: "^(ethernet-)?switch(@.*)?$"
>>> -
>>>      dsa,member:
>>>        minItems: 2
>>>        maxItems: 2
>>> @@ -58,4 +55,26 @@ oneOf:
>>>    additionalProperties: true
>>> +$defs:
>>> +  ethernet-ports:
>>> +    description: A DSA switch without any extra port properties
>>> +    $ref: '#/'
>>> +
>>> +    patternProperties:
>>> +      "^(ethernet-)?ports$":
>>> +        type: object
>>> +        additionalProperties: false
>>> +
>>> +        properties:
>>> +          '#address-cells':
>>> +            const: 1
>>> +          '#size-cells':
>>> +            const: 0
>>> +
>>> +        patternProperties:
>>> +          "^(ethernet-)?port@[0-9]+$":
>>> +            description: Ethernet switch ports
>>> +            $ref: dsa-port.yaml#
>>> +            unevaluatedProperties: false
>>> +
>>>    ...
>>> diff --git a/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml b/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml
>>> index 73b774eadd0b..748ef9983ce2 100644
>>> --- a/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml
>>> +++ b/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml
>>> @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
>>>    title: Hirschmann Hellcreek TSN Switch Device Tree Bindings
>>>    allOf:
>>> -  - $ref: dsa.yaml#
>>> +  - $ref: dsa.yaml#/$defs/ethernet-ports
>>>    maintainers:
>>>      - Andrew Lunn <andrew@lunn.ch>
>>> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>>> index f2e9ff3f580b..b815272531fa 100644
>>> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>>> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>>> @@ -156,17 +156,6 @@ patternProperties:
>>>        patternProperties:
>>>          "^(ethernet-)?port@[0-9]+$":
>>> -        type: object
>>> -        description: Ethernet switch ports
>>> -
>>> -        unevaluatedProperties: false
>>> -
>>> -        properties:
>>> -          reg:
>>> -            description:
>>> -              Port address described must be 5 or 6 for CPU port and from 0 to 5
>>> -              for user ports.
>>
>> This shouldn't be moved. Please reread our conversation on the previous
>> version.
> 
> I see - I missed your point. My apologies. This binding should keep the
> reg properties where they were. I'll wait a few more days for any
> additional feedback.

Feel free to add my acked-by with the next version.

Acked-by: Arınç ÜNAL <arinc.unal@arinc9.com>

Arınç
Rob Herring (Arm) Dec. 5, 2022, 9:42 p.m. UTC | #3
On Fri, 02 Dec 2022 12:45:53 -0800, Colin Foster wrote:
> DSA switches can fall into one of two categories: switches where all ports
> follow standard '(ethernet-)?port' properties, and switches that have
> additional properties for the ports.
> 
> The scenario where DSA ports are all standardized can be handled by
> swtiches with a reference to the new 'dsa.yaml#/$defs/ethernet-ports'.
> 
> The scenario where DSA ports require additional properties can reference
> '$dsa.yaml#' directly. This will allow switches to reference these standard
> defitions of the DSA switch, but add additional properties under the port
> nodes.
> 
> Suggested-by: Rob Herring <robh@kernel.org>
> Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
> Acked-by: Alvin Šipraga <alsi@bang-olufsen.dk> # realtek
> ---
> 
> v3 -> v4
>   * Rename "$defs/base" to "$defs/ethernet-ports" to avoid implication of a
>     "base class" and fix commit message accordingly
>   * Add the following to the common etherent-ports node:
>       "additionalProperties: false"
>       "#address-cells" property
>       "#size-cells" property
>   * Fix "etherenet-ports@[0-9]+" to correctly be "ethernet-port@[0-9]+"
>   * Remove unnecessary newline
>   * Apply changes to mediatek,mt7530.yaml that were previously in a separate patch
>   * Add Reviewed and Acked tags
> 
> v3
>   * New patch
> 
> ---
>  .../bindings/net/dsa/arrow,xrs700x.yaml       |  2 +-
>  .../devicetree/bindings/net/dsa/brcm,b53.yaml |  2 +-
>  .../devicetree/bindings/net/dsa/dsa.yaml      | 25 ++++++++++++++++---
>  .../net/dsa/hirschmann,hellcreek.yaml         |  2 +-
>  .../bindings/net/dsa/mediatek,mt7530.yaml     | 16 +++---------
>  .../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/realtek.yaml  |  2 +-
>  .../bindings/net/dsa/renesas,rzn1-a5psw.yaml  |  2 +-
>  11 files changed, 35 insertions(+), 24 deletions(-)
> 

Reviewed-by: Rob Herring <robh@kernel.org>
Colin Foster Dec. 6, 2022, 2:20 a.m. UTC | #4
On Sat, Dec 03, 2022 at 12:45:34AM +0300, Arınç ÜNAL wrote:
> On 2.12.2022 23:45, Colin Foster wrote:
> > DSA switches can fall into one of two categories: switches where all ports
> > follow standard '(ethernet-)?port' properties, and switches that have
> > additional properties for the ports.
> > 
> > The scenario where DSA ports are all standardized can be handled by
> > swtiches with a reference to the new 'dsa.yaml#/$defs/ethernet-ports'.
> > 
> > The scenario where DSA ports require additional properties can reference
> > '$dsa.yaml#' directly. This will allow switches to reference these standard
> > defitions of the DSA switch, but add additional properties under the port
> > nodes.
> > 
> > Suggested-by: Rob Herring <robh@kernel.org>
> > Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
> > Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> > Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
> > Acked-by: Alvin Šipraga <alsi@bang-olufsen.dk> # realtek
> > ---
> > 
> > v3 -> v4
> >    * Rename "$defs/base" to "$defs/ethernet-ports" to avoid implication of a
> >      "base class" and fix commit message accordingly
> >    * Add the following to the common etherent-ports node:
> >        "additionalProperties: false"
> >        "#address-cells" property
> >        "#size-cells" property
> >    * Fix "etherenet-ports@[0-9]+" to correctly be "ethernet-port@[0-9]+"
> >    * Remove unnecessary newline
> >    * Apply changes to mediatek,mt7530.yaml that were previously in a separate patch
> >    * Add Reviewed and Acked tags
> > 
> > v3
> >    * New patch
> > 
> > ---
> >   .../bindings/net/dsa/arrow,xrs700x.yaml       |  2 +-
> >   .../devicetree/bindings/net/dsa/brcm,b53.yaml |  2 +-
> >   .../devicetree/bindings/net/dsa/dsa.yaml      | 25 ++++++++++++++++---
> >   .../net/dsa/hirschmann,hellcreek.yaml         |  2 +-
> >   .../bindings/net/dsa/mediatek,mt7530.yaml     | 16 +++---------
> >   .../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/realtek.yaml  |  2 +-
> >   .../bindings/net/dsa/renesas,rzn1-a5psw.yaml  |  2 +-
> >   11 files changed, 35 insertions(+), 24 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml b/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml
> > index 259a0c6547f3..5888e3a0169a 100644
> > --- a/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml
> > +++ b/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml
> > @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
> >   title: Arrow SpeedChips XRS7000 Series Switch Device Tree Bindings
> >   allOf:
> > -  - $ref: dsa.yaml#
> > +  - $ref: dsa.yaml#/$defs/ethernet-ports
> >   maintainers:
> >     - George McCollister <george.mccollister@gmail.com>
> > diff --git a/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml b/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml
> > index 1219b830b1a4..5bef4128d175 100644
> > --- a/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml
> > +++ b/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml
> > @@ -66,7 +66,7 @@ required:
> >     - reg
> >   allOf:
> > -  - $ref: dsa.yaml#
> > +  - $ref: dsa.yaml#/$defs/ethernet-ports
> >     - if:
> >         properties:
> >           compatible:
> > diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.yaml b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> > index b9d48e357e77..b9e366e46aed 100644
> > --- a/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> > +++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> > @@ -19,9 +19,6 @@ description:
> >   select: false
> >   properties:
> > -  $nodename:
> > -    pattern: "^(ethernet-)?switch(@.*)?$"
> > -
> >     dsa,member:
> >       minItems: 2
> >       maxItems: 2
> > @@ -58,4 +55,26 @@ oneOf:
> >   additionalProperties: true
> > +$defs:
> > +  ethernet-ports:
> > +    description: A DSA switch without any extra port properties
> > +    $ref: '#/'
> > +
> > +    patternProperties:
> > +      "^(ethernet-)?ports$":
> > +        type: object
> > +        additionalProperties: false
> > +
> > +        properties:
> > +          '#address-cells':
> > +            const: 1
> > +          '#size-cells':
> > +            const: 0
> > +
> > +        patternProperties:
> > +          "^(ethernet-)?port@[0-9]+$":
> > +            description: Ethernet switch ports
> > +            $ref: dsa-port.yaml#
> > +            unevaluatedProperties: false
> > +
> >   ...
> > diff --git a/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml b/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml
> > index 73b774eadd0b..748ef9983ce2 100644
> > --- a/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml
> > +++ b/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml
> > @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
> >   title: Hirschmann Hellcreek TSN Switch Device Tree Bindings
> >   allOf:
> > -  - $ref: dsa.yaml#
> > +  - $ref: dsa.yaml#/$defs/ethernet-ports
> >   maintainers:
> >     - Andrew Lunn <andrew@lunn.ch>
> > diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> > index f2e9ff3f580b..b815272531fa 100644
> > --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> > +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> > @@ -156,17 +156,6 @@ patternProperties:
> >       patternProperties:
> >         "^(ethernet-)?port@[0-9]+$":
> > -        type: object
> > -        description: Ethernet switch ports
> > -
> > -        unevaluatedProperties: false
> > -
> > -        properties:
> > -          reg:
> > -            description:
> > -              Port address described must be 5 or 6 for CPU port and from 0 to 5
> > -              for user ports.
> 
> This shouldn't be moved. Please reread our conversation on the previous
> version.

I see - I missed your point. My apologies. This binding should keep the
reg properties where they were. I'll wait a few more days for any
additional feedback.

> 
> > -
> >           allOf:
> >             - $ref: dsa-port.yaml#
> >             - if:
> > @@ -174,6 +163,9 @@ patternProperties:
> >               then:
> >                 properties:
> >                   reg:
> > +                  description:
> > +                    Port address described must be 5 or 6 for CPU port and from
> > +                    0 to 5 for user ports
> 
> Arınç
Vladimir Oltean Dec. 6, 2022, 3:18 p.m. UTC | #5
On Fri, Dec 02, 2022 at 12:45:53PM -0800, Colin Foster wrote:
> DSA switches can fall into one of two categories: switches where all ports
> follow standard '(ethernet-)?port' properties, and switches that have
> additional properties for the ports.
> 
> The scenario where DSA ports are all standardized can be handled by
> swtiches with a reference to the new 'dsa.yaml#/$defs/ethernet-ports'.
> 
> The scenario where DSA ports require additional properties can reference
> '$dsa.yaml#' directly. This will allow switches to reference these standard
> defitions of the DSA switch, but add additional properties under the port
> nodes.
> ---
> diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.yaml b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> index b9d48e357e77..b9e366e46aed 100644
> --- a/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> @@ -19,9 +19,6 @@ description:
>  select: false
>  
>  properties:
> -  $nodename:
> -    pattern: "^(ethernet-)?switch(@.*)?$"
> -

Does this deletion belong to this patch or to "dt-bindings: net: add
generic ethernet-switch"?

>    dsa,member:
>      minItems: 2
>      maxItems: 2
> @@ -58,4 +55,26 @@ oneOf:
>  
>  additionalProperties: true
Vladimir Oltean Dec. 6, 2022, 3:37 p.m. UTC | #6
On Fri, Dec 02, 2022 at 12:45:53PM -0800, Colin Foster wrote:
> diff --git a/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml b/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml
> index 259a0c6547f3..5888e3a0169a 100644
> --- a/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml
> @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
>  title: Arrow SpeedChips XRS7000 Series Switch Device Tree Bindings
>  
>  allOf:
> -  - $ref: dsa.yaml#
> +  - $ref: dsa.yaml#/$defs/ethernet-ports
>  
>  maintainers:
>    - George McCollister <george.mccollister@gmail.com>
> diff --git a/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml b/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml
> index 1219b830b1a4..5bef4128d175 100644
> --- a/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml
> @@ -66,7 +66,7 @@ required:
>    - reg
>  
>  allOf:
> -  - $ref: dsa.yaml#
> +  - $ref: dsa.yaml#/$defs/ethernet-ports

I'm wondering if "ethernet-ports" is the best name for this schema.
Not very scientific, but what about "just-standard-props"?
Colin Foster Dec. 7, 2022, 2:24 a.m. UTC | #7
On Tue, Dec 06, 2022 at 05:18:51PM +0200, Vladimir Oltean wrote:
> On Fri, Dec 02, 2022 at 12:45:53PM -0800, Colin Foster wrote:
> > DSA switches can fall into one of two categories: switches where all ports
> > follow standard '(ethernet-)?port' properties, and switches that have
> > additional properties for the ports.
> > 
> > The scenario where DSA ports are all standardized can be handled by
> > swtiches with a reference to the new 'dsa.yaml#/$defs/ethernet-ports'.
> > 
> > The scenario where DSA ports require additional properties can reference
> > '$dsa.yaml#' directly. This will allow switches to reference these standard
> > defitions of the DSA switch, but add additional properties under the port
> > nodes.
> > ---
> > diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.yaml b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> > index b9d48e357e77..b9e366e46aed 100644
> > --- a/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> > +++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> > @@ -19,9 +19,6 @@ description:
> >  select: false
> >  
> >  properties:
> > -  $nodename:
> > -    pattern: "^(ethernet-)?switch(@.*)?$"
> > -
> 
> Does this deletion belong to this patch or to "dt-bindings: net: add
> generic ethernet-switch"?

Good catch. I'll move it.

> 
> >    dsa,member:
> >      minItems: 2
> >      maxItems: 2
> > @@ -58,4 +55,26 @@ oneOf:
> >  
> >  additionalProperties: true
Colin Foster Dec. 7, 2022, 2:27 a.m. UTC | #8
On Tue, Dec 06, 2022 at 05:37:34PM +0200, Vladimir Oltean wrote:
> On Fri, Dec 02, 2022 at 12:45:53PM -0800, Colin Foster wrote:
> > diff --git a/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml b/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml
> > index 259a0c6547f3..5888e3a0169a 100644
> > --- a/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml
> > +++ b/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml
> > @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
> >  title: Arrow SpeedChips XRS7000 Series Switch Device Tree Bindings
> >  
> >  allOf:
> > -  - $ref: dsa.yaml#
> > +  - $ref: dsa.yaml#/$defs/ethernet-ports
> >  
> >  maintainers:
> >    - George McCollister <george.mccollister@gmail.com>
> > diff --git a/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml b/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml
> > index 1219b830b1a4..5bef4128d175 100644
> > --- a/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml
> > +++ b/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml
> > @@ -66,7 +66,7 @@ required:
> >    - reg
> >  
> >  allOf:
> > -  - $ref: dsa.yaml#
> > +  - $ref: dsa.yaml#/$defs/ethernet-ports
> 
> I'm wondering if "ethernet-ports" is the best name for this schema.
> Not very scientific, but what about "just-standard-props"?

I have no strong opinions on this topic (except that I confused myself
when writing the commit message and it was 'base'). Anyone else care to
chime in?
Krzysztof Kozlowski Dec. 9, 2022, 9:10 a.m. UTC | #9
On 02/12/2022 21:45, Colin Foster wrote:
> DSA switches can fall into one of two categories: switches where all ports
> follow standard '(ethernet-)?port' properties, and switches that have
> additional properties for the ports.
> 
> The scenario where DSA ports are all standardized can be handled by
> swtiches with a reference to the new 'dsa.yaml#/$defs/ethernet-ports'.

typo: switches

> 
> The scenario where DSA ports require additional properties can reference
> '$dsa.yaml#' directly. This will allow switches to reference these standard
> defitions of the DSA switch, but add additional properties under the port

typo: definitions


Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml b/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml
index 259a0c6547f3..5888e3a0169a 100644
--- a/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml
@@ -7,7 +7,7 @@  $schema: http://devicetree.org/meta-schemas/core.yaml#
 title: Arrow SpeedChips XRS7000 Series Switch Device Tree Bindings
 
 allOf:
-  - $ref: dsa.yaml#
+  - $ref: dsa.yaml#/$defs/ethernet-ports
 
 maintainers:
   - George McCollister <george.mccollister@gmail.com>
diff --git a/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml b/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml
index 1219b830b1a4..5bef4128d175 100644
--- a/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml
@@ -66,7 +66,7 @@  required:
   - reg
 
 allOf:
-  - $ref: dsa.yaml#
+  - $ref: dsa.yaml#/$defs/ethernet-ports
   - if:
       properties:
         compatible:
diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.yaml b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
index b9d48e357e77..b9e366e46aed 100644
--- a/Documentation/devicetree/bindings/net/dsa/dsa.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
@@ -19,9 +19,6 @@  description:
 select: false
 
 properties:
-  $nodename:
-    pattern: "^(ethernet-)?switch(@.*)?$"
-
   dsa,member:
     minItems: 2
     maxItems: 2
@@ -58,4 +55,26 @@  oneOf:
 
 additionalProperties: true
 
+$defs:
+  ethernet-ports:
+    description: A DSA switch without any extra port properties
+    $ref: '#/'
+
+    patternProperties:
+      "^(ethernet-)?ports$":
+        type: object
+        additionalProperties: false
+
+        properties:
+          '#address-cells':
+            const: 1
+          '#size-cells':
+            const: 0
+
+        patternProperties:
+          "^(ethernet-)?port@[0-9]+$":
+            description: Ethernet switch ports
+            $ref: dsa-port.yaml#
+            unevaluatedProperties: false
+
 ...
diff --git a/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml b/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml
index 73b774eadd0b..748ef9983ce2 100644
--- a/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/hirschmann,hellcreek.yaml
@@ -7,7 +7,7 @@  $schema: http://devicetree.org/meta-schemas/core.yaml#
 title: Hirschmann Hellcreek TSN Switch Device Tree Bindings
 
 allOf:
-  - $ref: dsa.yaml#
+  - $ref: dsa.yaml#/$defs/ethernet-ports
 
 maintainers:
   - Andrew Lunn <andrew@lunn.ch>
diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
index f2e9ff3f580b..b815272531fa 100644
--- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
@@ -156,17 +156,6 @@  patternProperties:
 
     patternProperties:
       "^(ethernet-)?port@[0-9]+$":
-        type: object
-        description: Ethernet switch ports
-
-        unevaluatedProperties: false
-
-        properties:
-          reg:
-            description:
-              Port address described must be 5 or 6 for CPU port and from 0 to 5
-              for user ports.
-
         allOf:
           - $ref: dsa-port.yaml#
           - if:
@@ -174,6 +163,9 @@  patternProperties:
             then:
               properties:
                 reg:
+                  description:
+                    Port address described must be 5 or 6 for CPU port and from
+                    0 to 5 for user ports
                   enum:
                     - 5
                     - 6
@@ -238,7 +230,7 @@  $defs:
                       - sgmii
 
 allOf:
-  - $ref: dsa.yaml#
+  - $ref: dsa.yaml#/$defs/ethernet-ports
   - if:
       required:
         - mediatek,mcm
diff --git a/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml b/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml
index 4da75b1f9533..a4b53434c85c 100644
--- a/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml
@@ -11,7 +11,7 @@  maintainers:
   - Woojung Huh <Woojung.Huh@microchip.com>
 
 allOf:
-  - $ref: dsa.yaml#
+  - $ref: dsa.yaml#/$defs/ethernet-ports
   - $ref: /schemas/spi/spi-peripheral-props.yaml#
 
 properties:
diff --git a/Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml b/Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml
index 630bf0f8294b..4aee3bf4c2f4 100644
--- a/Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml
@@ -10,7 +10,7 @@  maintainers:
   - UNGLinuxDriver@microchip.com
 
 allOf:
-  - $ref: dsa.yaml#
+  - $ref: dsa.yaml#/$defs/ethernet-ports
 
 properties:
   compatible:
diff --git a/Documentation/devicetree/bindings/net/dsa/mscc,ocelot.yaml b/Documentation/devicetree/bindings/net/dsa/mscc,ocelot.yaml
index 8d93ed9c172c..85014a590a35 100644
--- a/Documentation/devicetree/bindings/net/dsa/mscc,ocelot.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/mscc,ocelot.yaml
@@ -78,7 +78,7 @@  required:
   - reg
 
 allOf:
-  - $ref: dsa.yaml#
+  - $ref: dsa.yaml#/$defs/ethernet-ports
   - if:
       properties:
         compatible:
diff --git a/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml b/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml
index 1e26d876d146..826e2db98974 100644
--- a/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml
@@ -13,7 +13,7 @@  description:
   depends on the SPI bus master driver.
 
 allOf:
-  - $ref: "dsa.yaml#"
+  - $ref: dsa.yaml#/$defs/ethernet-ports
   - $ref: /schemas/spi/spi-peripheral-props.yaml#
 
 maintainers:
diff --git a/Documentation/devicetree/bindings/net/dsa/realtek.yaml b/Documentation/devicetree/bindings/net/dsa/realtek.yaml
index 1a7d45a8ad66..cfd69c2604ea 100644
--- a/Documentation/devicetree/bindings/net/dsa/realtek.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/realtek.yaml
@@ -7,7 +7,7 @@  $schema: http://devicetree.org/meta-schemas/core.yaml#
 title: Realtek switches for unmanaged switches
 
 allOf:
-  - $ref: dsa.yaml#
+  - $ref: dsa.yaml#/$defs/ethernet-ports
 
 maintainers:
   - Linus Walleij <linus.walleij@linaro.org>
diff --git a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
index 0a0d62b6c00e..833d2f68daa1 100644
--- a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
@@ -14,7 +14,7 @@  description: |
   handles 4 ports + 1 CPU management port.
 
 allOf:
-  - $ref: dsa.yaml#
+  - $ref: dsa.yaml#/$defs/ethernet-ports
 
 properties:
   compatible: