Hi 朋友们,
我遇到这样的问题: AM335x的PHY AR8031换成LAN8710a, 修改驱动后,现在能够ping通主机,但有丢包现象,系统启动打印如下:
:
:
Configuring network interfaces… [ 10.135635] jin+ net cpsw_slave_open(), priv->ndev->name=eth0, slave->data->phy_id=0:01[ 10.287035] jin+ net cpsw_slave_open(), priv->ndev->name=eth1, slave->data->phy_id=0:00[ 10.295576] PHY 0:00 not found
udhcpc (v1.20.2) started
Sending discover…
[ 13.208297] PHY: 0:01 – Link is Up – 100/Full
:
:
然后ping主机打印如下:
root@ok335x:~# ifconfig
eth0 Link encap:Ethernet HWaddr 7C:66:9D:1A:F2:BD inet addr:192.168.6.241 Bcast:192.168.6.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3003 errors:0 dropped:38 overruns:0 frame:0
TX packets:21 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000 RX bytes:206104 (201.2 KiB) TX bytes:2020 (1.9 KiB)
eth1 Link encap:Ethernet HWaddr 7C:66:9D:1A:F2:BF UP BROADCAST ALLMULTI 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 inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:124 errors:0 dropped:0 overruns:0 frame:0
TX packets:124 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0 RX bytes:353251 (344.9 KiB) TX bytes:353251 (344.9 KiB)
root@ok335x:~# ping 192.168.6.244
PING 192.168.6.244 (192.168.6.244): 56 data bytes
64 bytes from 192.168.6.244: seq=1 ttl=64 time=0.942 ms
64 bytes from 192.168.6.244: seq=2 ttl=64 time=0.838 ms
64 bytes from 192.168.6.244: seq=3 ttl=64 time=0.890 ms
64 bytes from 192.168.6.244: seq=4 ttl=64 time=0.871 ms
64 bytes from 192.168.6.244: seq=9 ttl=64 time=0.899 ms
64 bytes from 192.168.6.244: seq=10 ttl=64 time=0.819 ms
64 bytes from 192.168.6.244: seq=11 ttl=64 time=0.878 ms
64 bytes from 192.168.6.244: seq=13 ttl=64 time=0.834 ms
64 bytes from 192.168.6.244: seq=16 ttl=64 time=0.791 ms
64 bytes from 192.168.6.244: seq=17 ttl=64 time=0.831 ms
64 bytes from 192.168.6.244: seq=18 ttl=64 time=0.809 ms
64 bytes from 192.168.6.244: seq=20 ttl=64 time=0.830 ms
64 bytes from 192.168.6.244: seq=22 ttl=64 time=0.874 ms
64 bytes from 192.168.6.244: seq=25 ttl=64 time=0.842 ms
64 bytes from 192.168.6.244: seq=26 ttl=64 time=0.830 ms
64 bytes from 192.168.6.244: seq=27 ttl=64 time=0.856 ms
64 bytes from 192.168.6.244: seq=28 ttl=64 time=0.780 ms
64 bytes from 192.168.6.244: seq=42 ttl=64 time=0.866 ms
64 bytes from 192.168.6.244: seq=43 ttl=64 time=0.914 ms
64 bytes from 192.168.6.244: seq=44 ttl=64 time=0.888 ms
64 bytes from 192.168.6.244: seq=45 ttl=64 time=0.842 ms
64 bytes from 192.168.6.244: seq=46 ttl=64 time=0.870 ms
^C
— 192.168.6.244 ping statistics —
48 packets transmitted, 22 packets received, 54% packet loss
round-trip min/avg/max = 0.780/0.854/0.942 ms
root@ok335x:~#
电路图如 附件:sch.jpg
我的pinmux 如下:
/* Module pin mux for rmii1 */
static struct pinmux_config rmii1_pin_mux[] = {
{"mii1_crs.rmii1_crs_dv", OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLDOWN},
{"mii1_rxerr.mii1_rxerr", OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLDOWN},
{"mii1_txen.mii1_txen", OMAP_MUX_MODE1 | AM33XX_PIN_OUTPUT},
{"mii1_txd1.mii1_txd1", OMAP_MUX_MODE1 | AM33XX_PIN_OUTPUT},
{"mii1_txd0.mii1_txd0", OMAP_MUX_MODE1 | AM33XX_PIN_OUTPUT},
{"mii1_rxd1.mii1_rxd1", OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLDOWN},
{"mii1_rxd0.mii1_rxd0", OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLDOWN},
{"rmii1_refclk.rmii1_refclk", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLDOWN},
{"mdio_data.mdio_data", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP},
{"mdio_clk.mdio_clk", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT_PULLUP},
{NULL, 0},
};
请朋友们帮我分析一下,丢包会是什么原因?
谢谢了!
Kim
多谢朋友们支持了!
Kim
Steven Liu1:
这个PHY的CLK_50M是谁供的?外部晶振?
Jian Zhou:
回复 Steven Liu1:
我们的Beaglebone和Beaglebone Black都是用的Lan8710a这颗料,都是MII方式,有参考过么?
Kim Jin:
回复 Steven Liu1:
用的是外部晶振
Kim Jin:
回复 Jian Zhou:
我这里用的是 RMII模式
Kim Jin:
回复 Kim Jin:
对了,RMII设备驱动我基本上用的是smsc.c 中的代码如:
static struct phy_driver lan8710_driver = { .phy_id = 0x0007c0f1, /* OUI=0x00800f, Model#=0x0f */ // .phy_id = 0xc0001c, /* OUI=0x00800f, Model#=0x0f */ //jin+ net
.phy_id_mask = 0xfffffff0, .name = "SMSC LAN8710/LAN8720",
.features = (PHY_BASIC_FEATURES | SUPPORTED_Pause | SUPPORTED_Asym_Pause), .flags = PHY_HAS_INTERRUPT | PHY_HAS_MAGICANEG,
/* basic functions */ .config_aneg = genphy_config_aneg, .read_status = genphy_read_status, .config_init = smsc_phy_config_init,
/* IRQ related */ .ack_interrupt = smsc_phy_ack_interrupt, .config_intr = smsc_phy_config_intr,
.suspend = genphy_suspend, .resume = genphy_resume,
.driver = { .owner = THIS_MODULE, }};
Steven Liu1:
回复 Kim Jin:
Ethernet
While no series resistors are required for MII/RMII/RGMII, it is prudent include zero-Ohm stuff options for the TX and RX lines. Ideally, these option resistors should be as small as possible (0402 or smaller recommended) and should be placed as close to the transmitter as possible
根据checklist的上述内容,建议你把电路中的串阻去掉,变成0ohm试试。
http://processors.wiki.ti.com/index.php/AM335x_Schematic_Checklist
Gary Wu:
回复 Kim Jin:
个人认为硬件的可能性比较大。之前有客户出现过时钟品质不好导致该现象的。
请问用的晶振是多少PPM的?有无换更小的PPM的晶振测试过?
Gary Wu:
回复 Gary Wu:
另外,有无检查layout,从AM335X EMAC到PHY的走线有无超过2inch。
虽然没那么严格,但是不能超太多,否则可能会出现丢包的现象。
chen guang:
你好!请教一下如何配置出双网口呢?在内核中,谢谢!
Kim Jin:
回复 chen guang:
我用的是一个网口,只是把GMII 换成 RMII