This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM3358: Ethernet eth0 keeps up and down (eth1 is ok)

Part Number: AM3358

Tool/software: Linux

Hi,

I have an issue about Ethernet on AM3358 Sitara soc, the interfaces ETH1 and ETH0 are setup as RMII and only eth1 is working correctly.

Here is the pinmuxing/device tree used :

AM33XX_IOPAD(0x90c, (PIN_INPUT_PULLUP | MUX_MODE1))	/* mii1_crs.rmii1_crs_dv */
AM33XX_IOPAD(0x944, (PIN_INPUT_PULLUP | MUX_MODE0))	/* rmii1_refclk.rmii1_refclk */
AM33XX_IOPAD(0x940, (PIN_INPUT_PULLUP | MUX_MODE1))	/* mii1_rxd0.rmii1_rxd0 */
AM33XX_IOPAD(0x93c, (PIN_INPUT_PULLUP | MUX_MODE1))	/* mii1_rxd1.rmii1_rxd1 */
AM33XX_IOPAD(0x910, (PIN_INPUT_PULLUP | MUX_MODE1))	/* mii1_rxerr.rmii1_rxerr */
AM33XX_IOPAD(0x928, (PIN_OUTPUT_PULLDOWN | MUX_MODE1))	/* mii1_txd0.rmii1_txd0 */
AM33XX_IOPAD(0x924, (PIN_OUTPUT_PULLDOWN | MUX_MODE1))	/* mii1_txd1.rmii1_txd1 */
AM33XX_IOPAD(0x914, (PIN_OUTPUT_PULLDOWN | MUX_MODE1))	/* mii1_txen.rmii1_txen */

AM33XX_IOPAD(0x864, (PIN_INPUT_PULLUP | MUX_MODE3))	/* gpmc_a9.rmii2_crs_dv */
AM33XX_IOPAD(0x908, (PIN_INPUT_PULLUP | MUX_MODE1))	/* mii1_col.rmii2_refclk */
AM33XX_IOPAD(0x86c, (PIN_INPUT_PULLUP | MUX_MODE3))	/* gpmc_a11.rmii2_rxd0 */
AM33XX_IOPAD(0x868, (PIN_INPUT_PULLUP | MUX_MODE3))	/* gpmc_a10.rmii2_rxd1 */
AM33XX_IOPAD(0x874, (PIN_INPUT_PULLUP | MUX_MODE3))	/* gpmc_wpn.rmii2_rxerr */
AM33XX_IOPAD(0x854, (PIN_OUTPUT_PULLDOWN | MUX_MODE3))	/* gpmc_a5.rmii2_txd0 */
AM33XX_IOPAD(0x850, (PIN_OUTPUT_PULLDOWN | MUX_MODE3))	/* gpmc_a4.rmii2_txd1 */
AM33XX_IOPAD(0x840, (PIN_OUTPUT_PULLDOWN | MUX_MODE3))	/* gpmc_a0.rmii2_txen */

davinci_mdio_default: pinmux_davinci_mdio_default {
	pinctrl-single,pins = <
		AM33XX_IOPAD(0x948, PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)	/* mdio_data.mdio_data */
		AM33XX_IOPAD(0x94c, PIN_OUTPUT_PULLUP | MUX_MODE0)			/* mdio_clk.mdio_clk */
	>;
};



&cpsw_emac0 {
	phy-handle = <&ethphy0>;
	phy-mode = "rmii";
	dual_emac_res_vlan = <1>;
};

&cpsw_emac1 {
	phy-handle = <&ethphy1>;
	phy-mode = "rmii";
	dual_emac_res_vlan = <2>;
};

&davinci_mdio {
	pinctrl-names = "default";
	pinctrl-0 = <&davinci_mdio_default>;
	status = "okay";

	ethphy0: ethernet-phy@0 {
		reg = <0>;
	};

	ethphy1: ethernet-phy@1 {
		reg = <1>;
	};
};

&mac {
	pinctrl-names = "default";
	pinctrl-0 = <&cpsw_default>;
	status = "okay";
	dual_emac;
};

&phy_sel {
	rmii-clock-ext;
	rmii2-crs-dv; /* use RMII_CRS_DV pinmux */
};

I am using ti-linux-4.14 version of the kernel.
I made sure that gpmc_a9 is configured as RMII_CRS_DV in sma2 register by setting BIT(0) => eth1 is worlking fine

My issue comes from eth0 interface where I cannot have a stable link, it keeps staying up and down :

[ 1586.161861] cpsw 4a100000.ethernet eth0: Link is Up - 100Mbps/Half - flow control off
[ 1590.321567] cpsw 4a100000.ethernet eth0: Link is Down
[ 1591.361876] cpsw 4a100000.ethernet eth0: Link is Up - 100Mbps/Half - flow control off
[ 1596.561539] cpsw 4a100000.ethernet eth0: Link is Down
[ 1597.601846] cpsw 4a100000.ethernet eth0: Link is Up - 100Mbps/Half - flow control off
[ 1600.721530] cpsw 4a100000.ethernet eth0: Link is Down
[ 1601.761850] cpsw 4a100000.ethernet eth0: Link is Up - 100Mbps/Half - flow control off
[ 1604.881528] cpsw 4a100000.ethernet eth0: Link is Down
[ 1605.921842] cpsw 4a100000.ethernet eth0: Link is Up - 100Mbps/Half - flow control off
[ 1608.001533] cpsw 4a100000.ethernet eth0: Link is Down
[ 1609.041878] cpsw 4a100000.ethernet eth0: Link is Up - 100Mbps/Half - flow control off
[ 1611.121534] cpsw 4a100000.ethernet eth0: Link is Down
[ 1612.161882] cpsw 4a100000.ethernet eth0: Link is Up - 100Mbps/Half - flow control off
[ 1615.281525] cpsw 4a100000.ethernet eth0: Link is Down
[ 1616.321915] cpsw 4a100000.ethernet eth0: Link is Up - 100Mbps/Half - flow control off
[ 1620.481540] cpsw 4a100000.ethernet eth0: Link is Down

The hardware PHY LAN8710i is set according to this checklist :

Both interfaces are wired exactly the same way but I cannot get eth0 working.

Do you have an idea of where the issue is coming from ?

Thanks

  • Hi,

    [ 1586.161861] cpsw 4a100000.ethernet eth0: Link is Up - 100Mbps/Half - flow control off
    [ 1590.321567] cpsw 4a100000.ethernet eth0: Link is Down

    These messages indicate that the PHY is losing the link for some reason. To me this appears to be a PHY issue and not necessarily a MAC one since the cpsw driver is reacting to the PHY reporting the link is down.

    The recommendation I have is if the eth0 port is setup in u-boot on your board, you might use this command, mii dump 0 0 and mii dump 0 1 when the Link light on the Ethernet connector is indicating issues. You will have to use the command several times to catch the link being reported as down.

    What you are looking for is link status in the output of the tool. It should be toggling should be based on the log provided. U-Boot will only initialize the interface on command such as DHCP that generates traffic is used. So only using the mii tool (and not some network command) might demonstrate that the cpsw interface is not the issue and allow you to concentrate on the PHY.

    Best Regards,
    Schuyler
  • Hi,

    Thank you for your reply,

    It seems I cannot have the ethernet working on u-boot, here are the logs:

    [...]
    wait_for_user_access Timeout
    PHY reset timed out
    wait_for_user_access Timeout
    [...]
    wait_for_user_access Timeout
    cpsw
    Warning: cpsw (eth0) using random MAC address - 6e:67:6d:12:be:1d
    , usb_ether
    Warning: usb_ether (eth1) using random MAC address - 8a:60:2e:57:41:89

    I tried using device tree with DM_ETH config and alos using board.c file without DM_ETH config but it gives the same result.

    and once I get into u-boot prompt, I have a PHY at every index using :

    => mii info 0
    wait_for_user_access Timeout
    [...]
    wait_for_user_access Timeout
    PHY 0x00: OUI = 0x3FE4BF, Model = 0x39, Rev = 0x02, 100baseT, FDX
    => mii info 1
    wait_for_user_access Timeout
    [...]
    wait_for_user_access Timeout
    PHY 0x01: OUI = 0x3FE4BF, Model = 0x39, Rev = 0x02, 100baseT, FDX
    => mii info 2
    wait_for_user_access Timeout
    [...]
    wait_for_user_access Timeout
    PHY 0x02: OUI = 0x3FE4BF, Model = 0x39, Rev = 0x02, 100baseT, FDX
    

    and so on...

    The current setup is both ETH ports from the board are conected to a switch, and my computer is also connected to the same switch.

    I have a blinking LED on the switch (for ETH0) which is blinking around every second and this happens from the first time I power up the board.

    Concerning ETH1, it does not blink on boot, I need first to boot into Linux, up the interface and the LED turn ON and stays ON.
    During the whole time, ETH0 is always blinking unless I down the interface.

    Here are the registers:

    # mii-tool -vv
    Using SIOCGMIIPHY=0x8947
    eth0: negotiated 1000baseT-HD flow-control, link ok
      registers for MII PHY 0:
        3100 782d 0007 c0f1 01e1 41e1 0001 ffff
        ffff ffff ffff ffff ffff ffff ffff 0000
        0040 2002 6060 ffff 0000 0000 0000 0000
        ffff ffff a212 001a 0000 00c8 0000 5058
      product info: vendor 00:01:f0, model 15 rev 1
      basic mode:   autonegotiation enabled
      basic status: autonegotiation complete, link ok
      capabilities: 1000baseT-HD 1000baseT-FD 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
      advertising:  1000baseT-HD 1000baseT-FD 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
      link partner: 1000baseT-HD 1000baseT-FD 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
    eth1: negotiated 1000baseT-HD flow-control, link ok
      registers for MII PHY 1:
        3100 782d 0007 c0f1 01e1 41e1 0001 ffff
        ffff ffff ffff ffff ffff ffff ffff 0000
        0040 2002 6061 ffff 0000 0000 0000 0000
        ffff ffff 0000 001a 0000 00c8 0000 1058
      product info: vendor 00:01:f0, model 15 rev 1
      basic mode:   autonegotiation enabled
      basic status: autonegotiation complete, link ok
      capabilities: 1000baseT-HD 1000baseT-FD 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
      advertising:  1000baseT-HD 1000baseT-FD 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
      link partner: 1000baseT-HD 1000baseT-FD 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD

    For ETH0, the value of register 31 keeps changing between 5058 and 1058.

    Here are the commands I am running on Linux:

    # On computer:
    sudo ip a add 192.168.1.15/24 dev <ethernet_interface>
    
    # On board:
    
    # ETH0:
    ip link set dev eth0 down
    ip link set dev eth0 up
    ip a add 192.168.1.9/24 dev eth0
    ping -I eth0 192.168.1.15 # => does not work
    
    # ETH1:
    ip link set dev eth1 down
    ip link set dev eth1 up
    ip a add 192.168.1.11/24 dev eth1
    ping -I eth1 192.168.1.15 # => works

    I am more thinking about hardware issue but I want to make sure that I have a valid software running.

    Thanks.

  • The problem is resolved, we had an internal wire issue with the layout from the Ethernet magnet to the cable