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).
---
v4 -> v5
* Sync DSA maintainers with MAINTAINERS file (new patch 1)
* Undo move of port description of mediatek,mt7530.yaml (patch 4)
* Move removal of "^(ethernet-)?switch(@.*)?$" in dsa.yaml from patch 4
to patch 8
* Add more consistent capitalization in title lines and better Ethernet
switch port description. (patch 8)
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 (10):
dt-bindings: dsa: sync with maintainers
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 | 29 ++-------
.../devicetree/bindings/net/dsa/dsa.yaml | 49 +++++++--------
.../net/dsa/hirschmann,hellcreek.yaml | 2 +-
.../bindings/net/dsa/mediatek,mt7530.yaml | 6 +-
.../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, 143 insertions(+), 108 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
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 <[email protected]>
Signed-off-by: Colin Foster <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
Reviewed-by: Florian Fainelli <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
Acked-by: Alvin Šipraga <[email protected]> # realtek
Acked-by: Arınç ÜNAL <[email protected]>
---
v4 -> v5
* Add Rob Reviewed, Arınç Acked
* Defer the removal of "^(ethernet-)?switch(@.*)?$" in dsa.yaml until a
later patch
* Undo the move of ethernet switch ports description in mediatek,mt7530.yaml
* Fix typos in commit message
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 | 22 +++++++++++++++++++
.../net/dsa/hirschmann,hellcreek.yaml | 2 +-
.../bindings/net/dsa/mediatek,mt7530.yaml | 5 +----
.../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, 32 insertions(+), 13 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 5efc0ee8edcb..9375cdcfbf96 100644
--- a/Documentation/devicetree/bindings/net/dsa/dsa.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
@@ -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
+
...
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..20312f5d1944 100644
--- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
@@ -157,9 +157,6 @@ patternProperties:
patternProperties:
"^(ethernet-)?port@[0-9]+$":
type: object
- description: Ethernet switch ports
-
- unevaluatedProperties: false
properties:
reg:
@@ -238,7 +235,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
On 10.12.2022 06:30, 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
> 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 <[email protected]>
> Signed-off-by: Colin Foster <[email protected]>
> Reviewed-by: Linus Walleij <[email protected]>
> Reviewed-by: Florian Fainelli <[email protected]>
> Reviewed-by: Rob Herring <[email protected]>
> Acked-by: Alvin Šipraga <[email protected]> # realtek
> Acked-by: Arınç ÜNAL <[email protected]>
> ---
>
> v4 -> v5
> * Add Rob Reviewed, Arınç Acked
> * Defer the removal of "^(ethernet-)?switch(@.*)?$" in dsa.yaml until a
> later patch
> * Undo the move of ethernet switch ports description in mediatek,mt7530.yaml
> * Fix typos in commit message
>
> 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 | 22 +++++++++++++++++++
> .../net/dsa/hirschmann,hellcreek.yaml | 2 +-
> .../bindings/net/dsa/mediatek,mt7530.yaml | 5 +----
> .../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, 32 insertions(+), 13 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 5efc0ee8edcb..9375cdcfbf96 100644
> --- a/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> @@ -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
I've got moderate experience in json-schema but shouldn't you put 'type:
object' here like you did for "^(ethernet-)?ports$"?
> +
> ...
> 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..20312f5d1944 100644
> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> @@ -157,9 +157,6 @@ patternProperties:
> patternProperties:
> "^(ethernet-)?port@[0-9]+$":
> type: object
This line was being removed on the previous version. Must be related to
above.
> - description: Ethernet switch ports
> -
> - unevaluatedProperties: false
>
> properties:
> reg:
Arınç
Hi Arınç,
On Sat, Dec 10, 2022 at 07:24:42PM +0300, Arınç ÜNAL wrote:
> On 10.12.2022 06:30, Colin Foster wrote:
> > DSA a/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> > +++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> > @@ -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
>
> I've got moderate experience in json-schema but shouldn't you put 'type:
> object' here like you did for "^(ethernet-)?ports$"?
I can't say for sure, but adding "type: object" here and removing it
from mediatek,mt7530.yaml still causes the same issue I mention below.
Rob's initial suggestion for this patch set (which was basically the
entire implementation... many thanks again Rob) can be found here:
https://lore.kernel.org/netdev/[email protected]/
From what I can tell, the omission of "type: object" here was
intentional. At the very least, it doesn't seem to have any effect on
warnings.
>
> > +
> > ...
> > 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..20312f5d1944 100644
> > --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> > +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> > @@ -157,9 +157,6 @@ patternProperties:
> > patternProperties:
> > "^(ethernet-)?port@[0-9]+$":
> > type: object
>
> This line was being removed on the previous version. Must be related to
> above.
Without the 'object' type here, I get the following warning:
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml: patternProperties:^(ethernet-)?ports$:patternProperties:^(ethernet-)?port@[0-9]+$: 'anyOf' conditional failed, one must be fixed:
'type' is a required property
'$ref' is a required property
hint: node schemas must have a type or $ref
from schema $id: http://devicetree.org/meta-schemas/core.yaml#
./Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml: Error in referenced schema matching $id: http://devicetree.org/schemas/net/dsa/mediatek,mt7530.yaml
SCHEMA Documentation/devicetree/bindings/processed-schema.json
/home/colin/src/work/linux_vsc/linux-imx/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml: ignoring, error in schema: patternProperties: ^(ethernet-)?ports$: patternProperties: ^(ethernet-)?port@[0-9]+$
I'm testing this now and I'm noticing something is going on with the
"ref: dsa-port.yaml"
Everything seems to work fine (in that I don't see any warnings) when I
have this diff:
diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
index 20312f5d1944..db0122020f98 100644
--- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yam
@@ -156,8 +156,7 @@ patternProperties:
patternProperties:
"^(ethernet-)?port@[0-9]+$":
- type: object
-
+ $ref: dsa-port.yaml#
properties:
reg:
description:
@@ -165,7 +164,6 @@ patternProperties:
for user ports.
allOf:
- - $ref: dsa-port.yaml#
- if:
required: [ ethernet ]
then:
This one has me [still] scratching my head...
>
> > - description: Ethernet switch ports
> > -
> > - unevaluatedProperties: false
> > properties:
> > reg:
>
> Arınç
On 10.12.2022 21:02, Colin Foster wrote:
> Hi Arınç,
> On Sat, Dec 10, 2022 at 07:24:42PM +0300, Arınç ÜNAL wrote:
>> On 10.12.2022 06:30, Colin Foster wrote:
>>> DSA a/Documentation/devicetree/bindings/net/dsa/dsa.yaml
>>> +++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
>>> @@ -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
>>
>> I've got moderate experience in json-schema but shouldn't you put 'type:
>> object' here like you did for "^(ethernet-)?ports$"?
>
> I can't say for sure, but adding "type: object" here and removing it
> from mediatek,mt7530.yaml still causes the same issue I mention below.
>
> Rob's initial suggestion for this patch set (which was basically the
> entire implementation... many thanks again Rob) can be found here:
> https://lore.kernel.org/netdev/[email protected]/
>
> From what I can tell, the omission of "type: object" here was
> intentional. At the very least, it doesn't seem to have any effect on
> warnings.
>
>>
>>> +
>>> ...
>>> 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..20312f5d1944 100644
>>> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>>> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
>>> @@ -157,9 +157,6 @@ patternProperties:
>>> patternProperties:
>>> "^(ethernet-)?port@[0-9]+$":
>>> type: object
>>
>> This line was being removed on the previous version. Must be related to
>> above.
>
> Without the 'object' type here, I get the following warning:
>
> Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml: patternProperties:^(ethernet-)?ports$:patternProperties:^(ethernet-)?port@[0-9]+$: 'anyOf' conditional failed, one must be fixed:
> 'type' is a required property
> '$ref' is a required property
> hint: node schemas must have a type or $ref
> from schema $id: http://devicetree.org/meta-schemas/core.yaml#
> ./Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml: Error in referenced schema matching $id: http://devicetree.org/schemas/net/dsa/mediatek,mt7530.yaml
> SCHEMA Documentation/devicetree/bindings/processed-schema.json
> /home/colin/src/work/linux_vsc/linux-imx/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml: ignoring, error in schema: patternProperties: ^(ethernet-)?ports$: patternProperties: ^(ethernet-)?port@[0-9]+$
>
>
> I'm testing this now and I'm noticing something is going on with the
> "ref: dsa-port.yaml"
>
>
> Everything seems to work fine (in that I don't see any warnings) when I
> have this diff:
>
>
> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> index 20312f5d1944..db0122020f98 100644
> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yam
> @@ -156,8 +156,7 @@ patternProperties:
>
> patternProperties:
> "^(ethernet-)?port@[0-9]+$":
> - type: object
> -
> + $ref: dsa-port.yaml#
> properties:
> reg:
> description:
> @@ -165,7 +164,6 @@ patternProperties:
> for user ports.
>
> allOf:
> - - $ref: dsa-port.yaml#
> - if:
> required: [ ethernet ]
> then:
>
>
>
> This one has me [still] scratching my head...
Right there with you. In addition to this, having or deleting type
object on/from "^(ethernet-)?ports$" and "^(ethernet-)?port@[0-9]+$" on
dsa.yaml doesn't cause any warnings (checked with make dt_binding_check
DT_SCHEMA_FILES=net/dsa) which makes me question why it's there in the
first place.
Arınç
On Mon, Dec 12, 2022 at 12:28:06PM +0300, Arınç ÜNAL wrote:
> On 10.12.2022 21:02, Colin Foster wrote:
> > Hi Arınç,
> > On Sat, Dec 10, 2022 at 07:24:42PM +0300, Arınç ÜNAL wrote:
> > > On 10.12.2022 06:30, Colin Foster wrote:
> > > > DSA a/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> > > > +++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> > > > @@ -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
> > >
> > > I've got moderate experience in json-schema but shouldn't you put 'type:
> > > object' here like you did for "^(ethernet-)?ports$"?
> >
> > I can't say for sure, but adding "type: object" here and removing it
> > from mediatek,mt7530.yaml still causes the same issue I mention below.
> >
> > Rob's initial suggestion for this patch set (which was basically the
> > entire implementation... many thanks again Rob) can be found here:
> > https://lore.kernel.org/netdev/[email protected]/
> >
> > From what I can tell, the omission of "type: object" here was
> > intentional. At the very least, it doesn't seem to have any effect on
> > warnings.
> >
> > >
> > > > +
> > > > ...
> > > > 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..20312f5d1944 100644
> > > > --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> > > > +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> > > > @@ -157,9 +157,6 @@ patternProperties:
> > > > patternProperties:
> > > > "^(ethernet-)?port@[0-9]+$":
> > > > type: object
> > >
> > > This line was being removed on the previous version. Must be related to
> > > above.
> >
> > Without the 'object' type here, I get the following warning:
> >
> > Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml: patternProperties:^(ethernet-)?ports$:patternProperties:^(ethernet-)?port@[0-9]+$: 'anyOf' conditional failed, one must be fixed:
> > 'type' is a required property
> > '$ref' is a required property
> > hint: node schemas must have a type or $ref
> > from schema $id: http://devicetree.org/meta-schemas/core.yaml#
> > ./Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml: Error in referenced schema matching $id: http://devicetree.org/schemas/net/dsa/mediatek,mt7530.yaml
> > SCHEMA Documentation/devicetree/bindings/processed-schema.json
> > /home/colin/src/work/linux_vsc/linux-imx/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml: ignoring, error in schema: patternProperties: ^(ethernet-)?ports$: patternProperties: ^(ethernet-)?port@[0-9]+$
Is the above warning not clear? We require either 'type' or a $ref to
define nodes as json-schema objects.
> > I'm testing this now and I'm noticing something is going on with the
> > "ref: dsa-port.yaml"
> >
> >
> > Everything seems to work fine (in that I don't see any warnings) when I
> > have this diff:
> >
> >
> > diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> > index 20312f5d1944..db0122020f98 100644
> > --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> > +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yam
> > @@ -156,8 +156,7 @@ patternProperties:
> >
> > patternProperties:
> > "^(ethernet-)?port@[0-9]+$":
> > - type: object
> > -
> > + $ref: dsa-port.yaml#
> > properties:
> > reg:
> > description:
> > @@ -165,7 +164,6 @@ patternProperties:
> > for user ports.
> >
> > allOf:
> > - - $ref: dsa-port.yaml#
> > - if:
> > required: [ ethernet ]
> > then:
> >
> >
> >
> > This one has me [still] scratching my head...
>
> Right there with you. In addition to this, having or deleting type object
> on/from "^(ethernet-)?ports$" and "^(ethernet-)?port@[0-9]+$" on dsa.yaml
> doesn't cause any warnings (checked with make dt_binding_check
> DT_SCHEMA_FILES=net/dsa) which makes me question why it's there in the first
> place.
That check probably doesn't consider an ref being under an 'allOf'.
Perhaps what is missing in understanding is every schema at the
top-level has an implicit 'type: object'. But nothing is ever implicit
in json-schema which will silently ignore keywords which don't make
sense for an instance type. Instead of a bunch of boilerplate, the
processed schema has 'type' added in lots of cases such as this one.
Rob
On Fri, 9 Dec 2022 19:30:23 -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).
A lot of carried over review tags here, so please let me know if
there's anything that needs to be reviewed here, otherwise I'd like
to merge the series for 6.2 by the end of the day.
On Fri, Dec 09, 2022 at 07:30:27PM -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
> 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 <[email protected]>
> Signed-off-by: Colin Foster <[email protected]>
> Reviewed-by: Linus Walleij <[email protected]>
> Reviewed-by: Florian Fainelli <[email protected]>
> Reviewed-by: Rob Herring <[email protected]>
> Acked-by: Alvin Šipraga <[email protected]> # realtek
> Acked-by: Arınç ÜNAL <[email protected]>
> ---
Reviewed-by: Vladimir Oltean <[email protected]>
Hi Rob, Arınç,
On Mon, Dec 12, 2022 at 10:51:47AM -0600, Rob Herring wrote:
> On Mon, Dec 12, 2022 at 12:28:06PM +0300, Arınç ÜNAL wrote:
> > On 10.12.2022 21:02, Colin Foster wrote:
> > > Hi Arınç,
> > > On Sat, Dec 10, 2022 at 07:24:42PM +0300, Arınç ÜNAL wrote:
> > > > On 10.12.2022 06:30, Colin Foster wrote:
> > > --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> > > +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yam
> > > @@ -156,8 +156,7 @@ patternProperties:
> > >
> > > patternProperties:
> > > "^(ethernet-)?port@[0-9]+$":
> > > - type: object
> > > -
> > > + $ref: dsa-port.yaml#
> > > properties:
> > > reg:
> > > description:
> > > @@ -165,7 +164,6 @@ patternProperties:
> > > for user ports.
> > >
> > > allOf:
> > > - - $ref: dsa-port.yaml#
> > > - if:
> > > required: [ ethernet ]
> > > then:
> > >
> > >
> > >
> > > This one has me [still] scratching my head...
> >
> > Right there with you. In addition to this, having or deleting type object
> > on/from "^(ethernet-)?ports$" and "^(ethernet-)?port@[0-9]+$" on dsa.yaml
> > doesn't cause any warnings (checked with make dt_binding_check
> > DT_SCHEMA_FILES=net/dsa) which makes me question why it's there in the first
> > place.
>
>
> That check probably doesn't consider an ref being under an 'allOf'.
> Perhaps what is missing in understanding is every schema at the
> top-level has an implicit 'type: object'. But nothing is ever implicit
> in json-schema which will silently ignore keywords which don't make
> sense for an instance type. Instead of a bunch of boilerplate, the
> processed schema has 'type' added in lots of cases such as this one.
>
> Rob
What do you suggest on this set? I think this is the only outstanding
issue, and Jakub brought up the possibility of applying end of today
(maybe 5-6 hours from now in the US).
It seems like there's an issue with the dt_bindings_check that causes
the "allOf: $ref" to throw a warning when it shouldn't. So removing the
"type: object" was supposed to be correct, but throws warnings.
It seems like keeping this patch as-is and updating it when the check
gets fixed might be an acceptable path, but I'd understand if you
disagree and prefer a resubmission.
On Mon, Dec 12, 2022 at 10:29:58AM -0800, Jakub Kicinski wrote:
> On Fri, 9 Dec 2022 19:30:23 -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).
>
> A lot of carried over review tags here, so please let me know if
> there's anything that needs to be reviewed here, otherwise I'd like
> to merge the series for 6.2 by the end of the day.
I just responded to patch 4, which has a small (?) outstanding issue /
discussion. I asked Rob and Arınç's opinions as to whether it should
hold up this series. Everything else is good to go, as far as I
understand.
On Mon, 12 Dec 2022 11:03:09 -0800 Colin Foster wrote:
> > A lot of carried over review tags here, so please let me know if
> > there's anything that needs to be reviewed here, otherwise I'd like
> > to merge the series for 6.2 by the end of the day.
>
> I just responded to patch 4, which has a small (?) outstanding issue /
> discussion. I asked Rob and Arınç's opinions as to whether it should
> hold up this series. Everything else is good to go, as far as I
> understand.
No reply :( Since this is "just" DT bindings (as in shouldn't
functionally break anything) - if Rob gives us a green light
we can still pull it into the mid-merge window follow up.
But I'll drop it from pw for now so it doesn't distract us.
On Mon, Dec 12, 2022 at 10:55:19AM -0800, Colin Foster wrote:
> Hi Rob, Arınç,
>
> On Mon, Dec 12, 2022 at 10:51:47AM -0600, Rob Herring wrote:
> > On Mon, Dec 12, 2022 at 12:28:06PM +0300, Arınç ÜNAL wrote:
> > > On 10.12.2022 21:02, Colin Foster wrote:
> > > > Hi Arınç,
> > > > On Sat, Dec 10, 2022 at 07:24:42PM +0300, Arınç ÜNAL wrote:
> > > > > On 10.12.2022 06:30, Colin Foster wrote:
> > > > --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> > > > +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yam
> > > > @@ -156,8 +156,7 @@ patternProperties:
> > > >
> > > > patternProperties:
> > > > "^(ethernet-)?port@[0-9]+$":
> > > > - type: object
> > > > -
> > > > + $ref: dsa-port.yaml#
> > > > properties:
> > > > reg:
> > > > description:
> > > > @@ -165,7 +164,6 @@ patternProperties:
> > > > for user ports.
> > > >
> > > > allOf:
> > > > - - $ref: dsa-port.yaml#
> > > > - if:
> > > > required: [ ethernet ]
> > > > then:
> > > >
> > > >
> > > >
> > > > This one has me [still] scratching my head...
> > >
> > > Right there with you. In addition to this, having or deleting type object
> > > on/from "^(ethernet-)?ports$" and "^(ethernet-)?port@[0-9]+$" on dsa.yaml
> > > doesn't cause any warnings (checked with make dt_binding_check
> > > DT_SCHEMA_FILES=net/dsa) which makes me question why it's there in the first
> > > place.
> >
> >
> > That check probably doesn't consider an ref being under an 'allOf'.
> > Perhaps what is missing in understanding is every schema at the
> > top-level has an implicit 'type: object'. But nothing is ever implicit
> > in json-schema which will silently ignore keywords which don't make
> > sense for an instance type. Instead of a bunch of boilerplate, the
> > processed schema has 'type' added in lots of cases such as this one.
> >
> > Rob
>
> What do you suggest on this set? I think this is the only outstanding
> issue, and Jakub brought up the possibility of applying end of today
> (maybe 5-6 hours from now in the US).
>
> It seems like there's an issue with the dt_bindings_check that causes
> the "allOf: $ref" to throw a warning when it shouldn't. So removing the
> "type: object" was supposed to be correct, but throws warnings.
>
> It seems like keeping this patch as-is and updating it when the check
> gets fixed might be an acceptable path, but I'd understand if you
> disagree and prefer a resubmission.
Heads up on my plan for this. I plan to re-submit this on Monday after
the merge window with the change where I move the $ref: dsa-port.yaml#
to outside the allOf: section, and remove the object type as the above
code suggests. Hopefully that's the right step to take.
On Thu, 22 Dec 2022 12:08:30 -0800 Colin Foster wrote:
> Heads up on my plan for this. I plan to re-submit this on Monday after
> the merge window with the change where I move the $ref: dsa-port.yaml#
> to outside the allOf: section, and remove the object type as the above
> code suggests. Hopefully that's the right step to take.
FWIW in case you mean Mon, Dec 26th and net-next -- we extended
the period of net-next being closed until Jan:
https://lore.kernel.org/all/[email protected]/