Commit 4b316e07 authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'dt-bindings-net-child-node-schema-cleanups'

Rob Herring says:

====================
dt-bindings: net: Child node schema cleanups

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

Link: https://lore.kernel.org/r/20231016-dt-net-cleanups-v1-0-a525a090b444@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents dcf02bac 31f47f30
...@@ -158,6 +158,8 @@ allOf: ...@@ -158,6 +158,8 @@ allOf:
patternProperties: patternProperties:
"^ethernet-phy@[0-9a-f]$": "^ethernet-phy@[0-9a-f]$":
type: object type: object
$ref: ethernet-phy.yaml#
unevaluatedProperties: false
description: description:
Integrated PHY node Integrated PHY node
......
...@@ -53,7 +53,7 @@ properties: ...@@ -53,7 +53,7 @@ properties:
const: 0 const: 0
patternProperties: patternProperties:
"^port@[0-9]+$": "^port@[0-9a-f]+$":
type: object type: object
$ref: ethernet-controller.yaml# $ref: ethernet-controller.yaml#
......
...@@ -78,6 +78,7 @@ properties: ...@@ -78,6 +78,7 @@ properties:
ports: ports:
type: object type: object
additionalProperties: true
patternProperties: patternProperties:
'^port@[0-9a-f]$': '^port@[0-9a-f]$':
......
...@@ -40,17 +40,8 @@ $defs: ...@@ -40,17 +40,8 @@ $defs:
patternProperties: patternProperties:
"^(ethernet-)?ports$": "^(ethernet-)?ports$":
type: object
additionalProperties: false
properties:
'#address-cells':
const: 1
'#size-cells':
const: 0
patternProperties: patternProperties:
"^(ethernet-)?port@[0-9]+$": "^(ethernet-)?port@[0-9a-f]+$":
description: Ethernet switch ports description: Ethernet switch ports
$ref: dsa-port.yaml# $ref: dsa-port.yaml#
unevaluatedProperties: false unevaluatedProperties: false
......
...@@ -154,10 +154,12 @@ properties: ...@@ -154,10 +154,12 @@ properties:
patternProperties: patternProperties:
"^(ethernet-)?ports$": "^(ethernet-)?ports$":
type: object type: object
additionalProperties: true
patternProperties: patternProperties:
"^(ethernet-)?port@[0-9]+$": "^(ethernet-)?port@[0-6]$":
type: object type: object
additionalProperties: true
properties: properties:
reg: reg:
...@@ -184,7 +186,7 @@ $defs: ...@@ -184,7 +186,7 @@ $defs:
patternProperties: patternProperties:
"^(ethernet-)?ports$": "^(ethernet-)?ports$":
patternProperties: patternProperties:
"^(ethernet-)?port@[0-9]+$": "^(ethernet-)?port@[0-6]$":
if: if:
required: [ ethernet ] required: [ ethernet ]
then: then:
...@@ -210,7 +212,7 @@ $defs: ...@@ -210,7 +212,7 @@ $defs:
patternProperties: patternProperties:
"^(ethernet-)?ports$": "^(ethernet-)?ports$":
patternProperties: patternProperties:
"^(ethernet-)?port@[0-9]+$": "^(ethernet-)?port@[0-6]$":
if: if:
required: [ ethernet ] required: [ ethernet ]
then: then:
......
...@@ -37,8 +37,9 @@ properties: ...@@ -37,8 +37,9 @@ properties:
patternProperties: patternProperties:
"^(ethernet-)?ports$": "^(ethernet-)?ports$":
additionalProperties: true
patternProperties: patternProperties:
"^(ethernet-)?port@[0-9]+$": "^(ethernet-)?port@[0-7]$":
allOf: allOf:
- if: - if:
properties: properties:
......
...@@ -43,6 +43,7 @@ properties: ...@@ -43,6 +43,7 @@ properties:
# PHY 1. # PHY 1.
mdios: mdios:
type: object type: object
additionalProperties: false
properties: properties:
'#address-cells': '#address-cells':
...@@ -74,8 +75,9 @@ properties: ...@@ -74,8 +75,9 @@ properties:
patternProperties: patternProperties:
"^(ethernet-)?ports$": "^(ethernet-)?ports$":
additionalProperties: true
patternProperties: patternProperties:
"^(ethernet-)?port@[0-9]+$": "^(ethernet-)?port@[0-9]$":
allOf: allOf:
- if: - if:
properties: properties:
......
...@@ -73,6 +73,7 @@ $ref: dsa.yaml# ...@@ -73,6 +73,7 @@ $ref: dsa.yaml#
patternProperties: patternProperties:
"^(ethernet-)?ports$": "^(ethernet-)?ports$":
type: object type: object
additionalProperties: true
patternProperties: patternProperties:
"^(ethernet-)?port@[0-6]$": "^(ethernet-)?port@[0-6]$":
type: object type: object
......
...@@ -68,6 +68,8 @@ properties: ...@@ -68,6 +68,8 @@ properties:
interrupt-controller: interrupt-controller:
type: object type: object
additionalProperties: false
description: | description: |
This defines an interrupt controller with an IRQ line (typically This defines an interrupt controller with an IRQ line (typically
a GPIO) that will demultiplex and handle the interrupt from the single a GPIO) that will demultiplex and handle the interrupt from the single
......
...@@ -61,17 +61,11 @@ properties: ...@@ -61,17 +61,11 @@ properties:
ethernet-ports: ethernet-ports:
type: object type: object
properties: additionalProperties: true
'#address-cells':
const: 1
'#size-cells':
const: 0
patternProperties: patternProperties:
"^(ethernet-)?port@[0-4]$": "^(ethernet-)?port@[0-4]$":
type: object type: object
description: Ethernet switch ports additionalProperties: true
properties: properties:
pcs-handle: pcs-handle:
maxItems: 1 maxItems: 1
......
...@@ -63,6 +63,7 @@ properties: ...@@ -63,6 +63,7 @@ properties:
mdio: mdio:
type: object type: object
$ref: mdio.yaml# $ref: mdio.yaml#
unevaluatedProperties: false
description: optional node for embedded MDIO controller description: optional node for embedded MDIO controller
required: required:
......
...@@ -36,7 +36,7 @@ patternProperties: ...@@ -36,7 +36,7 @@ patternProperties:
const: 0 const: 0
patternProperties: patternProperties:
"^(ethernet-)?port@[0-9]+$": "^(ethernet-)?port@[0-9a-f]+$":
type: object type: object
description: Ethernet switch ports description: Ethernet switch ports
...@@ -53,14 +53,16 @@ oneOf: ...@@ -53,14 +53,16 @@ oneOf:
additionalProperties: true additionalProperties: true
$defs: $defs:
base: ethernet-ports:
description: An ethernet switch without any extra port properties description: An ethernet switch without any extra port properties
$ref: '#' $ref: '#'
patternProperties: patternProperties:
"^(ethernet-)?port@[0-9]+$": "^(ethernet-)?ports$":
description: Ethernet switch ports patternProperties:
$ref: ethernet-switch-port.yaml# "^(ethernet-)?port@[0-9a-f]+$":
unevaluatedProperties: false description: Ethernet switch ports
$ref: ethernet-switch-port.yaml#
unevaluatedProperties: false
... ...
...@@ -24,7 +24,7 @@ allOf: ...@@ -24,7 +24,7 @@ allOf:
compatible: compatible:
const: mscc,vsc7514-switch const: mscc,vsc7514-switch
then: then:
$ref: ethernet-switch.yaml# $ref: ethernet-switch.yaml#/$defs/ethernet-ports
required: required:
- interrupts - interrupts
- interrupt-names - interrupt-names
...@@ -33,28 +33,18 @@ allOf: ...@@ -33,28 +33,18 @@ allOf:
minItems: 21 minItems: 21
reg-names: reg-names:
minItems: 21 minItems: 21
ethernet-ports:
patternProperties:
"^port@[0-9a-f]+$":
$ref: ethernet-switch-port.yaml#
unevaluatedProperties: false
- if: - if:
properties: properties:
compatible: compatible:
const: mscc,vsc7512-switch const: mscc,vsc7512-switch
then: then:
$ref: /schemas/net/dsa/dsa.yaml# $ref: /schemas/net/dsa/dsa.yaml#/$defs/ethernet-ports
properties: properties:
reg: reg:
maxItems: 20 maxItems: 20
reg-names: reg-names:
maxItems: 20 maxItems: 20
ethernet-ports:
patternProperties:
"^port@[0-9a-f]+$":
$ref: /schemas/net/dsa/dsa-port.yaml#
unevaluatedProperties: false
properties: properties:
compatible: compatible:
...@@ -185,7 +175,7 @@ examples: ...@@ -185,7 +175,7 @@ examples:
}; };
# VSC7512 (DSA) # VSC7512 (DSA)
- | - |
ethernet-switch@1{ ethernet-switch@1 {
compatible = "mscc,vsc7512-switch"; compatible = "mscc,vsc7512-switch";
reg = <0x71010000 0x10000>, reg = <0x71010000 0x10000>,
<0x71030000 0x10000>, <0x71030000 0x10000>,
...@@ -212,22 +202,22 @@ examples: ...@@ -212,22 +202,22 @@ examples:
"port7", "port8", "port9", "port10", "qsys", "port7", "port8", "port9", "port10", "qsys",
"ana", "s0", "s1", "s2"; "ana", "s0", "s1", "s2";
ethernet-ports { ethernet-ports {
#address-cells = <1>; #address-cells = <1>;
#size-cells = <0>; #size-cells = <0>;
port@0 { port@0 {
reg = <0>; reg = <0>;
ethernet = <&mac_sw>; ethernet = <&mac_sw>;
phy-handle = <&phy0>; phy-handle = <&phy0>;
phy-mode = "internal"; phy-mode = "internal";
}; };
port@1 { port@1 {
reg = <1>; reg = <1>;
phy-handle = <&phy1>; phy-handle = <&phy1>;
phy-mode = "internal"; phy-mode = "internal";
};
}; };
}; };
};
... ...
...@@ -20,6 +20,7 @@ allOf: ...@@ -20,6 +20,7 @@ allOf:
patternProperties: patternProperties:
"^ethernet-phy@[0-9a-f]+$": "^ethernet-phy@[0-9a-f]+$":
type: object type: object
additionalProperties: false
description: | description: |
Some packages have multiple PHYs. Secondary PHY should be defines as Some packages have multiple PHYs. Secondary PHY should be defines as
subnode of the first (parent) PHY. subnode of the first (parent) PHY.
......
...@@ -81,9 +81,8 @@ properties: ...@@ -81,9 +81,8 @@ properties:
active-high active-high
patternProperties: patternProperties:
"^ethernet-phy@[0-9a-f]$": "@[0-9a-f]$":
type: object type: object
$ref: ethernet-phy.yaml#
required: required:
- compatible - compatible
......
...@@ -109,9 +109,8 @@ properties: ...@@ -109,9 +109,8 @@ properties:
enum: [0, 2000] enum: [0, 2000]
patternProperties: patternProperties:
"^ethernet-phy@[0-9a-f]$": "@[0-9a-f]$":
type: object type: object
$ref: ethernet-phy.yaml#
required: required:
- compatible - compatible
......
...@@ -86,7 +86,7 @@ properties: ...@@ -86,7 +86,7 @@ properties:
const: 0 const: 0
patternProperties: patternProperties:
"^port@[0-9]+$": "^port@[12]$":
type: object type: object
description: CPSW external ports description: CPSW external ports
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment