Custom IMX6D based board Ethernet issue (only in Linux)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Custom IMX6D based board Ethernet issue (only in Linux)

1,837 Views
npatel
Contributor III

Hi All,

I'm currently facing a strange Ethernet issue in Linux on a custom IMX6D board based on the sabresd reference design. The design uses an AR8031 PHY configured in RGMII mode , 1000-BaseX (with autonegotiation disabled, speed fixed to 1000Mbps,full duplex). I was able to get Ethernet working in U-boot (2019.04 fslc), in which I am able to ping and tftp Linux images onto the board. Once the board boots to Linux (4.14.117-fslc+g774f42075a4, initramfs image), I am able to bring up the interface (eth0) via ifconfig, talk to the AR8031 PHY via phytool (read and write to registers), but I am unable to ping (causes the board to hang).

/ # ifconfig eth0 192.168.1.10 netmask 255.255.0.0 up
[   38.196024] [fec_main.c] <fec_enet_mii_probe> mdio_bus_id : 2188000.ethernet-1 , phy_id: 0x0
[   38.204720] [fec_main.c] <fec_enet_mii_probe> phy_name: 2188000.ethernet-1:00
[   38.211964] [phy_device.c]<phy_connect> bus_id = 2188000.ethernet-1:00
[   38.313674] [phy_device.c] <genphy_config_init>  phy features init
[   38.320400] [at803x.c] <at803x_config_init> genphy_config_init is ok
[   38.327518] Atheros 8031 ethernet 2188000.ethernet-1:00: attached PHY driver [Atheros 8031 ethernet] (mii_bus:phy_addr=2188000.ethernet-1:00, irq=POLL)
[   38.341528] [phy.c]<phy_start_aneg_priv> phydev->autoneg = 0
[   38.348148] [phy_device.c] <genphy_setup_forced>  phy settings applied
[   38.356328] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
/ # [   39.363830] fec 2188000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
[   39.371636] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
/ # ifconfig
eth0      Link encap:Ethernet  HWaddr E2:36:31:54:12:34
          inet addr:192.168.1.10  Bcast:192.168.255.255  Mask:255.255.0.0
          inet6 addr: fe80::e036:31ff:fe54:1234/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:586 (586.0 B)
/ # ethtool [   64.483783] imx-sdma 20ec000.sdma: external firmware not found, using ROM firmware
ethtool: bad command line argument(s)
For more information run ethtool -h
/ # ethtool eth0
Settings for eth0:
        Supported ports: [ TP MII ]
        Supported link modes:   1000baseT/Full
        Supported pause frame use: Symmetric
        Supports auto-negotiation: No
        Supported FEC modes: Not reported
        Advertised link modes:  1000baseT/Full
        Advertised pause frame use: Symmetric
        Advertised auto-negotiation: No
        Advertised FEC modes: Not reported
        Speed: 1000Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: off
        Supports Wake-on: g
        Wake-on: d
        Link detected: yes
/ #
/ # ethtool -S eth0
NIC statistics:
     tx_dropped: 0
     tx_packets: 10
     tx_broadcast: 0
     tx_multicast: 10
     tx_crc_errors: 0
     tx_undersize: 0
     tx_oversize: 0
     tx_fragment: 0
     tx_jabber: 0
     tx_collision: 0
     tx_64byte: 0
     tx_65to127byte: 10
     tx_128to255byte: 0
     tx_256to511byte: 0
     tx_512to1023byte: 0
     tx_1024to2047byte: 0
     tx_GTE2048byte: 0
     tx_octets: 836
     IEEE_tx_drop: 0
     IEEE_tx_frame_ok: 10
     IEEE_tx_1col: 0
     IEEE_tx_mcol: 0
     IEEE_tx_def: 0
     IEEE_tx_lcol: 0
     IEEE_tx_excol: 0
     IEEE_tx_macerr: 0
     IEEE_tx_cserr: 0
     IEEE_tx_sqe: 0
     IEEE_tx_fdxfc: 0
     IEEE_tx_octets_ok: 836
     rx_packets: 32
     rx_broadcast: 0
     rx_multicast: 0
     rx_crc_errors: 32
     rx_undersize: 0
     rx_oversize: 0
     rx_fragment: 0
     rx_jabber: 0
     rx_64byte: 0
     rx_65to127byte: 30
     rx_128to255byte: 2
     rx_256to511byte: 0
     rx_512to1023byte: 0
     rx_1024to2047byte: 0
     rx_GTE2048byte: 0
     rx_octets: 4004
     IEEE_rx_drop: 0
     IEEE_rx_frame_ok: 0
     IEEE_rx_crc: 32
     IEEE_rx_align: 0
     IEEE_rx_macerr: 0
     IEEE_rx_fdxfc: 0
     IEEE_rx_octets_ok: 0
/ #
/ # phytool print eth0/0
ieee-phy: id:0x004dd074
   ieee-phy: reg:BMCR(0x00) val:0x0140
      flags:          -reset -loopback -aneg-enable -power-down -isolate -aneg-restart -collision-test
      speed:          1000-full
   ieee-phy: reg:BMSR(0x01) val:0x614d
      capabilities:   -100-b4 +100-f +100-h -10-f -10-h -100-t2-f -100-t2-h
      flags:          +ext-status -aneg-complete -remote-fault +aneg-capable +link -jabber +ext-register
/ #

The interface is "UP" and "RUNNING", the AR8031 PHY LED_LINK1000 and LED_ACT leds light up, and Linux appears to be incrementing the TX byte counter, but RX bytes stay at 0 (in which the RX crc error count is the same as the RX packet count according to ethtool). As for the TX packets, I have Wireshark on my test PC I am using as a tftp server to load Linux, and I do NOT see any TX packets coming through (I do see network activity on Wireshark during U-boot ping/tftp commands as expected ). Any clues as to what would be causing this problem? I've been stuck on this problem for quite sometime and would really appreciate some help.

Thank you,

Neil

Labels (2)
Tags (2)
0 Kudos
3 Replies

1,351 Views
npatel
Contributor III

Hi Igor,

I will give the official kernel source a try. Also will try with auto-negotiation enabled. Will update with results.

Thanks!

Neil

0 Kudos

1,351 Views
igorpadykov
NXP Employee
NXP Employee

Hi Neil

"fslc" community bsps are not supported by nxp, recommended to try

software from nxp official source.codeaurora.org/external/imx repository:

https://source.codeaurora.org/external/imx/linux-imx/tree/?h=imx_4.14.98_2.0.0_ga 

https://source.codeaurora.org/external/imx/uboot-imx/tree/?h=imx_v2018.03_4.14.78_1.0.0_ga 

Documentation
i.MX Software | NXP 

also  for 1000-Base autonegotiation is mandatory, it should not be disabled.

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,351 Views
npatel
Contributor III

Hi Igor,

I was able to solve the Ethernet issue. So using the 4.14.98 kernel image, I faced the same issue of not being able to ping using the appropriate PHY driver (AT803x driver). What fixed my issue was using the GENERIC_PHY driver instead  of  the AT803X. As per our hardware configuration, the link on the IMX6 has to be at a fixed speed of 1000Mbps, with auto-negotation off, and running in full duplex. So I made the appropriate additions to the GENERIC_PHY driver (drivers/net/phy/phy_device.c), and voila I can ping!

/ # ifconfig -a
eth0      Link encap:Ethernet  HWaddr E2:36:31:54:12:34
          BROADCAST MULTICAST  MTU:1500  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 (0.0 B)  TX bytes:0 (0.0 B)
lo        Link encap:Local Loopback
          LOOPBACK  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 (0.0 B)  TX bytes:0 (0.0 B)
sit0      Link encap:IPv6-in-IPv4
          NOARP  MTU:1480  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 (0.0 B)  TX bytes:0 (0.0 B)
/ # ifconfig eth0 192.168.1.10 netmask 255.255.0.0 up
[   30.044075] Generic PHY 2188000.ethernet-1:00: attached PHY driver [Generic PHY] (mii_bus:phy_addr=2188000.ethernet-1:00, irq=POLL)
[   30.057633] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
/ # [   31.123576] fec 2188000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
[   31.131520] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
/ # ping 192.168.1.50 -c5
PING 192.168.1.50 (192.168.1.50): 56 data bytes
64 bytes from 192.168.1.50: seq=0 ttl=128 time=2.326 ms
64 bytes from 192.168.1.50: seq=1 ttl=128 time=0.467 ms
64 bytes from 192.168.1.50: seq=2 ttl=128 time=0.419 ms
64 bytes from 192.168.1.50: seq=3 ttl=128 time=0.408 ms
64 bytes from 192.168.1.50: seq=4 ttl=128 time=0.394 ms
--- 192.168.1.50 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 0.394/0.802/2.326 ms
/ # [   64.483450] imx-sdma 20ec000.sdma: external firmware not found, using ROM firmware
/ # ifconfig
eth0      Link encap:Ethernet  HWaddr E2:36:31:54:12:34
          inet addr:192.168.1.10  Bcast:192.168.255.255  Mask:255.255.0.0
          inet6 addr: fe80::e036:31ff:fe54:1234/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:901 (901.0 B)  TX bytes:1300 (1.2 KiB)
/ # ethtool eth0
Settings for eth0:
        Supported ports: [ TP MII ]
        Supported link modes:   1000baseT/Full
        Supported pause frame use: Symmetric
        Supports auto-negotiation: No
        Supported FEC modes: Not reported
        Advertised link modes:  1000baseT/Full
        Advertised pause frame use: Symmetric
        Advertised auto-negotiation: No
        Advertised FEC modes: Not reported
        Speed: 1000Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: off
        Supports Wake-on: g
        Wake-on: d
        Link detected: yes
/ #
/ # ethtool -S eth0
NIC statistics:
     tx_dropped: 0
     tx_packets: 16
     tx_broadcast: 1
     tx_multicast: 9
     tx_crc_errors: 0
     tx_undersize: 0
     tx_oversize: 0
     tx_fragment: 0
     tx_jabber: 0
     tx_collision: 0
     tx_64byte: 2
     tx_65to127byte: 14
     tx_128to255byte: 0
     tx_256to511byte: 0
     tx_512to1023byte: 0
     tx_1024to2047byte: 0
     tx_GTE2048byte: 0
     tx_octets: 1400
     IEEE_tx_drop: 0
     IEEE_tx_frame_ok: 16
     IEEE_tx_1col: 0
     IEEE_tx_mcol: 0
     IEEE_tx_def: 0
     IEEE_tx_lcol: 0
     IEEE_tx_excol: 0
     IEEE_tx_macerr: 0
     IEEE_tx_cserr: 0
     IEEE_tx_sqe: 0
     IEEE_tx_fdxfc: 0
     IEEE_tx_octets_ok: 1400
     rx_packets: 43
     rx_broadcast: 2
     rx_multicast: 35
     rx_crc_errors: 0
     rx_undersize: 0
     rx_oversize: 0
     rx_fragment: 0
     rx_jabber: 0
     rx_64byte: 2
     rx_65to127byte: 37
     rx_128to255byte: 4
     rx_256to511byte: 0
     rx_512to1023byte: 0
     rx_1024to2047byte: 0
     rx_GTE2048byte: 0
     rx_octets: 5292
     IEEE_rx_drop: 0
     IEEE_rx_frame_ok: 43
     IEEE_rx_crc: 0
     IEEE_rx_align: 0
     IEEE_rx_macerr: 0
     IEEE_rx_fdxfc: 0
     IEEE_rx_octets_ok: 5292
/ #

Thanks,

Neil

0 Kudos