diff mbox series

[v4,net-next,7/9] dt-bindings: net: add generic ethernet-switch

Message ID 20221202204559.162619-8-colin.foster@in-advantage.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series dt-binding preparation for ocelot switches | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 15 of 15 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 113 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Colin Foster Dec. 2, 2022, 8:45 p.m. UTC
The dsa.yaml bindings had references that can apply to non-dsa switches. To
prevent duplication of this information, keep the dsa-specific information
inside dsa.yaml and move the remaining generic information to the newly
created ethernet-switch.yaml.

Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
Suggested-by: Vladimir Oltean <olteanv@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---

v3 -> v4
  * Update ethernet-ports and ethernet-port nodes to match what the new
    dsa.yaml has. Namely:
      "unevaluatedProperties: false" instead of "additionalProperties: true"
      "additionalProperties: true" instead of "unevaluatedProperties: true"
    for ethernet-ports and ethernet-port, respectively.
  * Add Florian Reviewed tag

v2 -> v3
  * Change ethernet-switch.yaml title from "Ethernet Switch Device
    Tree Bindings" to "Generic Ethernet Switch"
  * Rework ethernet-switch.yaml description
  * Add base defs structure for switches that don't have any additional
    properties.
  * Add "additionalProperties: true" under "^(ethernet-)?ports$" node
  * Correct port reference from /schemas/net/dsa/dsa-port.yaml# to
    ethernet-controller.yaml#

v1 -> v2
  * No net change, but deletions from dsa.yaml included the changes for
    "addionalProperties: true" under ports and "unevaluatedProperties:
    true" under port.

---
 .../devicetree/bindings/net/dsa/dsa.yaml      | 28 +-------
 .../bindings/net/ethernet-switch.yaml         | 66 +++++++++++++++++++
 MAINTAINERS                                   |  1 +
 3 files changed, 69 insertions(+), 26 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/ethernet-switch.yaml

Comments

Rob Herring (Arm) Dec. 5, 2022, 9:47 p.m. UTC | #1
On Fri, Dec 02, 2022 at 12:45:57PM -0800, Colin Foster wrote:
> The dsa.yaml bindings had references that can apply to non-dsa switches. To
> prevent duplication of this information, keep the dsa-specific information
> inside dsa.yaml and move the remaining generic information to the newly
> created ethernet-switch.yaml.
> 
> Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
> Suggested-by: Vladimir Oltean <olteanv@gmail.com>
> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> 
> v3 -> v4
>   * Update ethernet-ports and ethernet-port nodes to match what the new
>     dsa.yaml has. Namely:
>       "unevaluatedProperties: false" instead of "additionalProperties: true"
>       "additionalProperties: true" instead of "unevaluatedProperties: true"
>     for ethernet-ports and ethernet-port, respectively.
>   * Add Florian Reviewed tag
> 
> v2 -> v3
>   * Change ethernet-switch.yaml title from "Ethernet Switch Device
>     Tree Bindings" to "Generic Ethernet Switch"
>   * Rework ethernet-switch.yaml description
>   * Add base defs structure for switches that don't have any additional
>     properties.
>   * Add "additionalProperties: true" under "^(ethernet-)?ports$" node
>   * Correct port reference from /schemas/net/dsa/dsa-port.yaml# to
>     ethernet-controller.yaml#
> 
> v1 -> v2
>   * No net change, but deletions from dsa.yaml included the changes for
>     "addionalProperties: true" under ports and "unevaluatedProperties:
>     true" under port.
> 
> ---
>  .../devicetree/bindings/net/dsa/dsa.yaml      | 28 +-------
>  .../bindings/net/ethernet-switch.yaml         | 66 +++++++++++++++++++
>  MAINTAINERS                                   |  1 +
>  3 files changed, 69 insertions(+), 26 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/net/ethernet-switch.yaml
> 
> diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.yaml b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> index 5081f4979f1b..843205ea722d 100644
> --- a/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
> @@ -18,6 +18,8 @@ description:
>  
>  select: false
>  
> +$ref: "/schemas/net/ethernet-switch.yaml#"

You can drop quotes here.

With that,

Reviewed-by: Rob Herring <robh@kernel.org>

This is a nice clean-up.

Rob
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/net/dsa/dsa.yaml b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
index 5081f4979f1b..843205ea722d 100644
--- a/Documentation/devicetree/bindings/net/dsa/dsa.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/dsa.yaml
@@ -18,6 +18,8 @@  description:
 
 select: false
 
+$ref: "/schemas/net/ethernet-switch.yaml#"
+
 properties:
   dsa,member:
     minItems: 2
@@ -29,32 +31,6 @@  properties:
       (single device hanging off a CPU port) must not specify this property
     $ref: /schemas/types.yaml#/definitions/uint32-array
 
-patternProperties:
-  "^(ethernet-)?ports$":
-    type: object
-    properties:
-      '#address-cells':
-        const: 1
-      '#size-cells':
-        const: 0
-
-    unevaluatedProperties: false
-
-    patternProperties:
-      "^(ethernet-)?port@[0-9]+$":
-        type: object
-        description: Ethernet switch ports
-
-        $ref: dsa-port.yaml#
-
-        additionalProperties: true
-
-oneOf:
-  - required:
-      - ports
-  - required:
-      - ethernet-ports
-
 additionalProperties: true
 
 $defs:
diff --git a/Documentation/devicetree/bindings/net/ethernet-switch.yaml b/Documentation/devicetree/bindings/net/ethernet-switch.yaml
new file mode 100644
index 000000000000..afeb9ffd84c8
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/ethernet-switch.yaml
@@ -0,0 +1,66 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/ethernet-switch.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Generic Ethernet Switch
+
+maintainers:
+  - Andrew Lunn <andrew@lunn.ch>
+  - Florian Fainelli <f.fainelli@gmail.com>
+  - Vivien Didelot <vivien.didelot@gmail.com>
+
+description:
+  Ethernet switches are multi-port Ethernet controllers. Each port has
+  its own number and is represented as its own Ethernet controller.
+  The minimum required functionality is to pass packets to software.
+  They may or may not be able to forward packets automonously between
+  ports.
+
+select: false
+
+properties:
+  $nodename:
+    pattern: "^(ethernet-)?switch(@.*)?$"
+
+patternProperties:
+  "^(ethernet-)?ports$":
+    type: object
+    unevaluatedProperties: false
+
+    properties:
+      '#address-cells':
+        const: 1
+      '#size-cells':
+        const: 0
+
+    patternProperties:
+      "^(ethernet-)?port@[0-9]+$":
+        type: object
+        description: Ethernet switch ports
+
+        $ref: ethernet-controller.yaml#
+
+        additionalProperties: true
+
+oneOf:
+  - required:
+      - ports
+  - required:
+      - ethernet-ports
+
+additionalProperties: true
+
+$defs:
+  base:
+    description: An ethernet switch without any extra port properties
+    $ref: '#/'
+
+    patternProperties:
+      "^(ethernet-)?port@[0-9]+$":
+        description: Ethernet switch ports
+        $ref: ethernet-controller.yaml#
+        unevaluatedProperties: false
+
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 52aeb86c1167..d574cae901b3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -14337,6 +14337,7 @@  M:	Florian Fainelli <f.fainelli@gmail.com>
 M:	Vladimir Oltean <olteanv@gmail.com>
 S:	Maintained
 F:	Documentation/devicetree/bindings/net/dsa/
+F:	Documentation/devicetree/bindings/net/ethernet-switch.yaml
 F:	drivers/net/dsa/
 F:	include/linux/dsa/
 F:	include/linux/platform_data/dsa.h