Skip to contentSkip to conversation

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

PATCH Superseded Dinh Nguyen 2 participants 3 messages Jun 21, 2025 – Jun 23, 2025

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

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

Convert the socfpga-dwmac.txt to yaml.

---
 .../bindings/net/altr,dwmac-socfpga.yaml      | 152 ++++++++++++++++++
 .../devicetree/bindings/net/socfpga-dwmac.txt |  57 -------
 2 files changed, 152 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 +152 -0
new file mode 100644
index 000000000000..fc088bd55178
@@ -0,0 +1,152 @@
+# 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]>
+
+properties:
+  compatible:
+    additionalItems: true
+    maxItems: 3
+    items:
+      - enum:
+          - altr,socfpga-stmmac
+          - altr,socfpga-stmmac-a10-s10
+    contains:
+      enum:
+        - snps,dwmac-3.74a
+        - snps,dwmac-3.70a
+        - snps,dwmac
+
+  reg:
+    items:
+      - description: Base DWMAC registers
+
+  iommus:
+    minItems: 1
+    maxItems: 2
+
+  clocks:
+    minItems: 1
+    items:
+      - description: MAC host clock
+      - description: MAC timer clock
+
+  clock-names:
+    minItems: 1
+    maxItems: 2
+    contains:
+      enum:
+        - stmmaceth
+        - ptp_ref
+
+  resets:
+    minItems: 1
+    items:
+      - description: GMAC stmmaceth reset
+      - description: AHB reset
+
+  reset-names:
+    oneOf:
+      - items:
+          - enum: [stmmaceth, ahb]
+      - items:
+          - const: stmmaceth
+          - const: ahb
+
+  interrupts:
+    items:
+      - description: DWAC interrupt
+
+  interrupt-names:
+    items:
+      - const: macirq
+
+  mac-address: true
+
+  phy-mode:
+    maxItems: 1
+    items:
+      enum:
+        - rgmii
+        - gmii
+        - mii
+
+  tx-fifo-depth:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: DWMAC Tx fifo depth(Stratix10, Agilex)
+
+  rx-fifo-depth:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: DWMAC Rx fifo depth(Stratix10, Agilex)
+
+  snps,multicast-filter-bins:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Number of multicast filter hash bins supported by this device
+      instance
+
+  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
+
+allOf:
+  - $ref: snps,dwmac.yaml#
+
+additionalProperties: false
+
+examples:
+  - |
+    soc {
+        #address-cells = <1>;
+        #size-cells = <1>;
+
+        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 10 lines · Dinh Nguyen

Convert the socfpga-dwmac.txt to yaml.

---
 .../bindings/net/altr,dwmac-socfpga.yaml      | 152 ++++++++++++++++++
 .../devicetree/bindings/net/socfpga-dwmac.txt |  57 -------
 2 files changed, 152 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/renesas,rzn1-gmac.example.dtb: ethernet@44000000 (renesas,r9a06g032-gmac): 'pcs-handle', 'power-domains', 'snps,perfect-filter-entries' do not match any of the regexes: '^pinctrl-[0-9]+$'
from schema $id: http://devicetree.org/schemas/net/altr,dwmac-socfpga.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/renesas,rzn1-gmac.example.dtb: ethernet@44000000 (renesas,r9a06g032-gmac): compatible:0: 'renesas,r9a06g032-gmac' is not one of ['altr,socfpga-stmmac', 'altr,socfpga-stmmac-a10-s10']
from schema $id: http://devicetree.org/schemas/net/altr,dwmac-socfpga.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/renesas,rzn1-gmac.example.dtb: ethernet@44000000 (renesas,r9a06g032-gmac): interrupt-names: ['macirq', 'eth_wake_irq', 'eth_lpi'] is too long
from schema $id: http://devicetree.org/schemas/net/altr,dwmac-socfpga.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/renesas,rzn1-gmac.example.dtb: ethernet@44000000 (renesas,r9a06g032-gmac): interrupts: [[0, 34, 4], [0, 36, 4], [0, 35, 4]] is too long
from schema $id: http://devicetree.org/schemas/net/altr,dwmac-socfpga.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/amlogic,meson-dwmac.example.dtb: ethernet@c9410000 (amlogic,meson-gxbb-dwmac): clock-names: ['stmmaceth', 'clkin0', 'clkin1', 'timing-adjustment'] is too long
from schema $id: http://devicetree.org/schemas/net/altr,dwmac-socfpga.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/amlogic,meson-dwmac.example.dtb: ethernet@c9410000 (amlogic,meson-gxbb-dwmac): clocks: [[4294967295], [4294967295], [4294967295], [4294967295]] is too long
from schema $id: http://devicetree.org/schemas/net/altr,dwmac-socfpga.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/amlogic,meson-dwmac.example.dtb: ethernet@c9410000 (amlogic,meson-gxbb-dwmac): compatible:0: 'amlogic,meson-gxbb-dwmac' is not one of ['altr,socfpga-stmmac', 'altr,socfpga-stmmac-a10-s10']
from schema $id: http://devicetree.org/schemas/net/altr,dwmac-socfpga.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/amlogic,meson-dwmac.example.dtb: ethernet@c9410000 (amlogic,meson-gxbb-dwmac): reg: [[3376480256, 65536], [3364046144, 8]] is too long
from schema $id: http://devicetree.org/schemas/net/altr,dwmac-socfpga.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/thead,th1520-gmac.example.dtb: ethernet@e7070000 (thead,th1520-gmac): 'mdio', 'phy-handle', 'reg-names', 'snps,axi-config', 'snps,fixed-burst', 'snps,pbl' do not match any of the regexes: '^pinctrl-[0-9]+$'
from schema $id: http://devicetree.org/schemas/net/altr,dwmac-socfpga.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/thead,th1520-gmac.example.dtb: ethernet@e7070000 (thead,th1520-gmac): compatible:0: 'thead,th1520-gmac' is not one of ['altr,socfpga-stmmac', 'altr,socfpga-stmmac-a10-s10']
from schema $id: http://devicetree.org/schemas/net/altr,dwmac-socfpga.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/thead,th1520-gmac.example.dtb: ethernet@e7070000 (thead,th1520-gmac): phy-mode:0: 'rgmii-id' is not one of ['rgmii', 'gmii', 'mii']
from schema $id: http://devicetree.org/schemas/net/altr,dwmac-socfpga.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/thead,th1520-gmac.example.dtb: ethernet@e7070000 (thead,th1520-gmac): reg: [[3875995648, 8192], [3959435264, 4096]] is too long
from schema $id: http://devicetree.org/schemas/net/altr,dwmac-socfpga.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.

maintainer
#2 lore raw
In reply to Dinh Nguyen
Quoted 17 lines · Dinh Nguyen

Convert the socfpga-dwmac.txt to yaml.

---
 .../bindings/net/altr,dwmac-socfpga.yaml      | 152 ++++++++++++++++++
 .../devicetree/bindings/net/socfpga-dwmac.txt |  57 -------
 2 files changed, 152 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 +1 -0
new file mode 100644
index 000000000000..fc088bd55178
@@ -0,0 +1,152 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)

Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml line 11

Quoted 10 lines
Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml new file +10 -0
+%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]>
+

You'll need a custom 'select' to avoid matching on the common compatible strings.

Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml line 24

Quoted 13 lines
Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml new file +13 -0
+properties:
+  compatible:
+    additionalItems: true
+    maxItems: 3
+    items:
+      - enum:
+          - altr,socfpga-stmmac
+          - altr,socfpga-stmmac-a10-s10
+    contains:
+      enum:
+        - snps,dwmac-3.74a
+        - snps,dwmac-3.70a
+        - snps,dwmac

Need to define the exact combinations of compatible strings which are valid.

Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml line 28

Quoted 4 lines
Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml new file +4 -0
+
+  reg:
+    items:
+      - description: Base DWMAC registers

Just 'maxItems: 1'

Quoted 8 lines
Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml new file +8 -0
+
+  iommus:
+    minItems: 1
+    maxItems: 2
+
+  clocks:
+    minItems: 1
+    items:

Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml line 46

Quoted 10 lines
Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml new file +10 -0
+      - description: MAC host clock
+      - description: MAC timer clock
+
+  clock-names:
+    minItems: 1
+    maxItems: 2
+    contains:
+      enum:
+        - stmmaceth
+        - ptp_ref

'contains' passes if either of these strings is present and allows anything for the 2nd string. Use 'items' instead and define the exact order and entries.

Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml line 57

Quoted 11 lines
Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml new file +11 -0
+
+  resets:
+    minItems: 1
+    items:
+      - description: GMAC stmmaceth reset
+      - description: AHB reset
+
+  reset-names:
+    oneOf:
+      - items:
+          - enum: [stmmaceth, ahb]

Drop this and add 'minItems: 1' below.

Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml line 64

Quoted 7 lines
Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml new file +7 -0
+      - items:
+          - const: stmmaceth
+          - const: ahb
+
+  interrupts:
+    items:
+      - description: DWAC interrupt

typo.

Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml line 70

Quoted 6 lines
Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml new file +6 -0
+
+  interrupt-names:
+    items:
+      - const: macirq
+
+  mac-address: true

Drop

Quoted 6 lines
Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml new file +6 -0
+
+  phy-mode:
+    maxItems: 1
+    items:
+      enum:
+        - rgmii

Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml line 86

Quoted 10 lines
Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml new file +10 -0
+        - gmii
+        - mii
+
+  tx-fifo-depth:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: DWMAC Tx fifo depth(Stratix10, Agilex)
+
+  rx-fifo-depth:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: DWMAC Rx fifo depth(Stratix10, Agilex)

Already defined in ethernet-controller.yaml. Drop unless you have additional constaints on them.

Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml line 92

Quoted 6 lines
Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml new file +6 -0
+
+  snps,multicast-filter-bins:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Number of multicast filter hash bins supported by this device
+      instance

Already defined in snps,dwmac.yaml. Drop unless you have additional constaints on it.

Quoted 29 lines
Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml new file +29 -0
+
+  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

Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml line 131

Quoted 10 lines
Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml new file +10 -0
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+  - phy-mode
+
+allOf:
+  - $ref: snps,dwmac.yaml#
+
+additionalProperties: false

unevaluatedProperties: false

Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml line 137

Quoted 6 lines
Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml new file +6 -0
+
+examples:
+  - |
+    soc {
+        #address-cells = <1>;
+        #size-cells = <1>;

Don't need this node.

Quoted 15 lines
Documentation/devicetree/bindings/net/altr,dwmac-socfpga.yaml new file +15 -0
+
+        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>;
+       };
+    };