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.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jakub Kicinski 2023-10-19 08:56:39 -07:00
commit 4b316e0700
17 changed files with 50 additions and 62 deletions

View File

@ -158,6 +158,8 @@ allOf:
patternProperties:
"^ethernet-phy@[0-9a-f]$":
type: object
$ref: ethernet-phy.yaml#
unevaluatedProperties: false
description:
Integrated PHY node

View File

@ -53,7 +53,7 @@ properties:
const: 0
patternProperties:
"^port@[0-9]+$":
"^port@[0-9a-f]+$":
type: object
$ref: ethernet-controller.yaml#

View File

@ -78,6 +78,7 @@ properties:
ports:
type: object
additionalProperties: true
patternProperties:
'^port@[0-9a-f]$':

View File

@ -40,17 +40,8 @@ $defs:
patternProperties:
"^(ethernet-)?ports$":
type: object
additionalProperties: false
properties:
'#address-cells':
const: 1
'#size-cells':
const: 0
patternProperties:
"^(ethernet-)?port@[0-9]+$":
"^(ethernet-)?port@[0-9a-f]+$":
description: Ethernet switch ports
$ref: dsa-port.yaml#
unevaluatedProperties: false

View File

@ -154,10 +154,12 @@ properties:
patternProperties:
"^(ethernet-)?ports$":
type: object
additionalProperties: true
patternProperties:
"^(ethernet-)?port@[0-9]+$":
"^(ethernet-)?port@[0-6]$":
type: object
additionalProperties: true
properties:
reg:
@ -184,7 +186,7 @@ $defs:
patternProperties:
"^(ethernet-)?ports$":
patternProperties:
"^(ethernet-)?port@[0-9]+$":
"^(ethernet-)?port@[0-6]$":
if:
required: [ ethernet ]
then:
@ -210,7 +212,7 @@ $defs:
patternProperties:
"^(ethernet-)?ports$":
patternProperties:
"^(ethernet-)?port@[0-9]+$":
"^(ethernet-)?port@[0-6]$":
if:
required: [ ethernet ]
then:

View File

@ -37,8 +37,9 @@ properties:
patternProperties:
"^(ethernet-)?ports$":
additionalProperties: true
patternProperties:
"^(ethernet-)?port@[0-9]+$":
"^(ethernet-)?port@[0-7]$":
allOf:
- if:
properties:

View File

@ -43,6 +43,7 @@ properties:
# PHY 1.
mdios:
type: object
additionalProperties: false
properties:
'#address-cells':
@ -74,8 +75,9 @@ properties:
patternProperties:
"^(ethernet-)?ports$":
additionalProperties: true
patternProperties:
"^(ethernet-)?port@[0-9]+$":
"^(ethernet-)?port@[0-9]$":
allOf:
- if:
properties:

View File

@ -73,6 +73,7 @@ $ref: dsa.yaml#
patternProperties:
"^(ethernet-)?ports$":
type: object
additionalProperties: true
patternProperties:
"^(ethernet-)?port@[0-6]$":
type: object

View File

@ -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

View File

@ -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

View File

@ -63,6 +63,7 @@ properties:
mdio:
type: object
$ref: mdio.yaml#
unevaluatedProperties: false
description: optional node for embedded MDIO controller
required:

View File

@ -36,7 +36,7 @@ patternProperties:
const: 0
patternProperties:
"^(ethernet-)?port@[0-9]+$":
"^(ethernet-)?port@[0-9a-f]+$":
type: object
description: Ethernet switch ports
@ -53,14 +53,16 @@ oneOf:
additionalProperties: true
$defs:
base:
ethernet-ports:
description: An ethernet switch without any extra port properties
$ref: '#'
patternProperties:
"^(ethernet-)?port@[0-9]+$":
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
...

View File

@ -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:
@ -185,7 +175,7 @@ examples:
};
# VSC7512 (DSA)
- |
ethernet-switch@1{
ethernet-switch@1 {
compatible = "mscc,vsc7512-switch";
reg = <0x71010000 0x10000>,
<0x71030000 0x10000>,
@ -212,22 +202,22 @@ examples:
"port7", "port8", "port9", "port10", "qsys",
"ana", "s0", "s1", "s2";
ethernet-ports {
#address-cells = <1>;
#size-cells = <0>;
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";
};
port@0 {
reg = <0>;
ethernet = <&mac_sw>;
phy-handle = <&phy0>;
phy-mode = "internal";
};
port@1 {
reg = <1>;
phy-handle = <&phy1>;
phy-mode = "internal";
};
};
};
...

View File

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

View File

@ -81,9 +81,8 @@ properties:
active-high
patternProperties:
"^ethernet-phy@[0-9a-f]$":
"@[0-9a-f]$":
type: object
$ref: ethernet-phy.yaml#
required:
- compatible

View File

@ -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

View File

@ -86,7 +86,7 @@ properties:
const: 0
patternProperties:
"^port@[0-9]+$":
"^port@[12]$":
type: object
description: CPSW external ports