2022-12-02 20:50:12

by Colin Foster

[permalink] [raw]
Subject: [PATCH v4 net-next 0/9] dt-binding preparation for ocelot switches

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).

---

v3 -> v4
* Renamed "base" to "ethernet-ports" to avoid confusion with the concept
of a base class.
* Squash ("dt-bindings: net: dsa: mediatek,mt7530: fix port description location")
patch into ("dt-bindings: net: dsa: utilize base definitions for standard dsa
switches")
* Corrections to fix confusion about additonalProperties vs unevaluatedProperties.
See specific patches for details.

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 (9):
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: 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 | 47 +++++++-------
.../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 | 14 +----
.../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, 142 insertions(+), 113 deletions(-)
create mode 100644 Documentation/devicetree/bindings/net/ethernet-switch-port.yaml
create mode 100644 Documentation/devicetree/bindings/net/ethernet-switch.yaml

--
2.25.1


2022-12-02 20:51:28

by Colin Foster

[permalink] [raw]
Subject: [PATCH v4 net-next 2/9] dt-bindings: net: dsa: qca8k: remove address-cells and size-cells from switch node

The children of the switch node don't have a unit address, and therefore
should not need the #address-cells or #size-cells entries. Fix the example
schemas accordingly.

Suggested-by: Vladimir Oltean <[email protected]>
Signed-off-by: Colin Foster <[email protected]>
Reviewed-by: Florian Fainelli <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
---

v3 -> v4
* Add Reviewed tags

v3
* New patch

---
Documentation/devicetree/bindings/net/dsa/qca8k.yaml | 4 ----
1 file changed, 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
index 978162df51f7..6fc9bc985726 100644
--- a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
@@ -148,8 +148,6 @@ examples:

switch@10 {
compatible = "qca,qca8337";
- #address-cells = <1>;
- #size-cells = <0>;
reset-gpios = <&gpio 42 GPIO_ACTIVE_LOW>;
reg = <0x10>;

@@ -209,8 +207,6 @@ examples:

switch@10 {
compatible = "qca,qca8337";
- #address-cells = <1>;
- #size-cells = <0>;
reset-gpios = <&gpio 42 GPIO_ACTIVE_LOW>;
reg = <0x10>;

--
2.25.1

2022-12-02 20:51:28

by Colin Foster

[permalink] [raw]
Subject: [PATCH v4 net-next 3/9] 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
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 <[email protected]>
Signed-off-by: Colin Foster <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
Reviewed-by: Florian Fainelli <[email protected]>
Acked-by: Alvin Šipraga <[email protected]> # 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 <[email protected]>
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 <[email protected]>
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 <[email protected]>

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:
- [email protected]

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 <[email protected]>
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:
--
2.25.1

2022-12-02 20:51:29

by Colin Foster

[permalink] [raw]
Subject: [PATCH v4 net-next 4/9] dt-bindings: net: dsa: allow additional ethernet-port properties

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 <[email protected]>
Reviewed-by: Florian Fainelli <[email protected]>
---

v3 -> v4
* Change ethernet-ports node to have "unevaluatedProperties: false"
instead of "additionalProperties: true"
* Change ethernet-port node to have "additionalProperties: true" instead
of "unevaluatedProperties: true"
* Add Reviewed tag

v2 -> v3
* No change

v1 -> v2
* New patch

---
Documentation/devicetree/bindings/net/dsa/dsa.yaml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.yaml b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
index b9e366e46aed..5081f4979f1b 100644
--- a/Documentation/devicetree/bindings/net/dsa/dsa.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
@@ -38,6 +38,8 @@ patternProperties:
'#size-cells':
const: 0

+ unevaluatedProperties: false
+
patternProperties:
"^(ethernet-)?port@[0-9]+$":
type: object
@@ -45,7 +47,7 @@ patternProperties:

$ref: dsa-port.yaml#

- unevaluatedProperties: false
+ additionalProperties: true

oneOf:
- required:
--
2.25.1

2022-12-02 20:51:51

by Colin Foster

[permalink] [raw]
Subject: [PATCH v4 net-next 5/9] dt-bindings: net: dsa: qca8k: utilize shared dsa.yaml

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 <[email protected]>
Suggested-by: Vladimir Oltean <[email protected]>
Reviewed-by: Florian Fainelli <[email protected]>
---

v3 -> v4
* Add Reviewed tag
* Remove unnecessary blank line deletion

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 | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
index 6fc9bc985726..389892592aac 100644
--- a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
@@ -66,15 +66,11 @@ 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
@@ -116,7 +112,7 @@ required:
- compatible
- reg

-additionalProperties: true
+unevaluatedProperties: false

examples:
- |
--
2.25.1

2022-12-02 20:51:52

by Colin Foster

[permalink] [raw]
Subject: [PATCH v4 net-next 6/9] dt-bindings: net: dsa: mediatek,mt7530: remove unnecessary dsa-port reference

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 <[email protected]>
Suggested-by: Vladimir Oltean <[email protected]>
Reviewed-by: Arınç ÜNAL <[email protected]>
Reviewed-by: Florian Fainelli <[email protected]>
---

v3 -> v4
* Add Florian Reviewed tag

v2 -> v3
* Keep "unevaluatedProperties: false" under the switch ports node.

v1 -> v2
* Add Reviewed-by

---
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml | 1 -
1 file changed, 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
index b815272531fa..b65e55be3ae2 100644
--- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
@@ -157,7 +157,6 @@ patternProperties:
patternProperties:
"^(ethernet-)?port@[0-9]+$":
allOf:
- - $ref: dsa-port.yaml#
- if:
required: [ ethernet ]
then:
--
2.25.1

2022-12-02 20:51:53

by Colin Foster

[permalink] [raw]
Subject: [PATCH v4 net-next 9/9] dt-bindings: net: mscc,vsc7514-switch: utilize generic ethernet-switch.yaml

Several bindings for ethernet switches are available for non-dsa switches
by way of ethernet-switch.yaml. Remove these duplicate entries and utilize
the common bindings for the VSC7514.

Signed-off-by: Colin Foster <[email protected]>
Suggested-by: Vladimir Oltean <[email protected]>
Reviewed-by: Florian Fainelli <[email protected]>
---

v3 -> v4
* Add Florian Reviewed tag

v2 -> v3:
* Reference ethernet-switch-port.yaml# instead of ethernet-controller
* Undo the addition of "unevaluatedProperties: true" from v2. Those
were only added because of my misunderstandings.
* Keep #address-cells and #size-cells in the ports node.

v1 -> v2:
* Fix "$ref: ethernet-switch.yaml" placement. Oops.
* Add "unevaluatedProperties: true" to ethernet-ports layer so it
can correctly read into ethernet-switch.yaml
* Add "unevaluatedProperties: true" to ethernet-port layer so it can
correctly read into ethernet-controller.yaml

---
.../bindings/net/mscc,vsc7514-switch.yaml | 31 ++-----------------
1 file changed, 3 insertions(+), 28 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml b/Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml
index ee0a504bdb24..5ffe831e59e4 100644
--- a/Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml
+++ b/Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml
@@ -18,10 +18,9 @@ description: |
packets using CPU. Additionally, PTP is supported as well as FDMA for faster
packet extraction/injection.

-properties:
- $nodename:
- pattern: "^switch@[0-9a-f]+$"
+$ref: ethernet-switch.yaml#

+properties:
compatible:
const: mscc,vsc7514-switch

@@ -100,35 +99,11 @@ properties:

patternProperties:
"^port@[0-9a-f]+$":
- type: object
- description: Ethernet ports handled by the switch

- $ref: ethernet-controller.yaml#
+ $ref: ethernet-switch-port.yaml#

unevaluatedProperties: false

- properties:
- reg:
- description: Switch port number
-
- phy-handle: true
-
- phy-mode: true
-
- fixed-link: true
-
- mac-address: true
-
- required:
- - reg
- - phy-mode
-
- oneOf:
- - required:
- - phy-handle
- - required:
- - fixed-link
-
required:
- compatible
- reg
--
2.25.1

2022-12-02 20:52:25

by Colin Foster

[permalink] [raw]
Subject: [PATCH v4 net-next 7/9] dt-bindings: net: add generic ethernet-switch

The dsa.yaml bindings had references that can apply to non-dsa switches. To
prevent duplication of this information, keep the dsa-specific information
inside dsa.yaml and move the remaining generic information to the newly
created ethernet-switch.yaml.

Signed-off-by: Colin Foster <[email protected]>
Suggested-by: Vladimir Oltean <[email protected]>
Reviewed-by: Florian Fainelli <[email protected]>
---

v3 -> v4
* Update ethernet-ports and ethernet-port nodes to match what the new
dsa.yaml has. Namely:
"unevaluatedProperties: false" instead of "additionalProperties: true"
"additionalProperties: true" instead of "unevaluatedProperties: true"
for ethernet-ports and ethernet-port, respectively.
* Add Florian Reviewed tag

v2 -> v3
* Change ethernet-switch.yaml title from "Ethernet Switch Device
Tree Bindings" to "Generic Ethernet Switch"
* Rework ethernet-switch.yaml description
* Add base defs structure for switches that don't have any additional
properties.
* Add "additionalProperties: true" under "^(ethernet-)?ports$" node
* Correct port reference from /schemas/net/dsa/dsa-port.yaml# to
ethernet-controller.yaml#

v1 -> v2
* No net change, but deletions from dsa.yaml included the changes for
"addionalProperties: true" under ports and "unevaluatedProperties:
true" under port.

---
.../devicetree/bindings/net/dsa/dsa.yaml | 28 +-------
.../bindings/net/ethernet-switch.yaml | 66 +++++++++++++++++++
MAINTAINERS | 1 +
3 files changed, 69 insertions(+), 26 deletions(-)
create mode 100644 Documentation/devicetree/bindings/net/ethernet-switch.yaml

diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.yaml b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
index 5081f4979f1b..843205ea722d 100644
--- a/Documentation/devicetree/bindings/net/dsa/dsa.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
@@ -18,6 +18,8 @@ description:

select: false

+$ref: "/schemas/net/ethernet-switch.yaml#"
+
properties:
dsa,member:
minItems: 2
@@ -29,32 +31,6 @@ properties:
(single device hanging off a CPU port) must not specify this property
$ref: /schemas/types.yaml#/definitions/uint32-array

-patternProperties:
- "^(ethernet-)?ports$":
- type: object
- properties:
- '#address-cells':
- const: 1
- '#size-cells':
- const: 0
-
- unevaluatedProperties: false
-
- patternProperties:
- "^(ethernet-)?port@[0-9]+$":
- type: object
- description: Ethernet switch ports
-
- $ref: dsa-port.yaml#
-
- additionalProperties: true
-
-oneOf:
- - required:
- - ports
- - required:
- - ethernet-ports
-
additionalProperties: true

$defs:
diff --git a/Documentation/devicetree/bindings/net/ethernet-switch.yaml b/Documentation/devicetree/bindings/net/ethernet-switch.yaml
new file mode 100644
index 000000000000..afeb9ffd84c8
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/ethernet-switch.yaml
@@ -0,0 +1,66 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/ethernet-switch.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Generic Ethernet Switch
+
+maintainers:
+ - Andrew Lunn <[email protected]>
+ - Florian Fainelli <[email protected]>
+ - Vivien Didelot <[email protected]>
+
+description:
+ Ethernet switches are multi-port Ethernet controllers. Each port has
+ its own number and is represented as its own Ethernet controller.
+ The minimum required functionality is to pass packets to software.
+ They may or may not be able to forward packets automonously between
+ ports.
+
+select: false
+
+properties:
+ $nodename:
+ pattern: "^(ethernet-)?switch(@.*)?$"
+
+patternProperties:
+ "^(ethernet-)?ports$":
+ type: object
+ unevaluatedProperties: false
+
+ properties:
+ '#address-cells':
+ const: 1
+ '#size-cells':
+ const: 0
+
+ patternProperties:
+ "^(ethernet-)?port@[0-9]+$":
+ type: object
+ description: Ethernet switch ports
+
+ $ref: ethernet-controller.yaml#
+
+ additionalProperties: true
+
+oneOf:
+ - required:
+ - ports
+ - required:
+ - ethernet-ports
+
+additionalProperties: true
+
+$defs:
+ base:
+ description: An ethernet switch without any extra port properties
+ $ref: '#/'
+
+ patternProperties:
+ "^(ethernet-)?port@[0-9]+$":
+ description: Ethernet switch ports
+ $ref: ethernet-controller.yaml#
+ unevaluatedProperties: false
+
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 52aeb86c1167..d574cae901b3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -14337,6 +14337,7 @@ M: Florian Fainelli <[email protected]>
M: Vladimir Oltean <[email protected]>
S: Maintained
F: Documentation/devicetree/bindings/net/dsa/
+F: Documentation/devicetree/bindings/net/ethernet-switch.yaml
F: drivers/net/dsa/
F: include/linux/dsa/
F: include/linux/platform_data/dsa.h
--
2.25.1

2022-12-02 21:07:24

by Colin Foster

[permalink] [raw]
Subject: [PATCH v4 net-next 8/9] dt-bindings: net: add generic ethernet-switch-port binding

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 <[email protected]>
Suggested-by: Vladimir Oltean <[email protected]>
Reviewed-by: Florian Fainelli <[email protected]>
---

v3 -> v4
* Add Florian Reviewed tag

v2 -> v3
* Change dsa-port title from "DSA Switch port Device Tree Bindings"
to "Generic DSA Switch port"
* Add reference to ethernet-switch-port.yaml# in dsa-port.yaml
* Change title of ethernet-switch-port.yaml from "Ethernet Switch
port Device Tree Bindings" to "Generic Ethernet Switch port"
* Remove most properties from ethernet-switch-port.yaml. They're
all in ethernet-controller, and are all allowed.
* ethernet-switch.yaml now only references ethernet-switch-port.yaml#
under the port node.

v1 -> v2
* Remove accidental addition of
"$ref: /schemas/net/ethernet-switch-port.yaml" which should be kept
out of dsa-port so that it doesn't get referenced multiple times
through both ethernet-switch and dsa-port.

---
.../devicetree/bindings/net/dsa/dsa-port.yaml | 24 ++----------------
.../bindings/net/ethernet-switch-port.yaml | 25 +++++++++++++++++++
.../bindings/net/ethernet-switch.yaml | 6 +----
MAINTAINERS | 1 +
4 files changed, 29 insertions(+), 27 deletions(-)
create mode 100644 Documentation/devicetree/bindings/net/ethernet-switch-port.yaml

diff --git a/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml b/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml
index 9abb8eba5fad..5b457f41273a 100644
--- a/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml
@@ -4,7 +4,7 @@
$id: http://devicetree.org/schemas/net/dsa/dsa-port.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

-title: Ethernet Switch port Device Tree Bindings
+title: Generic DSA Switch port

maintainers:
- Andrew Lunn <[email protected]>
@@ -14,8 +14,7 @@ maintainers:
description:
Ethernet switch port Description

-allOf:
- - $ref: /schemas/net/ethernet-controller.yaml#
+$ref: /schemas/net/ethernet-switch-port.yaml#

properties:
reg:
@@ -58,25 +57,6 @@ properties:
- rtl8_4t
- seville

- phy-handle: true
-
- phy-mode: true
-
- fixed-link: true
-
- mac-address: true
-
- sfp: true
-
- managed: true
-
- rx-internal-delay-ps: true
-
- tx-internal-delay-ps: true
-
-required:
- - reg
-
# CPU and DSA ports must have phylink-compatible link descriptions
if:
oneOf:
diff --git a/Documentation/devicetree/bindings/net/ethernet-switch-port.yaml b/Documentation/devicetree/bindings/net/ethernet-switch-port.yaml
new file mode 100644
index 000000000000..3d7da6916fb8
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/ethernet-switch-port.yaml
@@ -0,0 +1,25 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/ethernet-switch-port.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Generic Ethernet Switch port
+
+maintainers:
+ - Andrew Lunn <[email protected]>
+ - Florian Fainelli <[email protected]>
+ - Vivien Didelot <[email protected]>
+
+description:
+ Ethernet switch port Description
+
+$ref: ethernet-controller.yaml#
+
+properties:
+ reg:
+ description: Port number
+
+additionalProperties: true
+
+...
diff --git a/Documentation/devicetree/bindings/net/ethernet-switch.yaml b/Documentation/devicetree/bindings/net/ethernet-switch.yaml
index afeb9ffd84c8..1e8b7649a9b2 100644
--- a/Documentation/devicetree/bindings/net/ethernet-switch.yaml
+++ b/Documentation/devicetree/bindings/net/ethernet-switch.yaml
@@ -40,10 +40,6 @@ patternProperties:
type: object
description: Ethernet switch ports

- $ref: ethernet-controller.yaml#
-
- additionalProperties: true
-
oneOf:
- required:
- ports
@@ -60,7 +56,7 @@ $defs:
patternProperties:
"^(ethernet-)?port@[0-9]+$":
description: Ethernet switch ports
- $ref: ethernet-controller.yaml#
+ $ref: ethernet-switch-port.yaml#
unevaluatedProperties: false

...
diff --git a/MAINTAINERS b/MAINTAINERS
index d574cae901b3..fe5f52c9864a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -14337,6 +14337,7 @@ M: Florian Fainelli <[email protected]>
M: Vladimir Oltean <[email protected]>
S: Maintained
F: Documentation/devicetree/bindings/net/dsa/
+F: Documentation/devicetree/bindings/net/ethernet-switch-port.yaml
F: Documentation/devicetree/bindings/net/ethernet-switch.yaml
F: drivers/net/dsa/
F: include/linux/dsa/
--
2.25.1

2022-12-02 22:13:30

by Arınç ÜNAL

[permalink] [raw]
Subject: Re: [PATCH v4 net-next 3/9] dt-bindings: net: dsa: utilize base definitions for standard dsa switches

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 <[email protected]>
> Signed-off-by: Colin Foster <[email protected]>
> Reviewed-by: Linus Walleij <[email protected]>
> Reviewed-by: Florian Fainelli <[email protected]>
> Acked-by: Alvin Šipraga <[email protected]> # 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 <[email protected]>
> 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 <[email protected]>
> 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ç

2022-12-05 18:42:55

by Colin Foster

[permalink] [raw]
Subject: Re: [PATCH v4 net-next 3/9] dt-bindings: net: dsa: utilize base definitions for standard dsa switches

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 <[email protected]>
> > Signed-off-by: Colin Foster <[email protected]>
> > Reviewed-by: Linus Walleij <[email protected]>
> > Reviewed-by: Florian Fainelli <[email protected]>
> > Acked-by: Alvin Šipraga <[email protected]> # 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 <[email protected]>
> > 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 <[email protected]>
> > 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ç

2022-12-05 18:56:42

by Arınç ÜNAL

[permalink] [raw]
Subject: Re: [PATCH v4 net-next 3/9] dt-bindings: net: dsa: utilize base definitions for standard dsa switches

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 <[email protected]>
>>> Signed-off-by: Colin Foster <[email protected]>
>>> Reviewed-by: Linus Walleij <[email protected]>
>>> Reviewed-by: Florian Fainelli <[email protected]>
>>> Acked-by: Alvin Šipraga <[email protected]> # 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 <[email protected]>
>>> 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 <[email protected]>
>>> 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 <[email protected]>

Arınç

2022-12-05 21:46:37

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH v4 net-next 3/9] dt-bindings: net: dsa: utilize base definitions for standard dsa switches


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 <[email protected]>
> Signed-off-by: Colin Foster <[email protected]>
> Reviewed-by: Linus Walleij <[email protected]>
> Reviewed-by: Florian Fainelli <[email protected]>
> Acked-by: Alvin Šipraga <[email protected]> # 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 <[email protected]>

2022-12-05 22:11:37

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH v4 net-next 6/9] dt-bindings: net: dsa: mediatek,mt7530: remove unnecessary dsa-port reference


On Fri, 02 Dec 2022 12:45:56 -0800, 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 <[email protected]>
> Suggested-by: Vladimir Oltean <[email protected]>
> Reviewed-by: Arınç ÜNAL <[email protected]>
> Reviewed-by: Florian Fainelli <[email protected]>
> ---
>
> v3 -> v4
> * Add Florian Reviewed tag
>
> v2 -> v3
> * Keep "unevaluatedProperties: false" under the switch ports node.
>
> v1 -> v2
> * Add Reviewed-by
>
> ---
> Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml | 1 -
> 1 file changed, 1 deletion(-)
>

Reviewed-by: Rob Herring <[email protected]>

2022-12-05 22:33:43

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH v4 net-next 5/9] dt-bindings: net: dsa: qca8k: utilize shared dsa.yaml


On Fri, 02 Dec 2022 12:45:55 -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 <[email protected]>
> Suggested-by: Vladimir Oltean <[email protected]>
> Reviewed-by: Florian Fainelli <[email protected]>
> ---
>
> v3 -> v4
> * Add Reviewed tag
> * Remove unnecessary blank line deletion
>
> 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 | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>

Reviewed-by: Rob Herring <[email protected]>

2022-12-05 22:46:15

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH v4 net-next 8/9] dt-bindings: net: add generic ethernet-switch-port binding


On Fri, 02 Dec 2022 12:45:58 -0800, 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 <[email protected]>
> Suggested-by: Vladimir Oltean <[email protected]>
> Reviewed-by: Florian Fainelli <[email protected]>
> ---
>
> v3 -> v4
> * Add Florian Reviewed tag
>
> v2 -> v3
> * Change dsa-port title from "DSA Switch port Device Tree Bindings"
> to "Generic DSA Switch port"
> * Add reference to ethernet-switch-port.yaml# in dsa-port.yaml
> * Change title of ethernet-switch-port.yaml from "Ethernet Switch
> port Device Tree Bindings" to "Generic Ethernet Switch port"
> * Remove most properties from ethernet-switch-port.yaml. They're
> all in ethernet-controller, and are all allowed.
> * ethernet-switch.yaml now only references ethernet-switch-port.yaml#
> under the port node.
>
> v1 -> v2
> * Remove accidental addition of
> "$ref: /schemas/net/ethernet-switch-port.yaml" which should be kept
> out of dsa-port so that it doesn't get referenced multiple times
> through both ethernet-switch and dsa-port.
>
> ---
> .../devicetree/bindings/net/dsa/dsa-port.yaml | 24 ++----------------
> .../bindings/net/ethernet-switch-port.yaml | 25 +++++++++++++++++++
> .../bindings/net/ethernet-switch.yaml | 6 +----
> MAINTAINERS | 1 +
> 4 files changed, 29 insertions(+), 27 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/net/ethernet-switch-port.yaml
>

Reviewed-by: Rob Herring <[email protected]>

2022-12-05 22:48:33

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH v4 net-next 7/9] dt-bindings: net: add generic ethernet-switch

On Fri, Dec 02, 2022 at 12:45:57PM -0800, Colin Foster wrote:
> The dsa.yaml bindings had references that can apply to non-dsa switches. To
> prevent duplication of this information, keep the dsa-specific information
> inside dsa.yaml and move the remaining generic information to the newly
> created ethernet-switch.yaml.
>
> Signed-off-by: Colin Foster <[email protected]>
> Suggested-by: Vladimir Oltean <[email protected]>
> Reviewed-by: Florian Fainelli <[email protected]>
> ---
>
> v3 -> v4
> * Update ethernet-ports and ethernet-port nodes to match what the new
> dsa.yaml has. Namely:
> "unevaluatedProperties: false" instead of "additionalProperties: true"
> "additionalProperties: true" instead of "unevaluatedProperties: true"
> for ethernet-ports and ethernet-port, respectively.
> * Add Florian Reviewed tag
>
> v2 -> v3
> * Change ethernet-switch.yaml title from "Ethernet Switch Device
> Tree Bindings" to "Generic Ethernet Switch"
> * Rework ethernet-switch.yaml description
> * Add base defs structure for switches that don't have any additional
> properties.
> * Add "additionalProperties: true" under "^(ethernet-)?ports$" node
> * Correct port reference from /schemas/net/dsa/dsa-port.yaml# to
> ethernet-controller.yaml#
>
> v1 -> v2
> * No net change, but deletions from dsa.yaml included the changes for
> "addionalProperties: true" under ports and "unevaluatedProperties:
> true" under port.
>
> ---
> .../devicetree/bindings/net/dsa/dsa.yaml | 28 +-------
> .../bindings/net/ethernet-switch.yaml | 66 +++++++++++++++++++
> MAINTAINERS | 1 +
> 3 files changed, 69 insertions(+), 26 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/net/ethernet-switch.yaml
>
> diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.yaml b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> index 5081f4979f1b..843205ea722d 100644
> --- a/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> @@ -18,6 +18,8 @@ description:
>
> select: false
>
> +$ref: "/schemas/net/ethernet-switch.yaml#"

You can drop quotes here.

With that,

Reviewed-by: Rob Herring <[email protected]>

This is a nice clean-up.

Rob

2022-12-06 15:27:30

by Vladimir Oltean

[permalink] [raw]
Subject: Re: [PATCH v4 net-next 3/9] dt-bindings: net: dsa: utilize base definitions for standard dsa switches

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

2022-12-06 15:57:02

by Vladimir Oltean

[permalink] [raw]
Subject: Re: [PATCH v4 net-next 8/9] dt-bindings: net: add generic ethernet-switch-port binding

On Fri, Dec 02, 2022 at 12:45:58PM -0800, 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 <[email protected]>
> Suggested-by: Vladimir Oltean <[email protected]>
> Reviewed-by: Florian Fainelli <[email protected]>
> ---
>
> v3 -> v4
> * Add Florian Reviewed tag
>
> v2 -> v3
> * Change dsa-port title from "DSA Switch port Device Tree Bindings"
> to "Generic DSA Switch port"
> * Add reference to ethernet-switch-port.yaml# in dsa-port.yaml
> * Change title of ethernet-switch-port.yaml from "Ethernet Switch
> port Device Tree Bindings" to "Generic Ethernet Switch port"
> * Remove most properties from ethernet-switch-port.yaml. They're
> all in ethernet-controller, and are all allowed.
> * ethernet-switch.yaml now only references ethernet-switch-port.yaml#
> under the port node.
>
> v1 -> v2
> * Remove accidental addition of
> "$ref: /schemas/net/ethernet-switch-port.yaml" which should be kept
> out of dsa-port so that it doesn't get referenced multiple times
> through both ethernet-switch and dsa-port.
>
> ---
> .../devicetree/bindings/net/dsa/dsa-port.yaml | 24 ++----------------
> .../bindings/net/ethernet-switch-port.yaml | 25 +++++++++++++++++++
> .../bindings/net/ethernet-switch.yaml | 6 +----
> MAINTAINERS | 1 +
> 4 files changed, 29 insertions(+), 27 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/net/ethernet-switch-port.yaml
>
> diff --git a/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml b/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml
> index 9abb8eba5fad..5b457f41273a 100644
> --- a/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml
> @@ -4,7 +4,7 @@
> $id: http://devicetree.org/schemas/net/dsa/dsa-port.yaml#
> $schema: http://devicetree.org/meta-schemas/core.yaml#
>
> -title: Ethernet Switch port Device Tree Bindings
> +title: Generic DSA Switch port

What are the capitalization rules in titles? Looks odd that "port" is
lowercase but "switch" isn't.

>
> maintainers:
> - Andrew Lunn <[email protected]>
> @@ -14,8 +14,7 @@ maintainers:
> description:
> Ethernet switch port Description
>
> -allOf:
> - - $ref: /schemas/net/ethernet-controller.yaml#
> +$ref: /schemas/net/ethernet-switch-port.yaml#
>
> properties:
> reg:
> @@ -58,25 +57,6 @@ properties:
> - rtl8_4t
> - seville
>
> - phy-handle: true
> -
> - phy-mode: true
> -
> - fixed-link: true
> -
> - mac-address: true
> -
> - sfp: true
> -
> - managed: true
> -
> - rx-internal-delay-ps: true
> -
> - tx-internal-delay-ps: true
> -
> -required:
> - - reg
> -
> # CPU and DSA ports must have phylink-compatible link descriptions
> if:
> oneOf:
> diff --git a/Documentation/devicetree/bindings/net/ethernet-switch-port.yaml b/Documentation/devicetree/bindings/net/ethernet-switch-port.yaml
> new file mode 100644
> index 000000000000..3d7da6916fb8
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/ethernet-switch-port.yaml
> @@ -0,0 +1,25 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/net/ethernet-switch-port.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Generic Ethernet Switch port
> +
> +maintainers:
> + - Andrew Lunn <[email protected]>
> + - Florian Fainelli <[email protected]>
> + - Vivien Didelot <[email protected]>
> +
> +description:
> + Ethernet switch port Description

Sounds a bit too "lorem ipsum dolor sit amet". You can say that a port
is a component of a switch which manages one MAC, and can pass Ethernet
frames.

> +
> +$ref: ethernet-controller.yaml#
> +
> +properties:
> + reg:
> + description: Port number
> +
> +additionalProperties: true
> +
> +...
> diff --git a/Documentation/devicetree/bindings/net/ethernet-switch.yaml b/Documentation/devicetree/bindings/net/ethernet-switch.yaml
> index afeb9ffd84c8..1e8b7649a9b2 100644
> --- a/Documentation/devicetree/bindings/net/ethernet-switch.yaml
> +++ b/Documentation/devicetree/bindings/net/ethernet-switch.yaml
> @@ -40,10 +40,6 @@ patternProperties:
> type: object
> description: Ethernet switch ports
>
> - $ref: ethernet-controller.yaml#
> -
> - additionalProperties: true
> -
> oneOf:
> - required:
> - ports
> @@ -60,7 +56,7 @@ $defs:
> patternProperties:
> "^(ethernet-)?port@[0-9]+$":
> description: Ethernet switch ports
> - $ref: ethernet-controller.yaml#
> + $ref: ethernet-switch-port.yaml#
> unevaluatedProperties: false
>
> ...
> diff --git a/MAINTAINERS b/MAINTAINERS
> index d574cae901b3..fe5f52c9864a 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -14337,6 +14337,7 @@ M: Florian Fainelli <[email protected]>
> M: Vladimir Oltean <[email protected]>
> S: Maintained
> F: Documentation/devicetree/bindings/net/dsa/
> +F: Documentation/devicetree/bindings/net/ethernet-switch-port.yaml
> F: Documentation/devicetree/bindings/net/ethernet-switch.yaml
> F: drivers/net/dsa/
> F: include/linux/dsa/
> --
> 2.25.1
>

2022-12-06 16:02:35

by Vladimir Oltean

[permalink] [raw]
Subject: Re: [PATCH v4 net-next 3/9] dt-bindings: net: dsa: utilize base definitions for standard dsa switches

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 <[email protected]>
> 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"?

2022-12-06 16:32:54

by Vladimir Oltean

[permalink] [raw]
Subject: Re: [PATCH v4 net-next 0/9] dt-binding preparation for ocelot switches

Hi Colin,

On Fri, Dec 02, 2022 at 12:45:50PM -0800, Colin Foster wrote:
> 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).
>
> ---

This looks like a very clean implementation of what I had in mind
(better than I could have done it). Sorry for not being able to help
with the json-schema bits and thanks to Rob for doing so.

Would you mind adding one more patch at the beginning of the series
which syncs the maintainers from the DSA (and now also ethernet-switch)
dt-bindings with the MAINTAINERS file? That would mean removing Vivien
(see commit 6ce3df596be2 ("MAINTAINERS: Move Vivien to CREDITS")) and
adding myself. This is in principle such that you don't carry around a
not-up-to-date list of maintainers when adding new schemas.

I don't know if we could do something about maintainer entries in
schemas not becoming out of date w.r.t. the MAINTAINERS file.

2022-12-07 02:49:59

by Colin Foster

[permalink] [raw]
Subject: Re: [PATCH v4 net-next 3/9] dt-bindings: net: dsa: utilize base definitions for standard dsa switches

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 <[email protected]>
> > 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?

2022-12-07 02:54:05

by Colin Foster

[permalink] [raw]
Subject: Re: [PATCH v4 net-next 3/9] dt-bindings: net: dsa: utilize base definitions for standard dsa switches

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

2022-12-07 03:18:32

by Colin Foster

[permalink] [raw]
Subject: Re: [PATCH v4 net-next 8/9] dt-bindings: net: add generic ethernet-switch-port binding

On Tue, Dec 06, 2022 at 05:50:49PM +0200, Vladimir Oltean wrote:
> On Fri, Dec 02, 2022 at 12:45:58PM -0800, Colin Foster wrote:
> > --- a/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml
> > +++ b/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml
> > @@ -4,7 +4,7 @@
> > $id: http://devicetree.org/schemas/net/dsa/dsa-port.yaml#
> > $schema: http://devicetree.org/meta-schemas/core.yaml#
> >
> > -title: Ethernet Switch port Device Tree Bindings
> > +title: Generic DSA Switch port
>
> What are the capitalization rules in titles? Looks odd that "port" is
> lowercase but "switch" isn't.

Agreed. A quick grep for "title:\ " shows... a fair amount of
inconsistency. I'd lean toward Port. [insert nautical and/or fortified
wine joke here]

>
> >
> > maintainers:
> > - Andrew Lunn <[email protected]>
> > @@ -14,8 +14,7 @@ maintainers:
> > description:
> > Ethernet switch port Description
> >
> > -allOf:
> > - - $ref: /schemas/net/ethernet-controller.yaml#
> > +$ref: /schemas/net/ethernet-switch-port.yaml#
> >
> > properties:
> > reg:
> > @@ -58,25 +57,6 @@ properties:
> > - rtl8_4t
> > - seville
> >
> > - phy-handle: true
> > -
> > - phy-mode: true
> > -
> > - fixed-link: true
> > -
> > - mac-address: true
> > -
> > - sfp: true
> > -
> > - managed: true
> > -
> > - rx-internal-delay-ps: true
> > -
> > - tx-internal-delay-ps: true
> > -
> > -required:
> > - - reg
> > -
> > # CPU and DSA ports must have phylink-compatible link descriptions
> > if:
> > oneOf:
> > diff --git a/Documentation/devicetree/bindings/net/ethernet-switch-port.yaml b/Documentation/devicetree/bindings/net/ethernet-switch-port.yaml
> > new file mode 100644
> > index 000000000000..3d7da6916fb8
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/net/ethernet-switch-port.yaml
> > @@ -0,0 +1,25 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/net/ethernet-switch-port.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Generic Ethernet Switch port
> > +
> > +maintainers:
> > + - Andrew Lunn <[email protected]>
> > + - Florian Fainelli <[email protected]>
> > + - Vivien Didelot <[email protected]>
> > +
> > +description:
> > + Ethernet switch port Description
>
> Sounds a bit too "lorem ipsum dolor sit amet". You can say that a port
> is a component of a switch which manages one MAC, and can pass Ethernet
> frames.

Good suggestion again. Happy to change this as well. I'm planning to
send an update late tomorrow (Wednesday) to give a couple days before
Sunday. Hopefully that's enough time for any suggestions on these last
couple issues.

2022-12-07 04:04:04

by Colin Foster

[permalink] [raw]
Subject: Re: [PATCH v4 net-next 0/9] dt-binding preparation for ocelot switches

On Tue, Dec 06, 2022 at 06:04:30PM +0200, Vladimir Oltean wrote:
> Hi Colin,
>
> On Fri, Dec 02, 2022 at 12:45:50PM -0800, Colin Foster wrote:
> > 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).
> >
> > ---
>
> This looks like a very clean implementation of what I had in mind
> (better than I could have done it). Sorry for not being able to help
> with the json-schema bits and thanks to Rob for doing so.

It seems like it worked out well. Thanks Rob for all the help on this!

>
> Would you mind adding one more patch at the beginning of the series
> which syncs the maintainers from the DSA (and now also ethernet-switch)
> dt-bindings with the MAINTAINERS file? That would mean removing Vivien
> (see commit 6ce3df596be2 ("MAINTAINERS: Move Vivien to CREDITS")) and
> adding myself. This is in principle such that you don't carry around a
> not-up-to-date list of maintainers when adding new schemas.

Yep. I'll get that in the next set.

>
> I don't know if we could do something about maintainer entries in
> schemas not becoming out of date w.r.t. the MAINTAINERS file.

Sounds like a nice feature. Maybe part of dt_binding_check / checkpatch?
I'm running out of hours in a day...

2022-12-09 09:42:43

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v4 net-next 3/9] dt-bindings: net: dsa: utilize base definitions for standard dsa switches

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