Skip to content

Commit

Permalink
dt-bindings: net: dsa: utilize base definitions for standard dsa swit…
Browse files Browse the repository at this point in the history
…ches

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: 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>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Alvin Šipraga <alsi@bang-olufsen.dk> # realtek
Acked-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Colin Foster authored and David S. Miller committed Jan 16, 2023
1 parent 5489092 commit 3cec368
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
title: Arrow SpeedChips XRS7000 Series Switch

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

maintainers:
- George McCollister <george.mccollister@gmail.com>
Expand Down
2 changes: 1 addition & 1 deletion Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ required:
- reg

allOf:
- $ref: dsa.yaml#
- $ref: dsa.yaml#/$defs/ethernet-ports
- if:
properties:
compatible:
Expand Down
22 changes: 22 additions & 0 deletions Documentation/devicetree/bindings/net/dsa/dsa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,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

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

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

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

unevaluatedProperties: false

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

allOf:
- $ref: dsa.yaml#
- $ref: dsa.yaml#/$defs/ethernet-ports
- if:
required:
- mediatek,mcm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ maintainers:
- UNGLinuxDriver@microchip.com

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

properties:
compatible:
Expand Down
2 changes: 1 addition & 1 deletion Documentation/devicetree/bindings/net/dsa/mscc,ocelot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ required:
- reg

allOf:
- $ref: dsa.yaml#
- $ref: dsa.yaml#/$defs/ethernet-ports
- if:
properties:
compatible:
Expand Down
2 changes: 1 addition & 1 deletion Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion Documentation/devicetree/bindings/net/dsa/realtek.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ description: |
handles 4 ports + 1 CPU management port.
allOf:
- $ref: dsa.yaml#
- $ref: dsa.yaml#/$defs/ethernet-ports

properties:
compatible:
Expand Down

0 comments on commit 3cec368

Please sign in to comment.