20261127在RK3576的Android14系统下适配2个以太网卡RTL821F-CG【无外部晶振模式】
2026/11/27 10:48
Y:\RK3576_Android14.0_SDK_RELEASE\kernel-6.1\arch\arm64\boot\dts\rockchip\rk3576-evb1.dtsi
1、gmac0/gmac1:
&dsi_panel {
power-supply = <&vcc3v3_lcd_n>;
};
&gmac0 {
/* Use rgmii-rxid mode to disable rx delay inside Soc */
phy-mode = "rgmii-rxid";
clock_in_out = "output";
//snps,reset-gpio = <&gpio2 RK_PB5 GPIO_ACTIVE_LOW>;
snps,reset-gpio = <&gpio2 RK_PB3 GPIO_ACTIVE_LOW>;
snps,reset-active-low;
/* Reset time is 20ms, 100ms for rtl8211f */
snps,reset-delays-us = <0 20000 100000>;
pinctrl-names = "default";
pinctrl-0 = <ð0m0_miim
ð0m0_tx_bus2
ð0m0_rx_bus2
ð0m0_rgmii_clk
ð0m0_rgmii_bus
ðm0_clk0_25m_out>;
tx_delay = <0x21>;
/* rx_delay = <0x3f>; */
phy-handle = <&rgmii_phy0>;
status = "okay";
};
&gmac1 {
/* Use rgmii-rxid mode to disable rx delay inside Soc */
phy-mode = "rgmii-rxid";
clock_in_out = "output";
//snps,reset-gpio = <&gpio3 RK_PA3 GPIO_ACTIVE_LOW>;
snps,reset-gpio = <&gpio2 RK_PB4 GPIO_ACTIVE_LOW>;
snps,reset-active-low;
/* Reset time is 20ms, 100ms for rtl8211f */
snps,reset-delays-us = <0 20000 100000>;
pinctrl-names = "default";
pinctrl-0 = <ð1m0_miim
ð1m0_tx_bus2
ð1m0_rx_bus2
ð1m0_rgmii_clk
ð1m0_rgmii_bus
ðm0_clk1_25m_out>;
tx_delay = <0x20>;
/* rx_delay = <0x3f>; */
phy-handle = <&rgmii_phy1>;
status = "okay";
};
>1x {
status = "okay";
power-supply = <&vcc3v3_lcd_n>;
};


GMAC0_RSTn GPIO2_B3_d



GMAC1_RSTn GPIO2_B4_d


2、
&mipidcphy0 {
status = "okay";
};
// 2026/11/26 13:49 close for gmac1
//&pcie0 {
// reset-gpios = <&gpio2 RK_PB4 GPIO_ACTIVE_HIGH>;
// rockchip,skip-scan-in-resume;
// pinctrl-names = "default";
// pinctrl-0 = <&wifi_poweren_gpio>;
// status = "okay";
//};
&pdm1 {
status = "disabled";
pinctrl-names = "default";
pinctrl-0 = <&pdm1m1_clk0
&pdm1m1_clk1
&pdm1m1_sdi0
&pdm1m1_sdi1
&pdm1m1_sdi2
&pdm1m1_sdi3>;
};

3、mdio0/mdio1
&i2c7 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&i2c7m1_xfer>;
icm42607_acc: icm_acc@68 {
status = "okay";
compatible = "icm42607_acc";
reg = <0x68>;
irq-gpio = <&gpio1 RK_PD5 IRQ_TYPE_EDGE_RISING>;
irq_enable = <0>;
poll_delay_ms = <30>;
type = <SENSOR_TYPE_ACCEL>;
layout = <4>;
};
icm42607_gyro: icm_gyro@68 {
status = "okay";
compatible = "icm42607_gyro";
reg = <0x68>;
poll_delay_ms = <30>;
type = <SENSOR_TYPE_GYROSCOPE>;
layout = <4>;
};
};
&mdio0 {
rgmii_phy0: phy@1 {
compatible = "ethernet-phy-ieee802.3-c22";
reg = <0x1>;
clocks = <&cru REFCLKO25M_GMAC0_OUT>;
};
};
&mdio1 {
rgmii_phy1: phy@1 {
compatible = "ethernet-phy-ieee802.3-c22";
reg = <0x1>;
clocks = <&cru REFCLKO25M_GMAC1_OUT>;
};
};
&mipidcphy0 {
status = "okay";
};
// 2026/11/26 13:49 close for gmac1
//&pcie0 {
// reset-gpios = <&gpio2 RK_PB4 GPIO_ACTIVE_HIGH>;
// rockchip,skip-scan-in-resume;
// pinctrl-names = "default";
// pinctrl-0 = <&wifi_poweren_gpio>;
// status = "okay";
//};

4、比对RTL8211F-CG以太网网卡芯片使用外部晶振的K7开发板:
Y:\RK3576_Android14.0_SDK_RELEASE\kernel-6.1\arch\arm64\boot\dts\rockchip\rk3576-evb1.dtsi
&gmac0 {
/* Use rgmii-rxid mode to disable rx delay inside Soc */
phy-mode = "rgmii-rxid";
clock_in_out = "output";
//snps,reset-gpio = <&gpio2 RK_PB5 GPIO_ACTIVE_LOW>;
snps,reset-gpio = <&gpio2 RK_PB3 GPIO_ACTIVE_LOW>;
snps,reset-active-low;
/* Reset time is 20ms, 100ms for rtl8211f */
snps,reset-delays-us = <0 20000 100000>;
pinctrl-names = "default";
pinctrl-0 = <ð0m0_miim
ð0m0_tx_bus2
ð0m0_rx_bus2
ð0m0_rgmii_clk
ð0m0_rgmii_bus
ðm0_clk0_25m_out>;
tx_delay = <0x21>;
/* rx_delay = <0x3f>; */
phy-handle = <&rgmii_phy0>;
status = "okay";
};
比对K7:
&gmac0 {
/* Use rgmii-rxid mode to disable rx delay inside Soc */
phy-mode = "rgmii-rxid";
clock_in_out = "output";
snps,reset-gpio = <&gpio2 RK_PB5 GPIO_ACTIVE_LOW>;
snps,reset-active-low;
/* Reset time is 20ms, 100ms for rtl8211f */
snps,reset-delays-us = <0 20000 100000>;
pinctrl-names = "default";
pinctrl-0 = <ð0m0_miim
ð0m0_tx_bus2
ð0m0_rx_bus2
ð0m0_rgmii_clk
ð0m0_rgmii_bus>;
// ðm0_clk0_25m_out>;
tx_delay = <0x21>;
/* rx_delay = <0x3f>; */
phy-handle = <&rgmii_phy0>;
status = "okay";
};

&mdio0 {
rgmii_phy0: phy@1 {
compatible = "ethernet-phy-ieee802.3-c22";
reg = <0x1>;
clocks = <&cru REFCLKO25M_GMAC0_OUT>;
};
};
比对K7开发板:
&mdio0 {
rgmii_phy0: phy@1 {
compatible = "ethernet-phy-ieee802.3-c22";
reg = <0x0>;
clocks = <&cru REFCLKO25M_GMAC0_OUT>;
};
};



5、使用iperf3打流实测网速:
console:/ #
console:/ # ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope: Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 TX bytes:0
dummy0 Link encap:Ethernet HWaddr 22:3c:57:a8:97:cc
inet6 addr: fe80::203c:57ff:fea8:97cc/64 Scope: Link
UP BROADCAST RUNNING NOARP MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 TX bytes:840
eth0 Link encap:Ethernet HWaddr 82:cc:70:27:8f:84 Driver rk_gmac-dwmac
inet addr:192.168.1.235 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: 2408:8256:348b:1ac3:9bc0:ca92:17dc:2e12/64 Scope: Global
inet6 addr: 2408:8256:348b:1ac3:a45c:dffe:d06:5ddb/64 Scope: Global
inet6 addr: fe80::4f98:6a47:c5ad:1b75/64 Scope: Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:14199274 errors:0 dropped:0 overruns:0 frame:0
TX packets:4165648 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:853268481 TX bytes:205497741167
Interrupt:57
eth1 Link encap:Ethernet HWaddr ee:4c:12:fd:1a:28 Driver rk_gmac-dwmac
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:14661390 errors:0 dropped:0 overruns:0 frame:0
TX packets:3999396 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:880920398 TX bytes:208193584035
Interrupt:59
console:/ #
eth0:
c:\iperf3.22>iperf3.exe -s
Server listening on 5201 (test #1)
Accepted connection from 192.168.1.235, port 55594
5 local 192.168.1.130 port 5201 connected to 192.168.1.235 port 55596
ID Interval Transfer Bitrate
5 0.00-1.01 sec 110 MBytes 919 Mbits/sec
5 1.01-2.00 sec 108 MBytes 915 Mbits/sec
5 2.00-3.01 sec 114 MBytes 942 Mbits/sec
5 3.01-4.01 sec 110 MBytes 930 Mbits/sec
5 4.01-5.01 sec 109 MBytes 910 Mbits/sec
5 5.01-6.00 sec 110 MBytes 931 Mbits/sec
5 1796.01-1797.00 sec 111 MBytes 943 Mbits/sec
5 1797.00-1798.00 sec 104 MBytes 879 Mbits/sec
5 1798.00-1799.01 sec 112 MBytes 930 Mbits/sec
5 1799.01-1800.01 sec 110 MBytes 921 Mbits/sec
5 1800.01-1800.02 sec 512 KBytes 965 Mbits/sec
ID Interval Transfer Bitrate
5 0.00-1800.02 sec 190 GBytes 909 Mbits/sec receiver
Server listening on 5201 (test #2)
iperf3: interrupt - the server has terminated by signal Interrupt(2)
c:\iperf3.22>
console:/ #
console:/ # iperf3 -c 192.168.1.130 -i 1 -t 1800
Connecting to host 192.168.1.130, port 5201
5 local 192.168.1.235 port 55596 connected to 192.168.1.130 port 5201
ID Interval Transfer Bitrate Retr Cwnd
5 0.00-1.00 sec 111 MBytes 934 Mbits/sec 180 275 KBytes
5 1.00-2.00 sec 109 MBytes 912 Mbits/sec 417 215 KBytes
5 2.00-3.00 sec 113 MBytes 945 Mbits/sec 310 238 KBytes
5 3.00-4.00 sec 111 MBytes 929 Mbits/sec 346 174 KBytes
5 4.00-5.00 sec 109 MBytes 913 Mbits/sec 323 215 KBytes
5 5.00-6.00 sec 110 MBytes 927 Mbits/sec 160 255 KBytes
5 1795.00-1796.00 sec 104 MBytes 869 Mbits/sec 333 144 KBytes
5 1796.00-1797.00 sec 112 MBytes 941 Mbits/sec 0 364 KBytes
5 1797.00-1798.00 sec 105 MBytes 877 Mbits/sec 385 238 KBytes
5 1798.00-1799.00 sec 111 MBytes 934 Mbits/sec 209 288 KBytes
5 1799.00-1800.00 sec 109 MBytes 919 Mbits/sec 325 214 KBytes
ID Interval Transfer Bitrate Retr
5 0.00-1800.00 sec 190 GBytes 909 Mbits/sec 572523 sender
5 0.00-1800.02 sec 190 GBytes 909 Mbits/sec receiver
iperf Done.
console:/ #

eth1:
c:\iperf3.22>iperf3.exe -s
Server listening on 5201 (test #1)
Accepted connection from 192.168.1.26, port 43486
5 local 192.168.1.130 port 5201 connected to 192.168.1.26 port 43488
ID Interval Transfer Bitrate
5 0.00-1.01 sec 110 MBytes 913 Mbits/sec
5 1.01-2.01 sec 110 MBytes 925 Mbits/sec
5 2.01-3.01 sec 113 MBytes 942 Mbits/sec
5 3.01-4.01 sec 111 MBytes 932 Mbits/sec
5 4.01-5.01 sec 111 MBytes 929 Mbits/sec
5 5.01-6.01 sec 112 MBytes 940 Mbits/sec
5 1795.00-1796.01 sec 105 MBytes 878 Mbits/sec
5 1796.01-1797.01 sec 111 MBytes 923 Mbits/sec
5 1797.01-1798.01 sec 107 MBytes 903 Mbits/sec
5 1798.01-1799.01 sec 111 MBytes 928 Mbits/sec
5 1799.01-1800.01 sec 110 MBytes 927 Mbits/sec
5 1800.01-1800.02 sec 896 KBytes 942 Mbits/sec
ID Interval Transfer Bitrate
5 0.00-1800.02 sec 193 GBytes 921 Mbits/sec receiver
Server listening on 5201 (test #2)
iperf3: interrupt - the server has terminated by signal Interrupt(2)
c:\iperf3.22>
console:/ # iperf3 -c 192.168.1.130 -i 1 -t 1800
Connecting to host 192.168.1.130, port 5201
5 local 192.168.1.26 port 43488 connected to 192.168.1.130 port 5201
ID Interval Transfer Bitrate Retr Cwnd
5 0.00-1.00 sec 111 MBytes 927 Mbits/sec 158 215 KBytes
5 1.00-2.00 sec 110 MBytes 924 Mbits/sec 224 230 KBytes
5 2.00-3.00 sec 112 MBytes 941 Mbits/sec 232 227 KBytes
5 3.00-4.00 sec 112 MBytes 935 Mbits/sec 255 163 KBytes
5 4.00-5.00 sec 111 MBytes 931 Mbits/sec 106 255 KBytes
5 5.00-6.00 sec 112 MBytes 938 Mbits/sec 279 252 KBytes
5 1795.00-1796.00 sec 105 MBytes 881 Mbits/sec 494 207 KBytes
5 1796.00-1797.00 sec 109 MBytes 919 Mbits/sec 431 153 KBytes
5 1797.00-1798.00 sec 108 MBytes 906 Mbits/sec 291 111 KBytes
5 1798.00-1799.00 sec 111 MBytes 928 Mbits/sec 273 232 KBytes
5 1799.00-1800.00 sec 110 MBytes 927 Mbits/sec 323 155 KBytes
ID Interval Transfer Bitrate Retr
5 0.00-1800.00 sec 193 GBytes 921 Mbits/sec 532931 sender
5 0.00-1800.02 sec 193 GBytes 921 Mbits/sec receiver
iperf Done.
console:/ #
