[PATCH 07/12] dt-bindings: net: Add StarFive JH7100 SoC

From: Cristian Ciocaltea
Date: Fri Feb 10 2023 - 22:19:34 EST


Add DT bindings documentation for the Synopsys DesignWare MAC found on
the StarFive JH7100 SoC.

Adjust 'reset' and 'reset-names' properties to allow using 'ahb' instead
of the 'stmmaceth' reset signal, as required by JH7100.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@xxxxxxxxxxxxx>
---
.../devicetree/bindings/net/snps,dwmac.yaml | 15 ++-
.../bindings/net/starfive,jh7100-dwmac.yaml | 106 ++++++++++++++++++
MAINTAINERS | 5 +
3 files changed, 122 insertions(+), 4 deletions(-)
create mode 100644 Documentation/devicetree/bindings/net/starfive,jh7100-dwmac.yaml

diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
index e88a86623fce..71522a2cd7a4 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
@@ -89,6 +89,7 @@ properties:
- snps,dwmac-5.10a
- snps,dwxgmac
- snps,dwxgmac-2.10
+ - starfive,jh7100-dwmac

reg:
minItems: 1
@@ -131,12 +132,17 @@ properties:
- ptp_ref

resets:
- maxItems: 1
- description:
- MAC Reset signal.
+ minItems: 1
+ items:
+ - description: MAC Reset signal
+ - description: AHB Reset signal

reset-names:
- const: stmmaceth
+ minItems: 1
+ contains:
+ enum:
+ - stmmaceth
+ - ahb

power-domains:
maxItems: 1
@@ -578,6 +584,7 @@ allOf:
- snps,dwxgmac
- snps,dwxgmac-2.10
- st,spear600-gmac
+ - starfive,jh7100-dwmac

then:
properties:
diff --git a/Documentation/devicetree/bindings/net/starfive,jh7100-dwmac.yaml b/Documentation/devicetree/bindings/net/starfive,jh7100-dwmac.yaml
new file mode 100644
index 000000000000..6afe30690172
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/starfive,jh7100-dwmac.yaml
@@ -0,0 +1,106 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2022 StarFive Technology Co., Ltd.
+# Copyright (C) 2022 Emil Renner Berthing <kernel@xxxxxxxx>
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/starfive,jh7100-dwmac.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: StarFive JH7100 DWMAC Ethernet Controller
+
+maintainers:
+ - Emil Renner Berthing <kernel@xxxxxxxx>
+
+# We need a select here so we don't match all nodes with 'snps,dwmac'
+select:
+ properties:
+ compatible:
+ contains:
+ const: starfive,jh7100-dwmac
+ required:
+ - compatible
+
+allOf:
+ - $ref: snps,dwmac.yaml#
+
+properties:
+ compatible:
+ items:
+ - const: starfive,jh7100-dwmac
+ - const: snps,dwmac
+
+ clocks:
+ items:
+ - description: GMAC main clock
+ - description: GMAC AHB clock
+ - description: PTP clock
+ - description: GTX clock
+ - description: TX clock
+
+ clock-names:
+ items:
+ - const: stmmaceth
+ - const: pclk
+ - const: ptp_ref
+ - const: gtxc
+ - const: tx
+
+ resets:
+ description: AHB Reset signal
+
+ reset-names:
+ const: ahb
+
+ 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
+ - clocks
+ - clock-names
+ - resets
+ - reset-names
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/clock/starfive-jh7100.h>
+ #include <dt-bindings/reset/starfive-jh7100.h>
+
+ gmac: ethernet@10020000 {
+ compatible = "starfive,jh7100-dwmac", "snps,dwmac";
+ reg = <0x0 0x10020000 0x0 0x10000>;
+ clocks = <&clkgen JH7100_CLK_GMAC_ROOT_DIV>,
+ <&clkgen JH7100_CLK_GMAC_AHB>,
+ <&clkgen JH7100_CLK_GMAC_PTP_REF>,
+ <&clkgen JH7100_CLK_GMAC_GTX>,
+ <&clkgen JH7100_CLK_GMAC_TX_INV>;
+ clock-names = "stmmaceth", "pclk", "ptp_ref", "gtxc", "tx";
+ resets = <&rstgen JH7100_RSTN_GMAC_AHB>;
+ reset-names = "ahb";
+ interrupts = <6>, <7>;
+ interrupt-names = "macirq", "eth_wake_irq";
+ max-frame-size = <9000>;
+ phy-mode = "rgmii-txid";
+ snps,multicast-filter-bins = <32>;
+ snps,perfect-filter-entries = <128>;
+ starfive,syscon = <&sysmain>;
+ rx-fifo-depth = <32768>;
+ tx-fifo-depth = <16384>;
+ snps,axi-config = <&stmmac_axi_setup>;
+ snps,fixed-burst;
+ snps,force_thresh_dma_mode;
+ snps,no-pbl-x8;
+
+ stmmac_axi_setup: stmmac-axi-config {
+ snps,wr_osr_lmt = <0xf>;
+ snps,rd_osr_lmt = <0xf>;
+ snps,blen = <256 128 64 32 0 0 0>;
+ };
+ };
diff --git a/MAINTAINERS b/MAINTAINERS
index abed40db41f0..d48468b81b94 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -19816,6 +19816,11 @@ M: Emil Renner Berthing <kernel@xxxxxxxx>
S: Maintained
F: arch/riscv/boot/dts/starfive/

+STARFIVE DWMAC GLUE LAYER
+M: Emil Renner Berthing <kernel@xxxxxxxx>
+S: Maintained
+F: Documentation/devicetree/bindings/net/starfive,jh7100-dwmac.yaml
+
STARFIVE JH7100 CLOCK DRIVERS
M: Emil Renner Berthing <kernel@xxxxxxxx>
S: Maintained
--
2.39.1