Skip to contentSkip to conversation

dt-bindings: net: convert socfpga-dwmac.txt to DT schema

PATCH Superseded Dinh Nguyen 2 participants 2 messages Jun 24, 2025

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 dt-bindings: net: convert socfpga-dwmac.txt to DT schema

Convert the socfpga-dwmac.txt to yaml.

---
v3: Address all of Rob Herring's comments
v2: Add allOf to include the base dmac yaml
fix Rob Herring's dt_binding_check warnings

---
 .../bindings/net/altr,dwmac-socfpga.yaml      | 139 ++++++++++++++++++
 .../devicetree/bindings/net/socfpga-dwmac.txt |  57 -------
 2 files changed, 139 insertions(+), 57 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml
 delete mode 100644 Documentation/devicetree/bindings/net/socfpga-dwmac.txt
Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml new file +139 -0
new file mode 100644
index 000000000000..6ec369ea9e66
@@ -0,0 +1,139 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/altr,dwmac-socfpga.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Intel/Altera SoCFPGA DWMAC controller
+
+maintainers:
+  - Dinh Nguyen <[email protected]>
+
+select:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - altr,socfpga-stmmac
+          - altr,socfpga-stmmac-a10-s10
+  required:
+    - compatible
+
+allOf:
+  - $ref: snps,dwmac.yaml#
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - const: altr,socfpga-stmmac
+          - const: snps,dwmac-3.70a
+          - const: snps,dwmac
+      - items:
+          - const: altr,socfpga-stmmac-a10-s10
+          - const: snps,dwmac-3.72a
+          - const: snps,dwmac
+      - items:
+          - const: altr,socfpga-stmmac-a10-s10
+          - const: snps,dwmac-3.74a
+          - const: snps,dwmac
+
+  reg:
+    maxItems: 1
+
+  iommus:
+    minItems: 1
+    maxItems: 2
+
+  clocks:
+    minItems: 1
+    items:
+      - description: GMAC main clock
+      - description: PTP clock
+
+  clock-names:
+    minItems: 1
+    maxItems: 2
+    items:
+      - const: stmmaceth
+      - const: ptp_ref
+
+  resets:
+    minItems: 1
+    items:
+      - description: GMAC stmmaceth reset
+      - description: AHB reset
+
+  reset-names:
+    minItems: 1
+    items:
+      - const: stmmaceth
+      - const: ahb
+
+  interrupts:
+    items:
+      - description: DWMAC interrupt
+
+  interrupt-names:
+    items:
+      - const: macirq
+
+  phy-mode:
+    maxItems: 1
+    items:
+      enum:
+        - rgmii
+        - gmii
+        - mii
+
+  altr,sysmgr-syscon:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    items:
+      - items:
+          - description: phandle to the sysmgr node
+          - description: register offset that controls the SDMMC clock phase
+          - description: register shift for the smplsel(drive in) setting
+    description:
+      Should be the phandle to the system manager node that
+      encompasses the glue register, the register offset, and the register shift.
+      On Cyclone5/Arria5, the register shift represents the PHY mode bits, while
+      on the Arria10/Stratix10/Agilex platforms, the register shift represents
+      bit for each emac to enable/disable signals from the FPGA fabric to the
+      EMAC modules.
+
+  altr,emac-splitter:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      Should be the phandle to the emac splitter soft IP node if DWMAC
+      controller is connected emac splitter.
+
+  altr,sgmii-to-sgmii-converter:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      Phandle to the TSE SGMII converter.
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+  - phy-mode
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    gmac0: ethernet@ff700000 {
+            compatible = "altr,socfpga-stmmac", "snps,dwmac-3.70a", "snps,dwmac";
+            altr,sysmgr-syscon = <&sysmgr 0x60 0>;
+            reg = <0xff700000 0x2000>;
+            interrupts = <0 115 4>;
+            interrupt-names = "macirq";
+            mac-address = [00 00 00 00 00 00];/* Filled in by U-Boot */
+            clocks = <&emac_0_clk>;
+            clock-names = "stmmaceth";
+            phy-mode = "rgmii";
+            tx-fifo-depth = <16384>;
+            rx-fifo-depth = <16384>;
+    };
Documentation/devicetree/bindings/net/socfpga-dwmac.txt deleted +0 -57

57 lines not on this page · raw message

Signature · 1 line
2.42.0.411.g813d9a9188
#1 lore raw
Quoted 7 lines · Dinh Nguyen

Convert the socfpga-dwmac.txt to yaml.

---
v3: Address all of Rob Herring's comments
v2: Add allOf to include the base dmac yaml
fix Rob Herring's dt_binding_check warnings

Quoted 7 lines
---
 .../bindings/net/altr,dwmac-socfpga.yaml      | 139 ++++++++++++++++++
 .../devicetree/bindings/net/socfpga-dwmac.txt |  57 -------
 2 files changed, 139 insertions(+), 57 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml
 delete mode 100644 Documentation/devicetree/bindings/net/socfpga-dwmac.txt

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml: properties:clock-names: {'minItems': 1, 'maxItems': 2, 'items': [{'const': 'stmmaceth'}, {'const': 'ptp_ref'}]} should not be valid under {'required': ['maxItems']}
hint: "maxItems" is not needed with an "items" list
from schema $id: http://devicetree.org/meta-schemas/items.yaml#

doc reference errors (make refcheckdocs):
Warning: MAINTAINERS references a file that doesn't exist: Documentation/devicetree/bindings/net/socfpga-dwmac.txt
MAINTAINERS: Documentation/devicetree/bindings/net/socfpga-dwmac.txt

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.