This is a series of clean-ups related to ensuring that child node
schemas are constrained to not allow undefined properties. Typically,
that means just adding additionalProperties or unevaluatedProperties as
appropriate. The DSA/switch schemas turned out to be a bit more
involved, so there's some more fixes and a bit of restructuring in them.
Signed-off-by: Rob Herring <[email protected]>
---
Rob Herring (8):
dt-bindings: net: Add missing (unevaluated|additional)Properties on child node schemas
dt-bindings: net: renesas: Drop ethernet-phy node schema
dt-bindings: net: dsa/switch: Make 'ethernet-port' node addresses hex
dt-bindings: net: ethernet-switch: Add missing 'ethernet-ports' level
dt-bindings: net: ethernet-switch: Rename $defs "base" to 'ethernet-ports'
dt-bindings: net: mscc,vsc7514-switch: Clean-up example indentation
dt-bindings: net: mscc,vsc7514-switch: Simplify DSA and switch references
dt-bindings: net: dsa: Drop 'ethernet-ports' node properties
.../bindings/net/allwinner,sun8i-a83t-emac.yaml | 2 +
.../devicetree/bindings/net/brcm,asp-v2.0.yaml | 2 +-
.../devicetree/bindings/net/dsa/brcm,sf2.yaml | 1 +
Documentation/devicetree/bindings/net/dsa/dsa.yaml | 11 +-----
.../bindings/net/dsa/mediatek,mt7530.yaml | 8 ++--
.../bindings/net/dsa/microchip,lan937x.yaml | 3 +-
.../devicetree/bindings/net/dsa/nxp,sja1105.yaml | 4 +-
.../devicetree/bindings/net/dsa/qca8k.yaml | 1 +
.../devicetree/bindings/net/dsa/realtek.yaml | 2 +
.../bindings/net/dsa/renesas,rzn1-a5psw.yaml | 10 +----
.../devicetree/bindings/net/engleder,tsnep.yaml | 1 +
.../devicetree/bindings/net/ethernet-switch.yaml | 14 ++++---
.../bindings/net/mscc,vsc7514-switch.yaml | 46 +++++++++-------------
.../devicetree/bindings/net/nxp,tja11xx.yaml | 1 +
.../devicetree/bindings/net/renesas,ether.yaml | 3 +-
.../devicetree/bindings/net/renesas,etheravb.yaml | 3 +-
.../devicetree/bindings/net/ti,cpsw-switch.yaml | 2 +-
17 files changed, 51 insertions(+), 63 deletions(-)
---
base-commit: 4d0515b235dec789578d135a5db586b25c5870cb
change-id: 20231016-dt-net-cleanups-ba3238b4ca98
Best regards,
--
Rob Herring <[email protected]>
The mscc,vsc7514-switch schema doesn't add any custom port properties,
so it can just reference ethernet-switch.yaml#/$defs/base and
dsa.yaml#/$defs/ethernet-ports instead of the base file and can skip
defining port nodes.
Signed-off-by: Rob Herring <[email protected]>
---
.../devicetree/bindings/net/mscc,vsc7514-switch.yaml | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml b/Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml
index 07de52a3a295..86a9c3fc76c8 100644
--- a/Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml
+++ b/Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml
@@ -24,7 +24,7 @@ allOf:
compatible:
const: mscc,vsc7514-switch
then:
- $ref: ethernet-switch.yaml#
+ $ref: ethernet-switch.yaml#/$defs/ethernet-ports
required:
- interrupts
- interrupt-names
@@ -33,28 +33,18 @@ allOf:
minItems: 21
reg-names:
minItems: 21
- ethernet-ports:
- patternProperties:
- "^port@[0-9a-f]+$":
- $ref: ethernet-switch-port.yaml#
- unevaluatedProperties: false
- if:
properties:
compatible:
const: mscc,vsc7512-switch
then:
- $ref: /schemas/net/dsa/dsa.yaml#
+ $ref: /schemas/net/dsa/dsa.yaml#/$defs/ethernet-ports
properties:
reg:
maxItems: 20
reg-names:
maxItems: 20
- ethernet-ports:
- patternProperties:
- "^port@[0-9a-f]+$":
- $ref: /schemas/net/dsa/dsa-port.yaml#
- unevaluatedProperties: false
properties:
compatible:
--
2.42.0
'ethernet-port' node unit-addresses should be in hexadecimal. Some
instances have it correct, but fix the ones that don't.
Signed-off-by: Rob Herring <[email protected]>
---
Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml | 2 +-
Documentation/devicetree/bindings/net/dsa/dsa.yaml | 2 +-
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml | 6 +++---
Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml | 2 +-
Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml | 2 +-
Documentation/devicetree/bindings/net/ethernet-switch.yaml | 4 ++--
Documentation/devicetree/bindings/net/ti,cpsw-switch.yaml | 2 +-
7 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml b/Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml
index aa3162c74833..75d8138298fb 100644
--- a/Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml
+++ b/Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml
@@ -53,7 +53,7 @@ properties:
const: 0
patternProperties:
- "^port@[0-9]+$":
+ "^port@[0-9a-f]+$":
type: object
$ref: ethernet-controller.yaml#
diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.yaml b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
index ec74a660beda..e6010821f86f 100644
--- a/Documentation/devicetree/bindings/net/dsa/dsa.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
@@ -50,7 +50,7 @@ $defs:
const: 0
patternProperties:
- "^(ethernet-)?port@[0-9]+$":
+ "^(ethernet-)?port@[0-9a-f]+$":
description: Ethernet switch ports
$ref: dsa-port.yaml#
unevaluatedProperties: false
diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
index 20f7ba4e2203..5038818e9f2e 100644
--- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
@@ -157,7 +157,7 @@ patternProperties:
additionalProperties: true
patternProperties:
- "^(ethernet-)?port@[0-9]+$":
+ "^(ethernet-)?port@[0-6]$":
type: object
additionalProperties: true
@@ -186,7 +186,7 @@ $defs:
patternProperties:
"^(ethernet-)?ports$":
patternProperties:
- "^(ethernet-)?port@[0-9]+$":
+ "^(ethernet-)?port@[0-6]$":
if:
required: [ ethernet ]
then:
@@ -212,7 +212,7 @@ $defs:
patternProperties:
"^(ethernet-)?ports$":
patternProperties:
- "^(ethernet-)?port@[0-9]+$":
+ "^(ethernet-)?port@[0-6]$":
if:
required: [ ethernet ]
then:
diff --git a/Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml b/Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml
index 6a4d90d550b6..9973d64f15a7 100644
--- a/Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml
@@ -39,7 +39,7 @@ patternProperties:
"^(ethernet-)?ports$":
additionalProperties: true
patternProperties:
- "^(ethernet-)?port@[0-9]+$":
+ "^(ethernet-)?port@[0-7]$":
allOf:
- if:
properties:
diff --git a/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml b/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml
index d179c6971193..9432565f4f5d 100644
--- a/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml
@@ -77,7 +77,7 @@ patternProperties:
"^(ethernet-)?ports$":
additionalProperties: true
patternProperties:
- "^(ethernet-)?port@[0-9]+$":
+ "^(ethernet-)?port@[0-9]$":
allOf:
- if:
properties:
diff --git a/Documentation/devicetree/bindings/net/ethernet-switch.yaml b/Documentation/devicetree/bindings/net/ethernet-switch.yaml
index f1b9075dc7fb..dcbffe19d71a 100644
--- a/Documentation/devicetree/bindings/net/ethernet-switch.yaml
+++ b/Documentation/devicetree/bindings/net/ethernet-switch.yaml
@@ -36,7 +36,7 @@ patternProperties:
const: 0
patternProperties:
- "^(ethernet-)?port@[0-9]+$":
+ "^(ethernet-)?port@[0-9a-f]+$":
type: object
description: Ethernet switch ports
@@ -58,7 +58,7 @@ $defs:
$ref: '#'
patternProperties:
- "^(ethernet-)?port@[0-9]+$":
+ "^(ethernet-)?port@[0-9a-f]+$":
description: Ethernet switch ports
$ref: ethernet-switch-port.yaml#
unevaluatedProperties: false
diff --git a/Documentation/devicetree/bindings/net/ti,cpsw-switch.yaml b/Documentation/devicetree/bindings/net/ti,cpsw-switch.yaml
index b04ac4966608..f07ae3173b03 100644
--- a/Documentation/devicetree/bindings/net/ti,cpsw-switch.yaml
+++ b/Documentation/devicetree/bindings/net/ti,cpsw-switch.yaml
@@ -86,7 +86,7 @@ properties:
const: 0
patternProperties:
- "^port@[0-9]+$":
+ "^port@[12]$":
type: object
description: CPSW external ports
--
2.42.0
The '$defs/ethernet-ports' schema is referenced by schemas defining a
child node 'ethernet-ports', but this schema misses the
'ethernet-ports' node. It would work if referring schemas made a
reference like this:
properties:
ethernet-ports:
$ref: ethernet-switch.yaml#/$defs/ethernet-ports
However, that would be different from how dsa.yaml works. For
consistency, align the schema definition with dsa.yaml and add the
missing level.
Signed-off-by: Rob Herring <[email protected]>
---
Documentation/devicetree/bindings/net/ethernet-switch.yaml | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/ethernet-switch.yaml b/Documentation/devicetree/bindings/net/ethernet-switch.yaml
index dcbffe19d71a..688938c2e261 100644
--- a/Documentation/devicetree/bindings/net/ethernet-switch.yaml
+++ b/Documentation/devicetree/bindings/net/ethernet-switch.yaml
@@ -58,9 +58,11 @@ $defs:
$ref: '#'
patternProperties:
- "^(ethernet-)?port@[0-9a-f]+$":
- description: Ethernet switch ports
- $ref: ethernet-switch-port.yaml#
- unevaluatedProperties: false
+ "^(ethernet-)?ports$":
+ patternProperties:
+ "^(ethernet-)?port@[0-9a-f]+$":
+ description: Ethernet switch ports
+ $ref: ethernet-switch-port.yaml#
+ unevaluatedProperties: false
...
--
2.42.0
Constraints on 'ethernet-ports' node properties are already defined by the
reference to ethernet-switch.yaml, so they can be dropped from the DSA
schema.
Signed-off-by: Rob Herring <[email protected]>
---
Documentation/devicetree/bindings/net/dsa/dsa.yaml | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.yaml b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
index e6010821f86f..6107189d276a 100644
--- a/Documentation/devicetree/bindings/net/dsa/dsa.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
@@ -40,15 +40,6 @@ $defs:
patternProperties:
"^(ethernet-)?ports$":
- type: object
- additionalProperties: false
-
- properties:
- '#address-cells':
- const: 1
- '#size-cells':
- const: 0
-
patternProperties:
"^(ethernet-)?port@[0-9a-f]+$":
description: Ethernet switch ports
--
2.42.0
Just as unevaluatedProperties or additionalProperties are required at
the top level of schemas, they should (and will) also be required for
child node schemas. That ensures only documented properties are
present for any node.
Add unevaluatedProperties or additionalProperties as appropriate.
Signed-off-by: Rob Herring <[email protected]>
---
.../devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml | 2 ++
Documentation/devicetree/bindings/net/dsa/brcm,sf2.yaml | 1 +
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml | 2 ++
.../devicetree/bindings/net/dsa/microchip,lan937x.yaml | 1 +
Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml | 2 ++
Documentation/devicetree/bindings/net/dsa/qca8k.yaml | 1 +
Documentation/devicetree/bindings/net/dsa/realtek.yaml | 2 ++
.../devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml | 10 ++--------
Documentation/devicetree/bindings/net/engleder,tsnep.yaml | 1 +
Documentation/devicetree/bindings/net/nxp,tja11xx.yaml | 1 +
10 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml b/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml
index 4bfac9186886..7fe0352dff0f 100644
--- a/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml
+++ b/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml
@@ -158,6 +158,8 @@ allOf:
patternProperties:
"^ethernet-phy@[0-9a-f]$":
type: object
+ $ref: ethernet-phy.yaml#
+ unevaluatedProperties: false
description:
Integrated PHY node
diff --git a/Documentation/devicetree/bindings/net/dsa/brcm,sf2.yaml b/Documentation/devicetree/bindings/net/dsa/brcm,sf2.yaml
index b06c416893ff..f21bdd0f408d 100644
--- a/Documentation/devicetree/bindings/net/dsa/brcm,sf2.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/brcm,sf2.yaml
@@ -78,6 +78,7 @@ properties:
ports:
type: object
+ additionalProperties: true
patternProperties:
'^port@[0-9a-f]$':
diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
index e532c6b795f4..20f7ba4e2203 100644
--- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
@@ -154,10 +154,12 @@ properties:
patternProperties:
"^(ethernet-)?ports$":
type: object
+ additionalProperties: true
patternProperties:
"^(ethernet-)?port@[0-9]+$":
type: object
+ additionalProperties: true
properties:
reg:
diff --git a/Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml b/Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml
index 8d7e878b84dc..6a4d90d550b6 100644
--- a/Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml
@@ -37,6 +37,7 @@ properties:
patternProperties:
"^(ethernet-)?ports$":
+ additionalProperties: true
patternProperties:
"^(ethernet-)?port@[0-9]+$":
allOf:
diff --git a/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml b/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml
index 4d5f5cc6d031..d179c6971193 100644
--- a/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml
@@ -43,6 +43,7 @@ properties:
# PHY 1.
mdios:
type: object
+ additionalProperties: false
properties:
'#address-cells':
@@ -74,6 +75,7 @@ properties:
patternProperties:
"^(ethernet-)?ports$":
+ additionalProperties: true
patternProperties:
"^(ethernet-)?port@[0-9]+$":
allOf:
diff --git a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
index df64eebebe18..167398ab253a 100644
--- a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml
@@ -73,6 +73,7 @@ $ref: dsa.yaml#
patternProperties:
"^(ethernet-)?ports$":
type: object
+ additionalProperties: true
patternProperties:
"^(ethernet-)?port@[0-6]$":
type: object
diff --git a/Documentation/devicetree/bindings/net/dsa/realtek.yaml b/Documentation/devicetree/bindings/net/dsa/realtek.yaml
index cfd69c2604ea..cce692f57b08 100644
--- a/Documentation/devicetree/bindings/net/dsa/realtek.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/realtek.yaml
@@ -68,6 +68,8 @@ properties:
interrupt-controller:
type: object
+ additionalProperties: false
+
description: |
This defines an interrupt controller with an IRQ line (typically
a GPIO) that will demultiplex and handle the interrupt from the single
diff --git a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
index 833d2f68daa1..ea285ef3e64f 100644
--- a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
@@ -61,17 +61,11 @@ properties:
ethernet-ports:
type: object
- properties:
- '#address-cells':
- const: 1
- '#size-cells':
- const: 0
-
+ additionalProperties: true
patternProperties:
"^(ethernet-)?port@[0-4]$":
type: object
- description: Ethernet switch ports
-
+ additionalProperties: true
properties:
pcs-handle:
maxItems: 1
diff --git a/Documentation/devicetree/bindings/net/engleder,tsnep.yaml b/Documentation/devicetree/bindings/net/engleder,tsnep.yaml
index 82a5d7927ca4..34fd24ff6a71 100644
--- a/Documentation/devicetree/bindings/net/engleder,tsnep.yaml
+++ b/Documentation/devicetree/bindings/net/engleder,tsnep.yaml
@@ -63,6 +63,7 @@ properties:
mdio:
type: object
$ref: mdio.yaml#
+ unevaluatedProperties: false
description: optional node for embedded MDIO controller
required:
diff --git a/Documentation/devicetree/bindings/net/nxp,tja11xx.yaml b/Documentation/devicetree/bindings/net/nxp,tja11xx.yaml
index ab8867e6939b..85bfa45f5122 100644
--- a/Documentation/devicetree/bindings/net/nxp,tja11xx.yaml
+++ b/Documentation/devicetree/bindings/net/nxp,tja11xx.yaml
@@ -20,6 +20,7 @@ allOf:
patternProperties:
"^ethernet-phy@[0-9a-f]+$":
type: object
+ additionalProperties: false
description: |
Some packages have multiple PHYs. Secondary PHY should be defines as
subnode of the first (parent) PHY.
--
2.42.0
What's connected on the MDIO bus is outside the scope of the binding for
ethernet controller's MDIO bus unless it's a fixed internal device, so
drop the node name and reference to ethernet-phy.yaml.
Signed-off-by: Rob Herring <[email protected]>
---
Documentation/devicetree/bindings/net/renesas,ether.yaml | 3 +--
Documentation/devicetree/bindings/net/renesas,etheravb.yaml | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/renesas,ether.yaml b/Documentation/devicetree/bindings/net/renesas,ether.yaml
index 06b38c9bc6ec..29355ab98569 100644
--- a/Documentation/devicetree/bindings/net/renesas,ether.yaml
+++ b/Documentation/devicetree/bindings/net/renesas,ether.yaml
@@ -81,9 +81,8 @@ properties:
active-high
patternProperties:
- "^ethernet-phy@[0-9a-f]$":
+ "@[0-9a-f]$":
type: object
- $ref: ethernet-phy.yaml#
required:
- compatible
diff --git a/Documentation/devicetree/bindings/net/renesas,etheravb.yaml b/Documentation/devicetree/bindings/net/renesas,etheravb.yaml
index 3f41294f5997..5d074f27d462 100644
--- a/Documentation/devicetree/bindings/net/renesas,etheravb.yaml
+++ b/Documentation/devicetree/bindings/net/renesas,etheravb.yaml
@@ -109,9 +109,8 @@ properties:
enum: [0, 2000]
patternProperties:
- "^ethernet-phy@[0-9a-f]$":
+ "@[0-9a-f]$":
type: object
- $ref: ethernet-phy.yaml#
required:
- compatible
--
2.42.0
The name "base" is misleading as the definition is for a complete schema
definition without additional properties allowed, not a "base class".
Align the same to be the same as dsa.yaml. This schema file without any
json pointer path is the base schema which can be extended.
There are not yet any references to $defs/base to update.
Signed-off-by: Rob Herring <[email protected]>
---
Documentation/devicetree/bindings/net/ethernet-switch.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/net/ethernet-switch.yaml b/Documentation/devicetree/bindings/net/ethernet-switch.yaml
index 688938c2e261..72ac67ca3415 100644
--- a/Documentation/devicetree/bindings/net/ethernet-switch.yaml
+++ b/Documentation/devicetree/bindings/net/ethernet-switch.yaml
@@ -53,7 +53,7 @@ oneOf:
additionalProperties: true
$defs:
- base:
+ ethernet-ports:
description: An ethernet switch without any extra port properties
$ref: '#'
--
2.42.0
The indentation for the example is completely messed up for
'ethernet-ports'. Fix it.
Signed-off-by: Rob Herring <[email protected]>
---
.../bindings/net/mscc,vsc7514-switch.yaml | 32 +++++++++++-----------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml b/Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml
index 8ee2c7d7ff42..07de52a3a295 100644
--- a/Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml
+++ b/Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml
@@ -185,7 +185,7 @@ examples:
};
# VSC7512 (DSA)
- |
- ethernet-switch@1{
+ ethernet-switch@1 {
compatible = "mscc,vsc7512-switch";
reg = <0x71010000 0x10000>,
<0x71030000 0x10000>,
@@ -212,22 +212,22 @@ examples:
"port7", "port8", "port9", "port10", "qsys",
"ana", "s0", "s1", "s2";
- ethernet-ports {
- #address-cells = <1>;
- #size-cells = <0>;
-
- port@0 {
- reg = <0>;
- ethernet = <&mac_sw>;
- phy-handle = <&phy0>;
- phy-mode = "internal";
- };
- port@1 {
- reg = <1>;
- phy-handle = <&phy1>;
- phy-mode = "internal";
- };
+ ethernet-ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ reg = <0>;
+ ethernet = <&mac_sw>;
+ phy-handle = <&phy0>;
+ phy-mode = "internal";
+ };
+ port@1 {
+ reg = <1>;
+ phy-handle = <&phy1>;
+ phy-mode = "internal";
};
};
+ };
...
--
2.42.0
On 17.10.2023 00:44, Rob Herring wrote:
> Just as unevaluatedProperties or additionalProperties are required at
> the top level of schemas, they should (and will) also be required for
> child node schemas. That ensures only documented properties are
> present for any node.
>
> Add unevaluatedProperties or additionalProperties as appropriate.
>
> Signed-off-by: Rob Herring <[email protected]>
Acked-by: Arınç ÜNAL <[email protected]>
Arınç
On 17.10.2023 00:44, Rob Herring wrote:
> 'ethernet-port' node unit-addresses should be in hexadecimal. Some
> instances have it correct, but fix the ones that don't.
>
> Signed-off-by: Rob Herring <[email protected]>
> ---
> Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml | 2 +-
> Documentation/devicetree/bindings/net/dsa/dsa.yaml | 2 +-
> Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml | 6 +++---
> Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml | 2 +-
> Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml | 2 +-
> Documentation/devicetree/bindings/net/ethernet-switch.yaml | 4 ++--
> Documentation/devicetree/bindings/net/ti,cpsw-switch.yaml | 2 +-
> 7 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml b/Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml
> index aa3162c74833..75d8138298fb 100644
> --- a/Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml
> +++ b/Documentation/devicetree/bindings/net/brcm,asp-v2.0.yaml
> @@ -53,7 +53,7 @@ properties:
> const: 0
>
> patternProperties:
> - "^port@[0-9]+$":
> + "^port@[0-9a-f]+$":
> type: object
>
> $ref: ethernet-controller.yaml#
> diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.yaml b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> index ec74a660beda..e6010821f86f 100644
> --- a/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> @@ -50,7 +50,7 @@ $defs:
> const: 0
>
> patternProperties:
> - "^(ethernet-)?port@[0-9]+$":
> + "^(ethernet-)?port@[0-9a-f]+$":
> description: Ethernet switch ports
> $ref: dsa-port.yaml#
> unevaluatedProperties: false
> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> index 20f7ba4e2203..5038818e9f2e 100644
> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> @@ -157,7 +157,7 @@ patternProperties:
> additionalProperties: true
>
> patternProperties:
> - "^(ethernet-)?port@[0-9]+$":
> + "^(ethernet-)?port@[0-6]$":
You also restrict the pattern depending on how many ports the switch has.
Shouldn't this be a separate patch or, at the least, mentioned on the patch
log?
Regardless:
Acked-by: Arınç ÜNAL <[email protected]>
Arınç
On 17.10.2023 00:44, Rob Herring wrote:
> The '$defs/ethernet-ports' schema is referenced by schemas defining a
> child node 'ethernet-ports', but this schema misses the
> 'ethernet-ports' node. It would work if referring schemas made a
> reference like this:
>
> properties:
> ethernet-ports:
> $ref: ethernet-switch.yaml#/$defs/ethernet-ports
>
> However, that would be different from how dsa.yaml works. For
> consistency, align the schema definition with dsa.yaml and add the
> missing level.
>
> Signed-off-by: Rob Herring <[email protected]>
Acked-by: Arınç ÜNAL <[email protected]>
Arınç
On 17.10.2023 00:44, Rob Herring wrote:
> The name "base" is misleading as the definition is for a complete schema
> definition without additional properties allowed, not a "base class".
> Align the same to be the same as dsa.yaml. This schema file without any
Align the same to be the same -> Align the name to be the same
> json pointer path is the base schema which can be extended.
>
> There are not yet any references to $defs/base to update.
>
> Signed-off-by: Rob Herring <[email protected]>
Acked-by: Arınç ÜNAL <[email protected]>
Arınç
On 17.10.2023 00:44, Rob Herring wrote:
> The indentation for the example is completely messed up for
> 'ethernet-ports'. Fix it.
>
> Signed-off-by: Rob Herring <[email protected]>
> ---
> .../bindings/net/mscc,vsc7514-switch.yaml | 32 +++++++++++-----------
> 1 file changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml b/Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml
> index 8ee2c7d7ff42..07de52a3a295 100644
> --- a/Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml
> +++ b/Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml
> @@ -185,7 +185,7 @@ examples:
> };
> # VSC7512 (DSA)
> - |
> - ethernet-switch@1{
> + ethernet-switch@1 {
> compatible = "mscc,vsc7512-switch";
> reg = <0x71010000 0x10000>,
> <0x71030000 0x10000>,
> @@ -212,22 +212,22 @@ examples:
> "port7", "port8", "port9", "port10", "qsys",
> "ana", "s0", "s1", "s2";
>
> - ethernet-ports {
> - #address-cells = <1>;
> - #size-cells = <0>;
> -
> - port@0 {
> - reg = <0>;
> - ethernet = <&mac_sw>;
> - phy-handle = <&phy0>;
> - phy-mode = "internal";
> - };
> - port@1 {
> - reg = <1>;
> - phy-handle = <&phy1>;
> - phy-mode = "internal";
> - };
> + ethernet-ports {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + port@0 {
> + reg = <0>;
> + ethernet = <&mac_sw>;
> + phy-handle = <&phy0>;
> + phy-mode = "internal";
> + };
Could use 4-space indentation as described here.
https://www.kernel.org/doc/html/latest/devicetree/bindings/writing-schema.html#example-schema
Regardless:
Acked-by: Arınç ÜNAL <[email protected]>
Arınç
On 17.10.2023 00:44, Rob Herring wrote:
> The mscc,vsc7514-switch schema doesn't add any custom port properties,
> so it can just reference ethernet-switch.yaml#/$defs/base and
This is ethernet-switch.yaml#/$defs/ethernet-ports now.
> dsa.yaml#/$defs/ethernet-ports instead of the base file and can skip
> defining port nodes.
>
> Signed-off-by: Rob Herring <[email protected]>
Other than above:
Acked-by: Arınç ÜNAL <[email protected]>
Arınç
On 17.10.2023 00:44, Rob Herring wrote:
> Constraints on 'ethernet-ports' node properties are already defined by the
> reference to ethernet-switch.yaml, so they can be dropped from the DSA
> schema.
>
> Signed-off-by: Rob Herring <[email protected]>
Acked-by: Arınç ÜNAL <[email protected]>
Arınç
Dne ponedeljek, 16. oktober 2023 ob 23:44:20 CEST je Rob Herring napisal(a):
> Just as unevaluatedProperties or additionalProperties are required at
> the top level of schemas, they should (and will) also be required for
> child node schemas. That ensures only documented properties are
> present for any node.
>
> Add unevaluatedProperties or additionalProperties as appropriate.
>
> Signed-off-by: Rob Herring <[email protected]>
> ---
> .../devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml | 2 ++
For Allwinner:
Acked-by: Jernej Skrabec <[email protected]>
Best regards,
Jernej
> Documentation/devicetree/bindings/net/dsa/brcm,sf2.yaml | 1 +
> Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml | 2 ++
> .../devicetree/bindings/net/dsa/microchip,lan937x.yaml | 1 +
> Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml | 2 ++
> Documentation/devicetree/bindings/net/dsa/qca8k.yaml | 1 +
> Documentation/devicetree/bindings/net/dsa/realtek.yaml | 2 ++
> .../devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml | 10 ++--------
> Documentation/devicetree/bindings/net/engleder,tsnep.yaml | 1 +
> Documentation/devicetree/bindings/net/nxp,tja11xx.yaml | 1 +
> 10 files changed, 15 insertions(+), 8 deletions(-)
On 16.10.23 23:44, Rob Herring wrote:
> Just as unevaluatedProperties or additionalProperties are required at
> the top level of schemas, they should (and will) also be required for
> child node schemas. That ensures only documented properties are
> present for any node.
>
> Add unevaluatedProperties or additionalProperties as appropriate.
>
> Signed-off-by: Rob Herring <[email protected]>
> ---
> .../devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml | 2 ++
> Documentation/devicetree/bindings/net/dsa/brcm,sf2.yaml | 1 +
> Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml | 2 ++
> .../devicetree/bindings/net/dsa/microchip,lan937x.yaml | 1 +
> Documentation/devicetree/bindings/net/dsa/nxp,sja1105.yaml | 2 ++
> Documentation/devicetree/bindings/net/dsa/qca8k.yaml | 1 +
> Documentation/devicetree/bindings/net/dsa/realtek.yaml | 2 ++
> .../devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml | 10 ++--------
> Documentation/devicetree/bindings/net/engleder,tsnep.yaml | 1 +
Looks good for tsnep.
Reviewed-by: Gerhard Engleder <[email protected]>
Thank you!
> Documentation/devicetree/bindings/net/nxp,tja11xx.yaml | 1 +
> 10 files changed, 15 insertions(+), 8 deletions(-)
On Mon, Oct 16, 2023 at 11:44 PM Rob Herring <[email protected]> wrote:
> This is a series of clean-ups related to ensuring that child node
> schemas are constrained to not allow undefined properties. Typically,
> that means just adding additionalProperties or unevaluatedProperties as
> appropriate. The DSA/switch schemas turned out to be a bit more
> involved, so there's some more fixes and a bit of restructuring in them.
>
> Signed-off-by: Rob Herring <[email protected]>
Oh this drives a truck through my Marvell binding work. Luckily it
also solves my most annoying problems so I will just rebase on this
and continue, all good!
Acked-by: Linus Walleij <[email protected]>
Yours,
Linus Walleij
Hi Rob,
On Mon, Oct 16, 2023 at 04:44:20PM -0500, Rob Herring wrote:
> Just as unevaluatedProperties or additionalProperties are required at
> the top level of schemas, they should (and will) also be required for
> child node schemas. That ensures only documented properties are
> present for any node.
>
> Add unevaluatedProperties or additionalProperties as appropriate.
>
> Signed-off-by: Rob Herring <[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 833d2f68daa1..ea285ef3e64f 100644
> --- a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
> @@ -61,17 +61,11 @@ properties:
>
> ethernet-ports:
> type: object
> - properties:
> - '#address-cells':
> - const: 1
> - '#size-cells':
> - const: 0
> -
> + additionalProperties: true
> patternProperties:
> "^(ethernet-)?port@[0-4]$":
> type: object
> - description: Ethernet switch ports
> -
> + additionalProperties: true
> properties:
> pcs-handle:
> maxItems: 1
For my edification, this patch removes #address-cells and #size-cells
at the same time, because "additionalProperties: true" (which was also
implied before) doesn't care if they aren't defined in this sub-schema,
and they are defined through $ref: dsa.yaml#/$defs/ethernet-ports,
right?
On Mon, Oct 16, 2023 at 04:44:22PM -0500, Rob Herring wrote:
> 'ethernet-port' node unit-addresses should be in hexadecimal. Some
> instances have it correct, but fix the ones that don't.
>
> Signed-off-by: Rob Herring <[email protected]>
> ---
Reviewed-by: Vladimir Oltean <[email protected]>
On Mon, Oct 16, 2023 at 04:44:23PM -0500, Rob Herring wrote:
> The '$defs/ethernet-ports' schema is referenced by schemas defining a
> child node 'ethernet-ports', but this schema misses the
> 'ethernet-ports' node. It would work if referring schemas made a
> reference like this:
>
> properties:
> ethernet-ports:
> $ref: ethernet-switch.yaml#/$defs/ethernet-ports
>
> However, that would be different from how dsa.yaml works. For
> consistency, align the schema definition with dsa.yaml and add the
> missing level.
>
> Signed-off-by: Rob Herring <[email protected]>
> ---
> Documentation/devicetree/bindings/net/ethernet-switch.yaml | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/net/ethernet-switch.yaml b/Documentation/devicetree/bindings/net/ethernet-switch.yaml
> index dcbffe19d71a..688938c2e261 100644
> --- a/Documentation/devicetree/bindings/net/ethernet-switch.yaml
> +++ b/Documentation/devicetree/bindings/net/ethernet-switch.yaml
> @@ -58,9 +58,11 @@ $defs:
> $ref: '#'
>
> patternProperties:
> - "^(ethernet-)?port@[0-9a-f]+$":
> - description: Ethernet switch ports
> - $ref: ethernet-switch-port.yaml#
> - unevaluatedProperties: false
> + "^(ethernet-)?ports$":
> + patternProperties:
> + "^(ethernet-)?port@[0-9a-f]+$":
> + description: Ethernet switch ports
> + $ref: ethernet-switch-port.yaml#
> + unevaluatedProperties: false
>
> ...
>
> --
> 2.42.0
>
Huh, interesting.
Reviewed-by: Vladimir Oltean <[email protected]>
On Mon, Oct 16, 2023 at 04:44:24PM -0500, Rob Herring wrote:
> The name "base" is misleading as the definition is for a complete schema
> definition without additional properties allowed, not a "base class".
> Align the same to be the same as dsa.yaml. This schema file without any
> json pointer path is the base schema which can be extended.
>
> There are not yet any references to $defs/base to update.
>
> Signed-off-by: Rob Herring <[email protected]>
> ---
Reviewed-by: Vladimir Oltean <[email protected]>
On Mon, Oct 16, 2023 at 04:44:25PM -0500, Rob Herring wrote:
> The indentation for the example is completely messed up for
> 'ethernet-ports'. Fix it.
>
> Signed-off-by: Rob Herring <[email protected]>
> ---
Reviewed-by: Vladimir Oltean <[email protected]>
On Mon, Oct 16, 2023 at 04:44:26PM -0500, Rob Herring wrote:
> The mscc,vsc7514-switch schema doesn't add any custom port properties,
> so it can just reference ethernet-switch.yaml#/$defs/base and
> dsa.yaml#/$defs/ethernet-ports instead of the base file and can skip
> defining port nodes.
>
> Signed-off-by: Rob Herring <[email protected]>
> ---
Reviewed-by: Vladimir Oltean <[email protected]>
On Mon, Oct 16, 2023 at 04:44:27PM -0500, Rob Herring wrote:
> Constraints on 'ethernet-ports' node properties are already defined by the
> reference to ethernet-switch.yaml, so they can be dropped from the DSA
> schema.
>
> Signed-off-by: Rob Herring <[email protected]>
> ---
Reviewed-by: Vladimir Oltean <[email protected]>
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <[email protected]>:
On Mon, 16 Oct 2023 16:44:19 -0500 you wrote:
> This is a series of clean-ups related to ensuring that child node
> schemas are constrained to not allow undefined properties. Typically,
> that means just adding additionalProperties or unevaluatedProperties as
> appropriate. The DSA/switch schemas turned out to be a bit more
> involved, so there's some more fixes and a bit of restructuring in them.
>
> Signed-off-by: Rob Herring <[email protected]>
>
> [...]
Here is the summary with links:
- [net-next,1/8] dt-bindings: net: Add missing (unevaluated|additional)Properties on child node schemas
https://git.kernel.org/netdev/net-next/c/659fd097b098
- [net-next,2/8] dt-bindings: net: renesas: Drop ethernet-phy node schema
https://git.kernel.org/netdev/net-next/c/ac8fe40c3628
- [net-next,3/8] dt-bindings: net: dsa/switch: Make 'ethernet-port' node addresses hex
https://git.kernel.org/netdev/net-next/c/51ff5150258a
- [net-next,4/8] dt-bindings: net: ethernet-switch: Add missing 'ethernet-ports' level
https://git.kernel.org/netdev/net-next/c/f0fdec925fe7
- [net-next,5/8] dt-bindings: net: ethernet-switch: Rename $defs "base" to 'ethernet-ports'
https://git.kernel.org/netdev/net-next/c/b9823df7bbad
- [net-next,6/8] dt-bindings: net: mscc,vsc7514-switch: Clean-up example indentation
https://git.kernel.org/netdev/net-next/c/491ec40d67a5
- [net-next,7/8] dt-bindings: net: mscc,vsc7514-switch: Simplify DSA and switch references
https://git.kernel.org/netdev/net-next/c/7c93392d754e
- [net-next,8/8] dt-bindings: net: dsa: Drop 'ethernet-ports' node properties
https://git.kernel.org/netdev/net-next/c/31f47f303c6b
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
On Thu, Oct 19, 2023 at 8:18 AM Vladimir Oltean <[email protected]> wrote:
>
> Hi Rob,
>
> On Mon, Oct 16, 2023 at 04:44:20PM -0500, Rob Herring wrote:
> > Just as unevaluatedProperties or additionalProperties are required at
> > the top level of schemas, they should (and will) also be required for
> > child node schemas. That ensures only documented properties are
> > present for any node.
> >
> > Add unevaluatedProperties or additionalProperties as appropriate.
> >
> > Signed-off-by: Rob Herring <[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 833d2f68daa1..ea285ef3e64f 100644
> > --- a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
> > +++ b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml
> > @@ -61,17 +61,11 @@ properties:
> >
> > ethernet-ports:
> > type: object
> > - properties:
> > - '#address-cells':
> > - const: 1
> > - '#size-cells':
> > - const: 0
> > -
> > + additionalProperties: true
> > patternProperties:
> > "^(ethernet-)?port@[0-4]$":
> > type: object
> > - description: Ethernet switch ports
> > -
> > + additionalProperties: true
> > properties:
> > pcs-handle:
> > maxItems: 1
>
> For my edification, this patch removes #address-cells and #size-cells
> at the same time, because "additionalProperties: true" (which was also
> implied before) doesn't care if they aren't defined in this sub-schema,
> and they are defined through $ref: dsa.yaml#/$defs/ethernet-ports,
> right?
Yes, they are ultimately checked via ethernet-switch.yaml which
dsa.yaml references.
Rob