diff mbox series

[net-next,v2,06/10] dt-bindings: net: define phylink bindings

Message ID 20230916110902.234273-7-arinc.unal@arinc9.com (mailing list archive)
State Awaiting Upstream
Delegated to: Geert Uytterhoeven
Headers show
Series define and enforce phylink bindings | expand

Commit Message

Arınç ÜNAL Sept. 16, 2023, 11:08 a.m. UTC
Define the phylink bindings on ethernet-controller.yaml and replace the
bindings on the dsa-port.yaml schema with them. The shared ports of DSA
requires phy-mode so keep that.

Important remarks about the phylink bindings:
- fsl,fman-dtsec uses tbi-handle instead of pcs-handle, therefore
  tbi-handle is included.
- For sfp, only managed with the in-band-status value must be required, but
  phy-handle is required as another option because of a special case on the
  eth2 node on arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts.

Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
---
 .../devicetree/bindings/net/dsa/dsa-port.yaml | 12 ++------
 .../bindings/net/ethernet-controller.yaml     | 29 +++++++++++++++++++
 2 files changed, 31 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml b/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml
index 480120469953..53efb686cfc7 100644
--- a/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/dsa-port.yaml
@@ -65,16 +65,8 @@  if:
     - required: [ ethernet ]
     - required: [ link ]
 then:
-  allOf:
-    - required:
-        - phy-mode
-    - oneOf:
-        - required:
-            - fixed-link
-        - required:
-            - phy-handle
-        - required:
-            - managed
+  $ref: /schemas/net/ethernet-controller.yaml#/$defs/phylink
+  required: [ phy-mode ]
 
 additionalProperties: true
 
diff --git a/Documentation/devicetree/bindings/net/ethernet-controller.yaml b/Documentation/devicetree/bindings/net/ethernet-controller.yaml
index 9f6a5ccbcefe..ef28ebc76798 100644
--- a/Documentation/devicetree/bindings/net/ethernet-controller.yaml
+++ b/Documentation/devicetree/bindings/net/ethernet-controller.yaml
@@ -284,6 +284,35 @@  allOf:
             controllers that have configurable TX internal delays. If this
             property is present then the MAC applies the TX delay.
 
+$defs:
+  phylink:
+    description: phylink bindings for ethernet controllers
+    allOf:
+      - anyOf:
+          - required: [ fixed-link ]
+          - required: [ pcs-handle ]
+          - required: [ tbi-handle ]
+          - required: [ phy-handle ]
+          - required: [ sfp ]
+          - required: [ managed ]
+
+      - if:
+          required: [ fixed-link ]
+        then:
+          properties:
+            managed:
+              const: auto
+
+      - if:
+          required: [ sfp ]
+        then:
+          oneOf:
+            - required: [ phy-handle ]
+            - required: [ managed ]
+              properties:
+                managed:
+                  const: in-band-status
+
 additionalProperties: true
 
 ...