1 From 6fd84cb9cceaa711671500a92dcee5b1072ab95a Mon Sep 17 00:00:00 2001
2 From: Samin Guo <samin.guo@starfivetech.com>
3 Date: Tue, 1 Nov 2022 18:11:02 +0800
4 Subject: [PATCH 047/122] riscv: dts: starfive: visionfive 2: Add configuration
8 v1.3B uses motorcomm YT8531(rgmii-id phy) x2, need delay and
9 inverse configurations.
10 The tx_clk of v1.3B uses an external clock and needs to be
11 switched to an external clock source.
14 v1.2A gmac0 uses motorcomm YT8531(rgmii-id) PHY, and needs delay
16 v1.2A gmac1 uses motorcomm YT8512(rmii) PHY, and needs to
17 switch rx and rx to external clock sources.
19 Tested-by: Tommaso Merciai <tomm.merciai@gmail.com>
20 Signed-off-by: Samin Guo <samin.guo@starfivetech.com>
22 .../jh7110-starfive-visionfive-2-v1.2a.dts | 13 +++++++
23 .../jh7110-starfive-visionfive-2-v1.3b.dts | 27 +++++++++++++++
24 .../jh7110-starfive-visionfive-2.dtsi | 34 +++++++++++++++++++
25 3 files changed, 74 insertions(+)
27 diff --git a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2-v1.2a.dts b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2-v1.2a.dts
28 index 4af3300f3cf3..205a13d8c8b1 100644
29 --- a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2-v1.2a.dts
30 +++ b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2-v1.2a.dts
32 model = "StarFive VisionFive 2 v1.2A";
33 compatible = "starfive,visionfive-2-v1.2a", "starfive,jh7110";
38 + assigned-clocks = <&syscrg JH7110_SYSCLK_GMAC1_TX>,
39 + <&syscrg JH7110_SYSCLK_GMAC1_RX>;
40 + assigned-clock-parents = <&syscrg JH7110_SYSCLK_GMAC1_RMII_RTX>,
41 + <&syscrg JH7110_SYSCLK_GMAC1_RMII_RTX>;
45 + rx-internal-delay-ps = <1900>;
46 + tx-internal-delay-ps = <1350>;
48 diff --git a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2-v1.3b.dts b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2-v1.3b.dts
49 index 9230cc3d8946..ff01bea01372 100644
50 --- a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2-v1.3b.dts
51 +++ b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2-v1.3b.dts
53 model = "StarFive VisionFive 2 v1.3B";
54 compatible = "starfive,visionfive-2-v1.3b", "starfive,jh7110";
58 + starfive,tx-use-rgmii-clk;
59 + assigned-clocks = <&aoncrg JH7110_AONCLK_GMAC0_TX>;
60 + assigned-clock-parents = <&aoncrg JH7110_AONCLK_GMAC0_RMII_RTX>;
64 + starfive,tx-use-rgmii-clk;
65 + assigned-clocks = <&syscrg JH7110_SYSCLK_GMAC1_TX>;
66 + assigned-clock-parents = <&syscrg JH7110_SYSCLK_GMAC1_RMII_RTX>;
70 + motorcomm,tx-clk-adj-enabled;
71 + motorcomm,tx-clk-100-inverted;
72 + motorcomm,tx-clk-1000-inverted;
73 + rx-internal-delay-ps = <1500>;
74 + tx-internal-delay-ps = <1500>;
78 + motorcomm,tx-clk-adj-enabled;
79 + motorcomm,tx-clk-100-inverted;
80 + rx-internal-delay-ps = <300>;
81 + tx-internal-delay-ps = <0>;
83 diff --git a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi
84 index 2a6d81609284..8d5b36fbd420 100644
85 --- a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi
86 +++ b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi
97 clock-frequency = <49152000>;
101 + phy-handle = <&phy0>;
102 + phy-mode = "rgmii-id";
106 + #address-cells = <1>;
108 + compatible = "snps,dwmac-mdio";
110 + phy0: ethernet-phy@0 {
117 + phy-handle = <&phy1>;
118 + phy-mode = "rgmii-id";
122 + #address-cells = <1>;
124 + compatible = "snps,dwmac-mdio";
126 + phy1: ethernet-phy@1 {
133 clock-frequency = <100000>;
134 i2c-sda-hold-time-ns = <300>;