From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Emil Renner Berthing <kernel@esmil.dk>
Date: Mon, 8 Aug 2022 17:15:17 +0200
Subject: dt-bindings: net: Add dwmac-starfive bindings

Add bindings for the DWMAC glue layer for the StarFive JH71x0 SoCs.

Signed-off-by: Emil Renner Berthing <kernel@esmil.dk>
---
 Documentation/devicetree/bindings/net/dwmac-starfive.yaml | 119 ++++++++++
 Documentation/devicetree/bindings/net/snps,dwmac.yaml     |   2 +
 2 files changed, 121 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/dwmac-starfive.yaml b/Documentation/devicetree/bindings/net/dwmac-starfive.yaml
new file mode 100644
index 000000000000..4826895bda6f
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/dwmac-starfive.yaml
@@ -0,0 +1,119 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright 2022 Emil Renner Berthing
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/net/dwmac-starfive.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: StarFive JH71x0 DWMAC glue layer
+
+maintainers:
+  - Emil Renner Berthing <kernel@esmil.dk>
+
+description:
+  This file documents the platform glue layer for using the stmmac driver on
+  the StarFive JH71x0 RISC-V SoCs.
+
+select:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - starfive,jh7100-gmac
+          - starfive,jh7110-gmac
+  required:
+    - compatible
+
+allOf:
+  - $ref: "snps,dwmac.yaml#"
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - const: starfive,jh7100-gmac
+          - const: snps,dwmac
+      - items:
+          - const: starfive,jh7110-gmac
+          - const: snps,dwmac-5.20
+
+  reg: true
+
+  clocks:
+    minItems: 4
+    items:
+      - description: GMAC main clock
+      - description: GMAC AHB clock
+      - description: PTP clock
+      - description: GTX clock
+      - description: TX clock
+
+  clock-names:
+    minItems: 4
+    maxItems: 5
+    contains:
+      enum:
+        - stmmaceth
+        - pclk
+        - ptp_ref
+        - gtxc
+        - tx
+
+  starfive,syscon:
+    $ref: "/schemas/types.yaml#/definitions/phandle"
+    description: phandle to the syscon node
+
+  starfive,gtxclk-dlychain:
+    $ref: '/schemas/types.yaml#/definitions/uint32'
+    description: GTX clock delay chain setting
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - resets
+  - reset-names
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/starfive-jh7110-sys.h>
+    #include <dt-bindings/clock/starfive-jh7110-aon.h>
+    #include <dt-bindings/reset/starfive-jh7110-sys.h>
+    #include <dt-bindings/reset/starfive-jh7110-aon.h>
+
+    gmac0: ethernet@16030000 {
+        compatible = "starfive,jh7110-gmac", "snps,dwmac-5.20";
+        reg = <0x16030000 0x10000>;
+        clocks = <&aoncrg JH7110_AONCLK_GMAC0_AXI>,
+                 <&aoncrg JH7110_AONCLK_GMAC0_AHB>,
+                 <&syscrg JH7110_SYSCLK_GMAC0_PTP>,
+                 <&syscrg JH7110_SYSCLK_GMAC0_GTXC>,
+                 <&aoncrg JH7110_AONCLK_GMAC0_TX_INV>;
+        clock-names = "stmmaceth", "pclk", "ptp_ref",
+                      "gtxc", "tx";
+        resets = <&aoncrg JH7110_AONRST_GMAC0_AXI>;
+        reset-names = "stmmaceth";
+        interrupts = <7>, <6>, <5>;
+        interrupt-names = "macirq", "eth_wake_irq", "eth_lpi";
+        max-frame-size = <9000>;
+        phy-mode = "rgmii-id";
+        snps,multicast-filter-bins = <64>;
+        snps,perfect-filter-entries = <128>;
+        rx-fifo-depth = <2048>;
+        tx-fifo-depth = <2048>;
+        snps,fixed-burst;
+        snps,no-pbl-x8;
+        snps,force_thresh_dma_mode;
+        snps,axi-config = <&stmmac_axi_setup>;
+        snps,tso;
+        snps,en-tx-lpi-clockgating;
+        snps,en-lpi;
+        snps,write-requests = <4>;
+        snps,read-requests = <4>;
+        snps,burst-map = <0x7>;
+        snps,txpbl = <16>;
+        snps,rxpbl = <16>;
+    };
diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
index d8779d3de3d6..ee32081e6213 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
@@ -90,6 +90,8 @@ properties:
         - snps,dwmac-5.10a
         - snps,dwxgmac
         - snps,dwxgmac-2.10
+        - starfive,jh7100-gmac
+        - starfive,jh7110-gmac
 
   reg:
     minItems: 1
-- 
Armbian

