Message ID | 20221104045204.746124-1-colin.foster@in-advantage.com (mailing list archive) |
---|---|
Headers | show |
Series | dt-binding preparation for ocelot switches | expand |
On Thu, Nov 03, 2022 at 09:51:58PM -0700, 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. > > During the most recent RFC for internal ethernet switch functionality to > the VSC7512, there were 10 steps laid out to adequately prepare > documentation: > > https://lore.kernel.org/all/20221010174856.nd3n4soxk7zbmcm7@skbuf/ > > The full context is quoted below. This patch set represents steps 1-7 of > the 10 steps, with the remaining steps to likely be part of what was the > original RFC. > > The first two patches are specifically rewording and fixing of the MFD > bindings. I kept them in this patch set since they might cause conflicts > with future documentation changes that will be part of the net-next > tree. I can separate them if desired. > > > > Context: > > ``` > To end the discussion on a constructive note, I think if I were Colin, > I would do the following, in the following order, according to what was > expressed as a constraint: > > 1. Reword the "driver" word out of mscc,vsc7514-switch.yaml and express > the description in terms of what the switch can do, not what the > driver can do. > > 2. Make qca8k.yaml have "$ref: dsa.yaml#". Remove "$ref: dsa-port.yaml#" > from the same schema. No, you need dsa-port.yaml referenced because it has DSA port properties plus custom qca8k properties. > > 3. Remove "- $ref: dsa-port.yaml#" from mediatek,mt7530.yaml. It doesn't > seem to be needed, since dsa.yaml also has this. We need this because > we want to make sure no one except dsa.yaml references dsa-port.yaml. You don't seem to need it in mediatek,mt7530.yaml, but only dsa.yaml referencing dsa-port.yaml is not what we need. dsa-port.yaml wouldn't (and didn't at one time) exist if only dsa.yaml needed it. Something like the below patch is on top of your changes is what's needed. For DSA, there are 2 cases, custom properties in 'port' nodes and no custom properties. '(ethernet-)?ports' never has custom properties AFAICT (brcm,sf2 had brcm,use-bcm-hdr in the wrong place). Bindings using only standard DSA properties need to reference 'dsa.yaml#'. Bindings with custom 'ethernet-port' node properties need to use 'dsa.yaml#/$defs/base' and then under the ethernet-port node reference dsa-port.yaml, define their custom properties, and set 'unevaluatedProperties: false'. Obviously this needs to be refactored into proper patches and/or squashed into yours. Probably a patch to fix brcm,sf2 and one to add dsa.yaml#/$defs/base, then split out switch stuff. 8<------------------------------------------------------------------- diff --git a/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml b/Documentation/devicetree/bindings/net/dsa/arrow,xrs700x.yaml index 259a0c6547f3..8d5abb05abdf 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/base maintainers: - George McCollister <george.mccollister@gmail.com> diff --git a/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml b/Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml index 1219b830b1a4..f323fc01b224 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/base - if: properties: compatible: diff --git a/Documentation/devicetree/bindings/net/dsa/brcm,sf2.yaml b/Documentation/devicetree/bindings/net/dsa/brcm,sf2.yaml index d159ac78cec1..eed16e216fb6 100644 --- a/Documentation/devicetree/bindings/net/dsa/brcm,sf2.yaml +++ b/Documentation/devicetree/bindings/net/dsa/brcm,sf2.yaml @@ -85,11 +85,16 @@ properties: ports: type: object - properties: - brcm,use-bcm-hdr: - description: if present, indicates that the switch port has Broadcom - tags enabled (per-packet metadata) - type: boolean + patternProperties: + '^port@[0-9a-f]$': + $ref: dsa-port.yaml# + unevaluatedProperties: false + + properties: + brcm,use-bcm-hdr: + description: if present, indicates that the switch port has Broadcom + tags enabled (per-packet metadata) + type: boolean required: - reg diff --git a/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml b/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml index d97fb87cccb0..0672443ea7a6 100644 --- a/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml +++ b/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml @@ -14,6 +14,8 @@ maintainers: description: Ethernet switch port Description +$ref: /schemas/net/ethernet-switch-port.yaml# + properties: label: description: diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.yaml b/Documentation/devicetree/bindings/net/dsa/dsa.yaml index 2290a9d32b21..1b3593a36014 100644 --- a/Documentation/devicetree/bindings/net/dsa/dsa.yaml +++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml @@ -21,9 +21,6 @@ select: false $ref: "/schemas/net/ethernet-switch.yaml#" properties: - $nodename: - pattern: "^(ethernet-)?switch(@.*)?$" - dsa,member: minItems: 2 maxItems: 2 @@ -36,4 +33,20 @@ properties: additionalProperties: true +$defs: + base: + description: A DSA without any extra port properties + $ref: '#/' + + patternProperties: + "^(ethernet-)?ports$": + type: object + + patternProperties: + "^(ethernet-)?port@[0-9]+$": + description: Ethernet switch ports + $ref: /schemas/net/dsa/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..e27b1619066f 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/base maintainers: - Andrew Lunn <andrew@lunn.ch> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml index 81f291105660..564783fcb685 100644 --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml @@ -156,21 +156,15 @@ patternProperties: patternProperties: "^(ethernet-)?port@[0-9]+$": - type: object - description: Ethernet switch ports - - properties: - reg: - description: - Port address described must be 5 or 6 for CPU port and from 0 to 5 - for user ports. - allOf: - if: required: [ ethernet ] then: properties: reg: + description: + Port address described must be 5 or 6 for CPU port and from 0 to 5 + for user ports. enum: - 5 - 6 @@ -235,7 +229,7 @@ $defs: - sgmii allOf: - - $ref: dsa.yaml# + - $ref: dsa.yaml#/$defs/base - 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..bfa2b76659c9 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 <Woojung.Huh@microchip.com> allOf: - - $ref: dsa.yaml# + - $ref: dsa.yaml#/$defs/base - $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..f4f9798addae 100644 --- a/Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml +++ b/Documentation/devicetree/bindings/net/dsa/microchip,lan937x.yaml @@ -10,7 +10,7 @@ maintainers: - UNGLinuxDriver@microchip.com allOf: - - $ref: dsa.yaml# + - $ref: dsa.yaml#/$defs/base properties: compatible: diff --git a/Documentation/devicetree/bindings/net/dsa/mscc,ocelot.yaml b/Documentation/devicetree/bindings/net/dsa/mscc,ocelot.yaml index 8d93ed9c172c..a7041ae4d811 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/base - 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..13a835af9468 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/base - $ref: /schemas/spi/spi-peripheral-props.yaml# maintainers: diff --git a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml index d831d5eee437..a33abdb9ead0 100644 --- a/Documentation/devicetree/bindings/net/dsa/qca8k.yaml +++ b/Documentation/devicetree/bindings/net/dsa/qca8k.yaml @@ -77,8 +77,7 @@ patternProperties: type: object patternProperties: "^(ethernet-)?port@[0-6]$": - type: object - description: Ethernet switch ports + $ref: dsa-port.yaml# properties: qca,sgmii-rxclk-falling-edge: @@ -102,7 +101,7 @@ patternProperties: SGMII on the QCA8337, it is advised to set this unless a communication issue is observed. - unevaluatedProperties: true + unevaluatedProperties: false oneOf: - required: diff --git a/Documentation/devicetree/bindings/net/dsa/realtek.yaml b/Documentation/devicetree/bindings/net/dsa/realtek.yaml index 1a7d45a8ad66..ad1793eba31a 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/base maintainers: - Linus Walleij <linus.walleij@linaro.org> diff --git a/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml b/Documentation/devicetree/bindings/net/dsa/renesas,rzn1-a5psw.yaml index 7ca9c19a157c..eb9ea25efcb7 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/base properties: compatible: diff --git a/Documentation/devicetree/bindings/net/ethernet-switch.yaml b/Documentation/devicetree/bindings/net/ethernet-switch.yaml index f698857619da..0d417997c163 100644 --- a/Documentation/devicetree/bindings/net/ethernet-switch.yaml +++ b/Documentation/devicetree/bindings/net/ethernet-switch.yaml @@ -25,6 +25,8 @@ properties: patternProperties: "^(ethernet-)?ports$": type: object + additionalProperties: false + properties: '#address-cells': const: 1 @@ -36,10 +38,6 @@ patternProperties: type: object description: Ethernet switch ports - allOf: - - $ref: /schemas/net/dsa/dsa-port.yaml# - - $ref: ethernet-switch-port.yaml# - oneOf: - required: - ports @@ -48,4 +46,20 @@ oneOf: additionalProperties: true +$defs: + base: + description: An Ethernet switch without any extra port properties + $ref: '#/' + + patternProperties: + "^(ethernet-)?ports$": + type: object + + patternProperties: + "^(ethernet-)?port@[0-9]+$": + description: Ethernet switch ports + $ref: ethernet-switch-port.yaml# + unevaluatedProperties: false + + ...