Commit 3cec368a authored by Colin Foster's avatar Colin Foster Committed by David S. Miller
Browse files

dt-bindings: net: dsa: utilize base definitions for standard dsa switches



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
switches 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
definitions of the DSA switch, but add additional properties under the port
nodes.

Suggested-by: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarColin Foster <colin.foster@in-advantage.com>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Reviewed-by: default avatarRob Herring <robh@kernel.org>
Acked-by: Alvin Šipraga <alsi@bang-olufsen.dk> # realtek
Acked-by: default avatarArınç ÜNAL <arinc.unal@arinc9.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 54890925
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: Arrow SpeedChips XRS7000 Series Switch
title: Arrow SpeedChips XRS7000 Series Switch


allOf:
allOf:
  - $ref: dsa.yaml#
  - $ref: dsa.yaml#/$defs/ethernet-ports


maintainers:
maintainers:
  - George McCollister <george.mccollister@gmail.com>
  - George McCollister <george.mccollister@gmail.com>
+1 −1
Original line number Original line Diff line number Diff line
@@ -66,7 +66,7 @@ required:
  - reg
  - reg


allOf:
allOf:
  - $ref: dsa.yaml#
  - $ref: dsa.yaml#/$defs/ethernet-ports
  - if:
  - if:
      properties:
      properties:
        compatible:
        compatible:
+22 −0
Original line number Original line Diff line number Diff line
@@ -58,4 +58,26 @@ oneOf:


additionalProperties: true
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

...
...
+1 −1
Original line number Original line Diff line number Diff line
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: Hirschmann Hellcreek TSN Switch
title: Hirschmann Hellcreek TSN Switch


allOf:
allOf:
  - $ref: dsa.yaml#
  - $ref: dsa.yaml#/$defs/ethernet-ports


maintainers:
maintainers:
  - Andrew Lunn <andrew@lunn.ch>
  - Andrew Lunn <andrew@lunn.ch>
+1 −4
Original line number Original line Diff line number Diff line
@@ -157,9 +157,6 @@ patternProperties:
    patternProperties:
    patternProperties:
      "^(ethernet-)?port@[0-9]+$":
      "^(ethernet-)?port@[0-9]+$":
        type: object
        type: object
        description: Ethernet switch ports

        unevaluatedProperties: false


        properties:
        properties:
          reg:
          reg:
@@ -238,7 +235,7 @@ $defs:
                      - sgmii
                      - sgmii


allOf:
allOf:
  - $ref: dsa.yaml#
  - $ref: dsa.yaml#/$defs/ethernet-ports
  - if:
  - if:
      required:
      required:
        - mediatek,mcm
        - mediatek,mcm
Loading