Skip to content

Commit 0104340

Browse files
Samin GuoConchuOD
authored andcommitted
riscv: dts: starfive: visionfive 2: Add configuration of gmac and phy
v1.3B: v1.3B uses motorcomm YT8531(rgmii-id phy) x2, need delay and inverse configurations. The tx_clk of v1.3B uses an external clock and needs to be switched to an external clock source. v1.2A: v1.2A gmac0 uses motorcomm YT8531(rgmii-id) PHY, and needs delay configurations. v1.2A gmac1 uses motorcomm YT8512(rmii) PHY, and needs to switch rx and rx to external clock sources. Tested-by: Tommaso Merciai <tomm.merciai@gmail.com> Signed-off-by: Samin Guo <samin.guo@starfivetech.com> [conor: squashed a fix from Samin to use the actual properties] Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
1 parent 1ff166c commit 0104340

3 files changed

Lines changed: 78 additions & 0 deletions

File tree

arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2-v1.2a.dts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,16 @@
1111
model = "StarFive VisionFive 2 v1.2A";
1212
compatible = "starfive,visionfive-2-v1.2a", "starfive,jh7110";
1313
};
14+
15+
&gmac1 {
16+
phy-mode = "rmii";
17+
assigned-clocks = <&syscrg JH7110_SYSCLK_GMAC1_TX>,
18+
<&syscrg JH7110_SYSCLK_GMAC1_RX>;
19+
assigned-clock-parents = <&syscrg JH7110_SYSCLK_GMAC1_RMII_RTX>,
20+
<&syscrg JH7110_SYSCLK_GMAC1_RMII_RTX>;
21+
};
22+
23+
&phy0 {
24+
rx-internal-delay-ps = <1900>;
25+
tx-internal-delay-ps = <1350>;
26+
};

arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2-v1.3b.dts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,34 @@
1111
model = "StarFive VisionFive 2 v1.3B";
1212
compatible = "starfive,visionfive-2-v1.3b", "starfive,jh7110";
1313
};
14+
15+
&gmac0 {
16+
starfive,tx-use-rgmii-clk;
17+
assigned-clocks = <&aoncrg JH7110_AONCLK_GMAC0_TX>;
18+
assigned-clock-parents = <&aoncrg JH7110_AONCLK_GMAC0_RMII_RTX>;
19+
};
20+
21+
&gmac1 {
22+
starfive,tx-use-rgmii-clk;
23+
assigned-clocks = <&syscrg JH7110_SYSCLK_GMAC1_TX>;
24+
assigned-clock-parents = <&syscrg JH7110_SYSCLK_GMAC1_RMII_RTX>;
25+
};
26+
27+
&phy0 {
28+
motorcomm,tx-clk-adj-enabled;
29+
motorcomm,tx-clk-100-inverted;
30+
motorcomm,tx-clk-1000-inverted;
31+
motorcomm,rx-clk-drv-microamp = <3970>;
32+
motorcomm,rx-data-drv-microamp = <2910>;
33+
rx-internal-delay-ps = <1500>;
34+
tx-internal-delay-ps = <1500>;
35+
};
36+
37+
&phy1 {
38+
motorcomm,tx-clk-adj-enabled;
39+
motorcomm,tx-clk-100-inverted;
40+
motorcomm,rx-clk-drv-microamp = <3970>;
41+
motorcomm,rx-data-drv-microamp = <2910>;
42+
rx-internal-delay-ps = <300>;
43+
tx-internal-delay-ps = <0>;
44+
};

arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
/ {
1313
aliases {
14+
ethernet0 = &gmac0;
15+
ethernet1 = &gmac1;
1416
i2c0 = &i2c0;
1517
i2c2 = &i2c2;
1618
i2c5 = &i2c5;
@@ -94,6 +96,38 @@
9496
clock-frequency = <49152000>;
9597
};
9698

99+
&gmac0 {
100+
phy-handle = <&phy0>;
101+
phy-mode = "rgmii-id";
102+
status = "okay";
103+
104+
mdio {
105+
#address-cells = <1>;
106+
#size-cells = <0>;
107+
compatible = "snps,dwmac-mdio";
108+
109+
phy0: ethernet-phy@0 {
110+
reg = <0>;
111+
};
112+
};
113+
};
114+
115+
&gmac1 {
116+
phy-handle = <&phy1>;
117+
phy-mode = "rgmii-id";
118+
status = "okay";
119+
120+
mdio {
121+
#address-cells = <1>;
122+
#size-cells = <0>;
123+
compatible = "snps,dwmac-mdio";
124+
125+
phy1: ethernet-phy@1 {
126+
reg = <0>;
127+
};
128+
};
129+
};
130+
97131
&i2c0 {
98132
clock-frequency = <100000>;
99133
i2c-sda-hold-time-ns = <300>;

0 commit comments

Comments
 (0)