Part Number: AM3354
Hi,
we are developing a custom board based on AM335x Starter Kit, equipped with two etherent ports with physical device DP83822.
The dts file part related to ethernet configuration is the following:
cpsw_default: cpsw_default {
pinctrl-single,pins = <
/* Slave 1 */
AM33XX_IOPAD(0x90c, PIN_INPUT | MUX_MODE1) /* (H17) gmii1_crs.rmii1_crs_dv */
AM33XX_IOPAD(0x910, PIN_INPUT | MUX_MODE1) /* (J15) gmii1_rxer.rmii1_rxer */
AM33XX_IOPAD(0x914, PIN_OUTPUT | MUX_MODE1) /* (J16) gmii1_txen.rmii1_txen */
AM33XX_IOPAD(0x928, PIN_OUTPUT | MUX_MODE1) /* (K17) gmii1_txd0.rmii1_txd0 */
AM33XX_IOPAD(0x924, PIN_OUTPUT | MUX_MODE1) /* (K16) gmii1_txd1.rmii1_txd1 */
AM33XX_IOPAD(0x940, PIN_INPUT | MUX_MODE1) /* (M16) gmii1_rxd0.rmii1_rxd0 */
AM33XX_IOPAD(0x93c, PIN_INPUT | MUX_MODE1) /* (L15) gmii1_rxd1.rmii1_rxd1 */
AM33XX_IOPAD(0x944, PIN_INPUT | MUX_MODE0) /* (H18) rmii1_refclk.rmii1_refclk */
/* Slave 2 */
AM33XX_IOPAD(0x864, PIN_INPUT | MUX_MODE3) /* (U16) gpmc_a9.rmii2_crs_dv */
AM33XX_IOPAD(0x874, PIN_INPUT | MUX_MODE3) /* (U17) gpmc_wpn.rmii2_rxer */
AM33XX_IOPAD(0x840, PIN_OUTPUT | MUX_MODE3) /* (R13) gpmc_a0.rmii2_txen */
AM33XX_IOPAD(0x854, PIN_OUTPUT | MUX_MODE3) /* (V15) gpmc_a5.rmii2_txd0 */
AM33XX_IOPAD(0x850, PIN_OUTPUT | MUX_MODE3) /* (R14) gpmc_a4.rmii2_txd1 */
AM33XX_IOPAD(0x86c, PIN_INPUT | MUX_MODE3) /* (V17) gpmc_a11.rmii2_rxd0 */
AM33XX_IOPAD(0x868, PIN_INPUT | MUX_MODE3) /* (T16) gpmc_a10.rmii2_rxd1 */
AM33XX_IOPAD(0x908, PIN_INPUT | MUX_MODE1) /* (H16) gmii1_col.rmii2_refclk */
>;
};
davinci_mdio_default: davinci_mdio_default {
pinctrl-single,pins = <
/* MDIO */
AM33XX_IOPAD(0x948, PIN_INPUT | MUX_MODE0) /* (M17) mdio_data.mdio_data */
AM33XX_IOPAD(0x94c, PIN_OUTPUT | MUX_MODE0) /* (M18) mdio_clk.mdio_clk */
>;
};
....
&mac {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&cpsw_default>;
pinctrl-1 = <&cpsw_sleep>;
dual_emac = <1>;
status = "okay";
};
&davinci_mdio {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&davinci_mdio_default>;
pinctrl-1 = <&davinci_mdio_sleep>;
status = "okay";
reset-gpios = <&gpio1 18 GPIO_ACTIVE_LOW>;
reset-delay-us = <2>; /* PHY datasheet states 1uS min */
ethphy0: ethernet-phy@1 {
reg = <1>;
};
ethphy1: ethernet-phy@2 {
reg = <2>;
};
};
&cpsw_emac0 {
phy-handle = <ðphy0>;
phy-mode = "rmii";
dual_emac_res_vlan = <1>;
};
&cpsw_emac1 {
phy-handle = <ðphy1>;
phy-mode = "rmii";
dual_emac_res_vlan = <2>;
};
&phy_sel {
rmii-clock-ext;
};
The first port (eth0) works fine (dhcp works as well on this port), while the second (eth1) is not working.
We checked with a network sniffer that the trasmitting part (for eth1) is ok (ARP packet requests and responses are logged during a ping command), and the physical level (rmii_rxd0 and rmii_rxd1) seems ok (checked with an oscilloscope) since we see data flowing. Anyway the network communication is not working.
We have also verified that all pins connection in receiving part are ok: we configured the pins as output GPIO and checking the output on physical the level is the one expected.
We checked the DP83822 register configurations for both ports, and they are correct and and the same for both ports.
The problem has been seen and debugged on different boards, so we exclude a single faulty unit.
Here are some kernel logs at startup:
...
[ 1.007968] libphy: Fixed MDIO Bus: probed
[ 1.078735] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6, bus freq 1000000
[ 1.086779] libphy: 4a101000.mdio: probed
[ 1.093311] davinci_mdio 4a101000.mdio: phy[1]: device 4a101000.mdio:01, driver TI DP83822 10/100 Mbps PHY
[ 1.103566] davinci_mdio 4a101000.mdio: phy[2]: device 4a101000.mdio:02, driver TI DP83822 10/100 Mbps PHY
[ 1.114605] cpsw 4a100000.ethernet: Detected MACID = 74:e1:82:8b:63:97
[ 1.121777] cpsw 4a100000.ethernet: initialized cpsw ale version 1.4
[ 1.128440] cpsw 4a100000.ethernet: ALE Table size 1024
[ 1.134873] cpsw 4a100000.ethernet: cpsw: Detected MACID = 74:e1:82:8b:63:99
...
[ 5.939999] net eth0: initializing cpsw version 1.12 (0)
[ 6.043537] TI DP83822 10/100 Mbps PHY 4a101000.mdio:01: attached PHY driver [TI DP83822 10/100 Mbps PHY] (mii_bus:phy_addr=4a101000.mdio:01, irq=POLL)
...
[ 15.439020] net eth1: initializing cpsw version 1.12 (0)
[ 15.563550] TI DP83822 10/100 Mbps PHY 4a101000.mdio:02: attached PHY driver [TI DP83822 10/100 Mbps PHY] (mii_bus:phy_addr=4a101000.mdio:02, irq=POLL)
...
Connecting the cable to eth1 the link is correctly up:
[ 18.730744] cpsw 4a100000.ethernet eth1: Link is Up - 100Mbps/Full - flow control rx/tx
We have set eth1 port to static IP configuration and run the ping command to my PC, the ifconfig command returns the following:
#ifconfig
eth0 Link encap:Ethernet HWaddr 74:E1:82:8B:63:97
UP 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)
Interrupt:43
eth1 Link encap:Ethernet HWaddr 74:E1:82:8B:63:99
inet addr:172.20.1.29 Bcast:0.0.0.0 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:576 (576.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:11 errors:0 dropped:0 overruns:0 frame:0
TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1232 (1.2 KiB) TX bytes:1232 (1.2 KiB)
The ethtool output for the second port:
# ethtool eth1
Settings for eth1:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Link partner advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Link partner advertised pause frame use: Symmetric Receive-only
Link partner advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: MII
PHYAD: 2
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: d
Wake-on: d
Current message level: 0x00000000 (0)
Link detected: yes
Can you please help us with this issue?
Thanks.