/********************************************************************
* I.MX6 网卡能收不能发
* 说明:
* MAC控制器到PHY之间的阻抗差异。
*
* 2017-4-28 深圳 龙华樟坑村 曾剑锋
*******************************************************************/
一、参考文档:
1. Understanding MII Transceiver Status Info
ftp://ftp.psu.ac.th/pub/scyld/mii-status.html
2. 关于以太网PAUSE的一点研究
http://www.latelee.org/programming-under-linux/ethernet-pause-frame-study.html
二、U-Boot设定:
setenv bootargs console=ttymxc0,115200 init=/init video=mxcfb0:dev=ldb,bpp=32 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off vmalloc=256M androidboot.console=ttymxc0 consoleblank=0 androidboot.hardware=freescale cma=384M androidboot.selinux=disabled; saveenv; reset;
三、网络设定:
1. 设定ip:
ifconfig eth0 10.10.10.10 netmask 255.255.255.0
2. 主板抓包工具:
tcpdump -i eth0 host 10.10.10.10 &
tcpdump -vv -i eth0 host 10.10.10.10 &
四、ethtool工具:
1. Android 5.1
root@sabresd_6dq:/ # ethtool eth0
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: Symmetric
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised pause frame use: Symmetric
Advertised auto-negotiation: Yes
Link partner advertised link modes: 100baseT/Half
Link partner advertised pause frame use: No
Link partner advertised auto-negotiation: No
Speed: 100Mb/s
Duplex: Half
Port: MII
PHYAD: 1
Transceiver: external
Auto-negotiation: on
Supports Wake-on: g
Wake-on: d
Link detected: yes
root@sabresd_6dq:/ # mtp_open
libphy: 2188000.ethernet:01 - Link is Down
libphy: 2188000.ethernet:01 - Link is Up - 1000/Full
root@sabresd_6dq:/ # ethtool eth0
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: Symmetric
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised pause frame use: Symmetric
Advertised auto-negotiation: Yes
Link partner advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Link partner advertised pause frame use: Symmetric Receive-only
Link partner advertised auto-negotiation: Yes
Speed: 1000Mb/s
Duplex: Full
Port: MII
PHYAD: 1
Transceiver: external
Auto-negotiation: on
Supports Wake-on: g
Wake-on: d
Link detected: yes
root@sabresd_6dq:/ #
2. Android 4.2
root@android:/data # ./ethtool eth0
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: Symmetric
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised pause frame use: Symmetric
Advertised auto-negotiation: Yes
Speed: 1000Mb/s
Duplex: Full
Port: MII
PHYAD: 1
Transceiver: external
Auto-negotiation: on
Link detected: yes
root@android:/data # PHY: 1:01 - Link is Down
PHY: 1:01 - Link is Up - 100/Half
root@android:/data # ./ethtool eth0
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: Symmetric
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised pause frame use: Symmetric
Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Half
Port: MII
PHYAD: 1
Transceiver: external
Auto-negotiation: on
Link detected: yes
五、AR8031寄存器值:
address 0x0 = 0x1000 .
address 0x1 = 0x796d .
address 0x2 = 0x4d .
address 0x3 = 0xd074 .
address 0x4 = 0x15e1 .
address 0x5 = 0xcde1 .
address 0x6 = 0xd .
address 0x7 = 0x2001 .
address 0x8 = 0x0 .
address 0x9 = 0x300 .
address 0xa = 0x3801 .
address 0xb = 0x0 .
address 0xc = 0x0 .
address 0xf = 0xa000 .
address 0x10 = 0x862 .
address 0x11 = 0xbc5c .
address 0x12 = 0x0 .
address 0x13 = 0x0 .
address 0x14 = 0x82c .
address 0x15 = 0x0 .
address 0x16 = 0x4e8 .
address 0x17 = 0x0 .
address 0x18 = 0x3200 .
address 0x19 = 0x3000 .
address 0x1a = 0x0 .
address 0x1b = 0x63e .
address 0x1c = 0x0 .
address 0x1f = 0x8100 .
六、引脚重新配置:
#define MX6DL_ENET_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
#define PAD_CTL_PKE (1 << 12) 1 0000 0000 0000
#define PAD_CTL_PUE (1 << 13) 10 0000 0000 0000
#define PAD_CTL_PUS_100K_UP (2 << 14) 1000 0000 0000 0000
#define PAD_CTL_SPEED_MED (2 << 6) 1000 0000
#define PAD_CTL_DSE_40ohm (6 << 3) 11 0000
#define PAD_CTL_HYS (1 << 8) 1 0000 0000
1011 0001 1011 0000
b1b0
00013030
#define MX6DL_ENET_REF_CLK_PAD_CTRL (PAD_CTL_PUE | \
PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST)
#define PAD_CTL_PUE (1 << 13) 10 0000 0000 0000
#define PAD_CTL_PUS_100K_UP (2 << 14) 1000 0000 0000 0000
#define PAD_CTL_SPEED_MED (2 << 6) 1000 0000
#define PAD_CTL_DSE_40ohm (6 << 3) 11 0000
#define PAD_CTL_HYS (1 << 8) 1 0000 0000