5. Ethernet

5.1. DTS configure

5.1.1. Common


&gmac1 {                                                                                                                                                                
    /* Use rgmii-rxid mode to disable rx delay inside Soc */
    phy-mode = "rgmii-rxid";
    clock_in_out = "output";

    snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
    /* Reset time is 20ms, 100ms for rtl8211f */
    snps,reset-delays-us = <0 20000 100000>;

    pinctrl-names = "default";
    pinctrl-0 = <&gmac1_miim

    tx_delay = <0x42>;
    //rx_delay = <0x4f>;

    phy-handle = <&rgmii_phy1>;
    status = "disbaled";

5.1.2. Board


        snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
        phy-mode = "rgmii";
        tx_delay = <0x3B>;
        rx_delay = <0x32>;
        status = "okay";

5.1.3. IP Addrs

  • get from debug or adb by ifconfig

    ifconfig eth0
    eth0      Link encap:Ethernet  HWaddr 52:22:4b:e4:f8:3c  Driver rk_gmac-dwmac
          inet addr:  Bcast:  Mask:
          inet6 addr: 240e:3b1:f175:9df0:ea6d:9993:33e6:202d/64 Scope: Global
          inet6 addr: 240e:3b1:f175:9df0:e0e8:b021:fc7a:dafc/64 Scope: Global
          inet6 addr: fe80::9cd8:e64d:b9c2:6f4/64 Scope: Link
          RX packets:229 errors:0 dropped:0 overruns:0 frame:0
          TX packets:62 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:40526 TX bytes:6698

5.1.4. PING Test

  • eth0

    ping -I eth0 -c 10  www.baidu.com
    PING www.a.shifen.com ( from eth0: 56(84) bytes of data.
    64 bytes from icmp_seq=1 ttl=55 time=9.45 ms
    64 bytes from icmp_seq=2 ttl=55 time=9.36 ms
    64 bytes from icmp_seq=3 ttl=55 time=10.0 ms
    64 bytes from icmp_seq=4 ttl=55 time=11.3 ms
    64 bytes from icmp_seq=5 ttl=55 time=41.7 ms
    64 bytes from icmp_seq=6 ttl=55 time=9.73 ms
    64 bytes from icmp_seq=7 ttl=55 time=9.28 ms
    64 bytes from icmp_seq=8 ttl=55 time=9.26 ms
    64 bytes from icmp_seq=9 ttl=55 time=9.50 ms
    64 bytes from icmp_seq=10 ttl=55 time=12.9 ms
    --- www.a.shifen.com ping statistics ---
    10 packets transmitted, 10 received, 0% packet loss, time 9013ms
    rtt min/avg/max/mdev = 9.265/13.262/41.757/9.562 ms