T507 buildroot linux4.9之RLT8211F 1000M以太网开发调试
文章目录
- 前言
- 一、硬件确认
- 1.1、RLT8211硬件
- 二、驱动配置
- 2.1、驱动位置
- 2.2、使用config宏配置驱动
- 2.3、gmac驱动调试中遇到的问题
- 2.3.1、问题描述
- 1)、phy初始化失败问题
- 2)、初始化正常后,ping测试失败
- 3)、led灯异常,绿灯不亮,黄灯闪烁
- 2.3.2、分析问题
- 1)、phy初始化失败问题分析
- 2)、初始化正常后,ping测试失败分析
- 3)、led灯异常,绿灯不亮,黄灯闪烁分析
- 2.3.3、处理问题
- 1)、phy初始化失败问题处理
- 2)、初始化正常后,ping测试失败分析
- 3)、led灯异常,绿灯不亮,黄灯闪烁分析
- 三、测试
- 3.2、同网段ping测试
- 3.3、同网段iperf测试
前言
调试T507的gmac,解决该RTL8211F 1000m以太网中调试遇到的问题
一、硬件确认
1.1、RLT8211硬件
通过原理图确认RTL8211F硬件的电压供应,复位等配置,复位是否是上电时进行复位了,是就不需要通过额外的IO配置进行复位配置。
phy复位的io电压需要3.3V,另外phy data IO的电压确认是1.8v或者3.3v,需要接项目原理图上的配置进行确认。
二、驱动配置
2.1、驱动位置
定为驱动,使用内核中的驱动即可
gmac驱动:
linux-4.9/drivers/net/ethernet/allwinner/sunxi-gmac.c
使用宏来配置驱动。
2.2、使用config宏配置驱动
--- a/kernel/linux-4.9/arch/arm64/configs/sun50iw9p1smp_longan_defconfig
+++ b/kernel/linux-4.9/arch/arm64/configs/sun50iw9p1smp_longan_defconfig
@@ -1387,6 +1387,7 @@ CONFIG_ETHERNET=y
CONFIG_NET_VENDOR_ALLWINNER=y
# CONFIG_SUN4I_EMAC is not set
CONFIG_SUNXI_GMAC=y
+CONFIG_SUNXI_EXT_PHY=y
# CONFIG_ALTERA_TSE is not set
CONFIG_NET_VENDOR_AMAZON=y
CONFIG_NET_VENDOR_AMD=y
2.3、gmac驱动调试中遇到的问题
2.3.1、问题描述
1)、phy初始化失败问题
2)、初始化正常后,ping测试失败
3)、led灯异常,绿灯不亮,黄灯闪烁
2.3.2、分析问题
1)、phy初始化失败问题分析
首先先是确认phy的供电,测量后供电是正常的,确认data io的电压。硬件上使用的是1.8v的电压,测量也是正常的。
phy 的addr,在全志的驱动中对phy的地址做了兼容好像,phy地址也填写正确。再者就是cpu的io被复用这个也是很关键,也需要进行排查。
2)、初始化正常后,ping测试失败分析
首先是系统的route设置是否正确,然后就是确认phy的data io的工作电压,另外1.8v的模式下如果工作异常,则刚换到3.3v的模式下工作进行验证,tx-delay参数,0-7共8档,每档将采样时间推迟约536ps,rx-delay参数,0~31共32挡,
每档将采样时间推迟约130ps。需要过硬件测量进入soc的data和clk相位差,通过调整tx-delay参数和rx-delay参数。
3)、led灯异常,绿灯不亮,黄灯闪烁分析
驱动中没有对相应的寄存器配置好,联系fae获取补丁,以下补丁直接用即可。
2.3.3、处理问题
1)、phy初始化失败问题处理
a、phy的复位电压由io的1.8v复位更换为3.3v上电复位。RTL8211F的复位中电压值必须是3.3v才能进行正确复位的
b、处理io复用的问题
处理device/config/chips/t507/configs/demo2.0/board.dts中io复用的问题。
diff --git a/device/config/chips/t507/configs/demo2.0/board.dts b/device/config/chips/t507/configs/demo2.0/board.dts
index c31e6f2bf5..91ddc70d6e 100755
--- a/device/config/chips/t507/configs/demo2.0/board.dts
+++ b/device/config/chips/t507/configs/demo2.0/board.dts
@@ -14,7 +14,7 @@
reg_usb_vbus: usb-vbus {
compatible = "regulator-fixed";
- gpio = <&pio PI 11 1 2 0 1>;
+ //gpio = <&pio PI 11 1 2 0 1>;
regulator-name = "usb-vbus";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
@@ -304,10 +304,29 @@
allwinner,muxsel = <6>;
allwinner,drive = <1>;
allwinner,pull = <0>;
- };
+ };
- };
+ gmac_pins_a: gmac@0 {
+ allwinner,pins = "PI0", "PI1", "PI2", "PI3", "PI4",
+ "PI5","PI7", "PI8", "PI9", "PI10",
+ "PI11","PI12","PI13","PI14","PI15";
+ allwinner,function = "gmac0";
+ allwinner,muxsel = <2>;
+ allwinner,drive = <3>;
+ allwinner,pull = <0>;
+ };
+ gmac_pins_b: gmac@1 {
+ allwinner,pins = "PI0", "PI1", "PI2", "PI3", "PI4",
+ "PI5","PI7", "PI8", "PI9", "PI10",
+ "PI11","PI12","PI13","PI14","PI15";
+ allwinner,function = "io_disabled";
+ allwinner,muxsel = <7>;
+ allwinner,drive = <3>;
+ allwinner,pull = <0>;
+ };
+ };
+
spi0: spi@05010000 {
pinctrl-0 = <&spi0_pins_a &spi0_pins_b>;
pinctrl-1 = <&spi0_pins_c>;
@@ -418,6 +437,23 @@
status = "okay";
};
+ gmac0: eth@05020000{
+ phy-mode = "rgmii";
+ phy-rst = <&pio PI 16 1 1 1 0>;
+ use_ephy25m = <0>;
+ pinctrl-0 = <&gmac_pins_a>;
+ pinctrl-1 = <&gmac_pins_b>;
+ tx-delay = <0>;//txdelay参数,0~7共8档, 每档将采样时间推迟约536ps
+ rx-delay = <1>;//rxdelay参数,0~31共32挡,每档将采样时间推迟约130ps
+ gmac-power0-supply;
+ gmac-power1-supply;
+ gmac-power2-supply;
+ gmac-power0-vol;
+ gmac-power1-vol;
+ gmac-power2-vol;
+ status = "okay";
+ };
+
@@ -540,8 +583,8 @@
source = <0x1>;
oview = <0x0>;
oview_type = <0x4>;
- reverse_pin = <&pio PI 15 6 0 1 0>;
- status = "okay";
+ //reverse_pin = <&pio PI 15 6 0 1 0>;
+ status = "disabled";
};
addr_mgt:addr_mgt {
compatible = "allwinner,sunxi-addr_mgt";
@@ -556,8 +599,8 @@
usb_port_type = <0x2>;
usb_detect_type = <0x1>;
usb_detect_mode = <0x0>;
- usb_id_gpio = <&pio PI 9 0 1 0xffffffff 0xffffffff>;
- usb_det_vbus_gpio = <&pio PI 10 0 1 0xffffffff 0xffffffff>;
+ //usb_id_gpio = <&pio PI 9 0 1 0xffffffff 0xffffffff>;
+ //usb_det_vbus_gpio = <&pio PI 10 0 1 0xffffffff 0xffffffff>;
usb_regulator_io = "nocare";
usb_wakeup_suspend = <0x0>;
usb_luns = <0x3>;
@@ -576,7 +619,7 @@
usbc1:usbc1@0 {
device_type = "usbc1";
- usb_drv_vbus_gpio = <&pio PI 11 0 1 0xffffffff 0xffffffff>;
+ //usb_drv_vbus_gpio = <&pio PI 11 0 1 0xffffffff 0xffffffff>;
usb_host_init_state = <0x1>;
usb_regulator_io = "nocare";
usb_wakeup_suspend = <0x0>;
@@ -696,13 +739,13 @@
};
snddaudio0:sound@0{
- /* ac107-codec throught daudio0*/
- sunxi,snddaudio-codec = "ac107.3-0036";
- sunxi,snddaudio-codec-dai = "ac107-pcm0";
+ // pin 31 pull down, i2c1_0x20
+ sunxi,snddaudio-codec = "es8316.1-0020";
+ sunxi,snddaudio-codec-dai = "ES8316 HiFi";
daudio_master = <0x04>;
audio_format = <0x01>;
signal_inversion = <0x01>;
- status = "okay";
+ status = "disabled";
};
sndhdmi:sound@1{
@@ -840,8 +883,8 @@ vinc(x)_sensor_list: use sensor list
sensor0_dvdd-supply = <®_bldo5>;
sensor0_dvdd_vol = <1200000>;
sensor0_power_en = <>;
- sensor0_reset = <&pio PI 13 1 0 1 0>;
- sensor0_pwdn = <&pio PI 14 1 0 1 0>;
+ //sensor0_reset = <&pio PI 13 1 0 1 0>;
+ //sensor0_pwdn = <&pio PI 14 1 0 1 0>;
sensor0_sm_vs = <&pio PE 22 1 0 1 0>;
status = "okay";
};
@@ -868,8 +911,8 @@ vinc(x)_sensor_list: use sensor list
sensor1_dvdd-supply = <®_bldo5>;
sensor1_dvdd_vol = <1200000>;
sensor1_power_en = <>;
- sensor1_reset = <&pio PI 12 1 0 1 0>;
- sensor1_pwdn = <&pio PI 14 1 0 1 0>;
+ //sensor1_reset = <&pio PI 12 1 0 1 0>;
+ //sensor1_pwdn = <&pio PI 14 1 0 1 0>;
sensor1_sm_vs = <>;
status = "okay";
};
@@ -1354,15 +1397,16 @@ pull up or pull down(default 0), driver level(default 1), data>
reg_dcdc6: dcdc6 {
regulator-name = "axp858-dcdc6";
regulator-min-microvolt = <500000>;
regulator-max-microvolt = <3400000>;
regulator-step-delay-us = <25>;
regulator-final-delay-us = <50>;
+ regulator-always-on;
};
reg_aldo1: aldo1 {
regulator-name = "axp858-aldo1";
- regulator-min-microvolt = <700000>;
+ regulator-min-microvolt = <3000000>;
regulator-max-microvolt = <3300000>;
regulator-step-delay-us = <25>;
regulator-final-delay-us = <50>;
regulator-always-on;
@@ -1609,7 +1653,6 @@ pull up or pull down(default 0), driver level(default 1), data>
hym8563_51@51 {
compatible = "haoyu,hym8563";
reg = <0x51>;
- };
-
+ };
};
处理device/config/chips/t507/configs/demo2.0/sys_config.fex的io复用
\ No newline at end of file
diff --git a/device/config/chips/t507/configs/demo2.0/sys_config.fex b/device/config/chips/t507/configs/demo2.0/sys_config.fex
index ff3a11776a..73722c4b20 100755
--- a/device/config/chips/t507/configs/demo2.0/sys_config.fex
+++ b/device/config/chips/t507/configs/demo2.0/sys_config.fex
@@ -715,123 +715,6 @@ dram_tpr11 = 0x22262622
dram_tpr12 = 0x0b0c0d0b
dram_tpr13 = 0x61
-
-;----------------------------------------------------------------------------------
-;os life cycle para configuration
-;----------------------------------------------------------------------------------
-
-;------------------------------------------------------------------------------;
-; 10/100/100Mbps Ethernet MAC Controller Configure ;
-;------------------------------------------------------------------------------;
-; 配置选项: ;
-; gmac_used --- 1: gmac used, 0: not used ;
-;------------------------------------------------------------------------------;
-; MII GMII RGMII MII GMII RGMII MII GMII RGMII ;
-;PA00~03 * * * PA10 * * PA20 * * * ;
-; PA04 * PA11~14 * * * PA21 * * ;
-; PA05 * PA15 * PA22 * * ;
-; PA06 * PA16 * PA23 * * ;
-; PA07 * PA17 * PA24 * * ;
-; PA08 * * PA18 * PA25 * * ;
-; PA09 * * * PA19 * * * PA26~27 * * * ;
-;------------------------------------------------------------------------------;
-[gmac0]
-gmac0_used = 0
-phy-mode = "rgmii"
-gmac_rxd3 = port:PA00<2><default><default><default>
-gmac_rxd2 = port:PA01<2><default><default><default>
-gmac_rxd1 = port:PA02<2><default><default><default>
-gmac_rxd0 = port:PA03<2><default><default><default>
-gmac_rxck = port:PA04<2><default><default><default>
-gmac_rxctl = port:PA05<2><default><default><default>
-gmac_clkin = port:PA06<2><default><default><default>
-gmac_txd3 = port:PA07<2><default><default><default>
-gmac_txd2 = port:PA08<2><default><default><default>
-gmac_txd1 = port:PA09<2><default><default><default>
-;gmac_txd0 = port:PA10<2><default><default><default>
-;gmac_txck = port:PA11<2><default><default><default>
-gmac_txctl = port:PA12<2><default><default><default>
-gmac_mdc = port:PA13<2><default><default><default>
-gmac_mdio = port:PA14<2><default><default><default>
-gmac_fpga1 = port:PA15<2><default><default><default>
-gmac_fpga2 = port:PA16<2><default><default><default>
-gmac_fpga3 = port:PA17<2><default><default><default>
-gmac_fpga4 = port:PA18<2><default><default><default>
-gmac_fpga5 = port:PA19<2><default><default><default>
-gmac_fpga7 = port:PA20<2><default><default><default>
-gmac_fpga8 = port:PA21<2><default><default><default>
-gmac_fpga9 = port:PA22<2><default><default><default>
-gmac_fpga10 = port:PA23<2><default><default><default>
-gmac_fpga11 = port:PA24<2><default><default><default>
-gmac_fpga12 = port:PA25<2><default><default><default>
-gmac_fpga13 = port:PA26<2><default><default><default>
-gmac_fpga14 = port:PA27<2><default><default><default>
-gmac_fpga15 = port:PA28<2><default><default><default>
-gmac_fpga16 = port:PA29<2><default><default><default>
-gmac_fpga17 = port:PA30<2><default><default><default>
-gmac_fpga18 = port:PA31<2><default><default><default>
-gmac-power0 = ""
-gmac-power1 = ""
-gmac-power2 = ""
-tx-delay = 0
-rx-delay = 0
-
-;------------------------------------------------------------------------------;
-; 10/100/100Mbps Ethernet MAC Controller Configure ;
-;------------------------------------------------------------------------------;
-; 配置选项: ;
-; gmac_used --- 1: gmac used, 0: not used ;
-;------------------------------------------------------------------------------;
-; MII GMII RGMII MII GMII RGMII MII GMII RGMII ;
-;PA00~03 * * * PA10 * * PA20 * * * ;
-; PA04 * PA11~14 * * * PA21 * * ;
-; PA05 * PA15 * PA22 * * ;
-; PA06 * PA16 * PA23 * * ;
-; PA07 * PA17 * PA24 * * ;
-; PA08 * * PA18 * PA25 * * ;
-; PA09 * * * PA19 * * * PA26~27 * * * ;
-;------------------------------------------------------------------------------;
-[gmac1]
-gmac1_used = 0
-phy-mode = "rgmii"
-gmac_rxd3 = port:PA00<2><default><default><default>
-gmac_rxd2 = port:PA01<2><default><default><default>
-gmac_rxd1 = port:PA02<2><default><default><default>
-gmac_rxd0 = port:PA03<2><default><default><default>
-gmac_rxck = port:PA04<2><default><default><default>
-gmac_rxctl = port:PA05<2><default><default><default>
-gmac_clkin = port:PA06<2><default><default><default>
-gmac_txd3 = port:PA07<2><default><default><default>
-gmac_txd2 = port:PA08<2><default><default><default>
-gmac_txd1 = port:PA09<2><default><default><default>
-;gmac_txd0 = port:PA10<2><default><default><default>
-;gmac_txck = port:PA11<2><default><default><default>
-gmac_txctl = port:PA12<2><default><default><default>
-gmac_mdc = port:PA13<2><default><default><default>
-gmac_mdio = port:PA14<2><default><default><default>
-gmac_fpga1 = port:PA15<2><default><default><default>
-gmac_fpga2 = port:PA16<2><default><default><default>
-gmac_fpga3 = port:PA17<2><default><default><default>
-gmac_fpga4 = port:PA18<2><default><default><default>
-gmac_fpga5 = port:PA19<2><default><default><default>
-gmac_fpga7 = port:PA20<2><default><default><default>
-gmac_fpga8 = port:PA21<2><default><default><default>
-gmac_fpga9 = port:PA22<2><default><default><default>
-gmac_fpga10 = port:PA23<2><default><default><default>
-gmac_fpga11 = port:PA24<2><default><default><default>
-gmac_fpga12 = port:PA25<2><default><default><default>
-gmac_fpga13 = port:PA26<2><default><default><default>
-gmac_fpga14 = port:PA27<2><default><default><default>
-gmac_fpga15 = port:PA28<2><default><default><default>
-gmac_fpga16 = port:PA29<2><default><default><default>
-gmac_fpga17 = port:PA30<2><default><default><default>
-gmac_fpga18 = port:PA31<2><default><default><default>
-gmac-power0 = ""
-gmac-power1 = ""
-gmac-power2 = ""
-tx-delay = 0
-rx-delay = 0
-
处理kernel/linux-4.9/arch/arm64/boot/dts/sunxi/sun50iw9p1-pinctrl.dtsi的io复用
;----------------------------------------------------------------------------------
;uart configuration
;uart_type --- 2 (2 wire), 4 (4 wire), 8 (8 wire, full function)
diff --git a/kernel/linux-4.9/arch/arm64/boot/dts/sunxi/sun50iw9p1-pinctrl.dtsi b/kernel/linux-4.9/arch/arm64/boot/dts/sunxi/sun50iw9p1-pinctrl.dtsi
index e4cc7f2919..e91a70d47d 100755
--- a/kernel/linux-4.9/arch/arm64/boot/dts/sunxi/sun50iw9p1-pinctrl.dtsi
+++ b/kernel/linux-4.9/arch/arm64/boot/dts/sunxi/sun50iw9p1-pinctrl.dtsi
@@ -138,41 +138,6 @@
allwinner,pull = <0>;
};
- uart3_pins_a: uart3@0 {
- allwinner,pins = "PI9", "PI10", "PI11", "PI12";
- allwinner,pname = "uart3_tx", "uart3_rx",
- "uart3_rts", "uart3_cts";
- allwinner,function = "uart3";
- allwinner,muxsel = <3>;
- allwinner,drive = <1>;
- allwinner,pull = <1>;
- };
-
- uart3_pins_b: uart3@1 {
- allwinner,pins = "PI9", "PI10", "PI11", "PI12";
- allwinner,function = "io_disabled";
- allwinner,muxsel = <7>;
- allwinner,drive = <1>;
- allwinner,pull = <0>;
- };
-
- uart4_pins_a: uart4@0 {
- allwinner,pins = "PI13", "PI14", "PI15", "PI16";
- allwinner,pname = "uart4_tx", "uart4_rx",
- "uart4_rts", "uart4_cts";
- allwinner,function = "uart4";
- allwinner,muxsel = <3>;
- allwinner,drive = <1>;
- allwinner,pull = <1>;
- };
-
- uart4_pins_b: uart4@1 {
- allwinner,pins = "PI13", "PI14", "PI15", "PI16";
- allwinner,function = "io_disabled";
- allwinner,muxsel = <7>;
- allwinner,drive = <1>;
- allwinner,pull = <0>;
- };
uart5_pins_a: uart5@0 {
allwinner,pins = "PH2", "PH3";
@@ -450,23 +415,7 @@
allwinner,muxsel = <7>;
allwinner,drive = <1>;
allwinner,pull = <0>;
- };
-
- dmic_pins_a: dmic@0 {
- allwinner,pins = "PI0", "PI1", "PI2", "PI3", "PI4";
- allwinner,function = "dmic";
- allwinner,muxsel = <3>;
- allwinner,drive = <1>;
- allwinner,pull = <0>;
- };
-
- dmic_pins_b: dmic_sleep@0 {
- allwinner,pins = "PI0", "PI1", "PI2", "PI3", "PI4";
- allwinner,function = "io_disabled";
- allwinner,muxsel = <7>;
- allwinner,drive = <1>;
- allwinner,pull = <0>;
- };
+ };
/* this set of daudio0 pins is used for t507 board */
ahub_daudio0_pins_a: ahub_daudio0@0 {
@@ -483,24 +432,7 @@
allwinner,muxsel = <7>;
allwinner,drive = <1>;
allwinner,pull = <0>;
- };
-
- /* this set of daudio0 pins is used for h616 board */
- ahub_daudio0_pins_c: h_ahub_daudio0@0 {
- allwinner,pins = "PI0", "PI1", "PI2", "PI3", "PI4";
- allwinner,function = "h_i2s0";
- allwinner,muxsel = <4>;
- allwinner,drive = <1>;
- allwinner,pull = <0>;
- };
-
- ahub_daudio0_pins_d: h_ahub_daudio0_sleep@0 {
- allwinner,pins = "PI0", "PI1", "PI2", "PI3", "PI4";
- allwinner,function = "io_disabled";
- allwinner,muxsel = <7>;
- allwinner,drive = <1>;
- allwinner,pull = <0>;
- };
+ };
处理kernel/linux-4.9/arch/arm64/boot/dts/sunxi/sun50iw9p1.dtsi的io复用
ahub_daudio2_pins_a: ahub_daudio2@0 {
allwinner,pins = "PG11", "PG12", "PG13", "PG14";
diff --git a/kernel/linux-4.9/arch/arm64/boot/dts/sunxi/sun50iw9p1.dtsi b/kernel/linux-4.9/arch/arm64/boot/dts/sunxi/sun50iw9p1.dtsi
index 09ba87d80a..84067bbc92 100755
--- a/kernel/linux-4.9/arch/arm64/boot/dts/sunxi/sun50iw9p1.dtsi
+++ b/kernel/linux-4.9/arch/arm64/boot/dts/sunxi/sun50iw9p1.dtsi
@@ -722,8 +722,8 @@
interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clk_uart3>;
pinctrl-names = "default", "sleep";
- pinctrl-0 = <&uart3_pins_a>;
- pinctrl-1 = <&uart3_pins_b>;
+ //pinctrl-0 = <&uart3_pins_a>;
+ //pinctrl-1 = <&uart3_pins_b>;
uart3_port = <3>;
uart3_type = <4>;
status = "disabled";
@@ -735,8 +735,8 @@
interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clk_uart4>;
pinctrl-names = "default", "sleep";
- pinctrl-0 = <&uart4_pins_a>;
- pinctrl-1 = <&uart4_pins_b>;
+ //pinctrl-0 = <&uart4_pins_a>;
+ //pinctrl-1 = <&uart4_pins_b>;
uart4_port = <4>;
uart4_type = <4>;
status = "disabled";
@@ -1008,8 +1008,8 @@
reg = <0x0 0x05095000 0x0 0x50>;
clocks = <&clk_pll_audio>,<&clk_pll_audiox4>,<&clk_dmic>;
pinctrl-names = "default","sleep";
- pinctrl-0 = <&dmic_pins_a>;
- pinctrl-1 = <&dmic_pins_b>;
+ //pinctrl-0 = <&dmic_pins_a>;
+ //pinctrl-1 = <&dmic_pins_b>;
device_type = "dmic";
status = "disabled";
};
2)、初始化正常后,ping测试失败分析
a、系统的route设置正确,使用 route -n
sh-4.4# ifconfig wlan0 down
sh-4.4# ifconfig eth0 down
sh-4.4# ifconfig eth1 down
sh-4.4# ifconfig eth2 down
sh-4.4# ifconfig eth0 192.168.81.11 up
sh-4.4# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.81.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
sh-4.4#
b、phy的data io的工作电压
1.8v的模式下:
驱动中设置tx-delay与rx-delay参数,tx-delay参数0-7共8档,rx-delay参数0~31共32挡进行组合,发现还是ping不通。
3.3v的模式下:
通过调整tx-delay参数为0和rx-delay参数为1,能ping通同网段下的ip,解决了网络不通的问题。另外如果需要调优则需要进行测量data与clk之间的相位差。
3)、led灯异常,绿灯不亮,黄灯闪烁分析
合入补丁:
diff --git a/kernel/linux-4.9/drivers/net/ethernet/allwinner/sunxi-gmac.c b/kernel/linux-4.9/drivers/net/ethernet/allwinner/sunxi-gmac.c
index bff41c6197..b6d6eec0c 100755
--- a/kernel/linux-4.9/drivers/net/ethernet/allwinner/sunxi-gmac.c
+++ b/kernel/linux-4.9/drivers/net/ethernet/allwinner/sunxi-gmac.c
static int geth_phy_init(struct net_device *ndev)
{
int aue;
+ u32 a, b;
@@ -880,7 +897,7 @@ static int geth_phy_init(struct net_device *ndev)
netdev_err(ndev, "No PHY found!\n");
goto err;
}
+ phy_write(phydev, 0x1f, 0xd04);
+ a = phy_read(phydev, 0x10);
+ a |= (1<<5);
+ a |= (1<<8);
+ a &= (~(1<<9));
+ a |= (1<<10);
+ a |= (1<<11);
+ phy_write(phydev, 0x10, a);
+ b = phy_read(phydev, 0x11);
+ b &= (~(1<<2));
+ phy_write(phydev, 0x11, b);
+ phy_write(phydev,0x1f, 0xa42);
phy_write(phydev, MII_BMCR, BMCR_RESET);
while (BMCR_RESET & phy_read(phydev, MII_BMCR))
msleep(30);
三、测试
3.2、同网段ping测试
sh-4.4# ping -I eth0 192.168.81.28
PING 192.168.81.28 (192.168.81.28): 56 data bytes
64 bytes from 192.168.81.28: seq=0 ttl=128 time=1.970 ms
64 bytes from 192.168.81.28: seq=1 ttl=128 time=1.126 ms
64 bytes from 192.168.81.28: seq=2 ttl=128 time=1.158 ms
64 bytes from 192.168.81.28: seq=3 ttl=128 time=1.049 ms
64 bytes from 192.168.81.28: seq=4 ttl=128 time=1.053 ms
64 bytes from 192.168.81.28: seq=5 ttl=128 time=0.997 ms
64 bytes from 192.168.81.28: seq=6 ttl=128 time=1.026 ms
64 bytes from 192.168.81.28: seq=7 ttl=128 time=1.139 ms
64 bytes from 192.168.81.28: seq=8 ttl=128 time=1.178 ms
^C
--- 192.168.81.28 ping statistics ---
9 packets transmitted, 9 packets received, 0% packet loss
round-trip min/avg/max = 0.997/1.188/1.970 ms
sh-4.4#
3.3、同网段iperf测试
ARM端:
sh-4.4# iperf -c 192.168.81.28
------------------------------------------------------------
Client connecting to 192.168.81.28, TCP port 5001
TCP window size: 162 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.81.11 port 40236 connected with 192.168.81.28 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 114 MBytes 989.4 Mbits/sec
sh-4.4#
PC端:
C:\Users\B0413>iperf.exe -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 64.0 KByte (default)
------------------------------------------------------------
[384] local 192.168.81.28 port 5001 connected with 192.168.81.11 port 40236
[ ID] Interval Transfer Bandwidth
[384] 0.0-10.1 sec 114 MBytes 990.9 Mbits/sec