TI论坛
直播中

骆其节

7年用户 179经验值
私信 关注

335x rgmii2外接phy芯片88e1510调试100M通信 ,ping命令时,请问为什么rgmii2的tx[0-3]没有输出?

本帖最后由 一只耳朵怪 于 2018-6-5 14:48 编辑

各位技术大牛好!如题,详细描述如下:
按照ti说的调试网卡需要注意的三点,给出具体代码:
1.
static struct module_pin_mux rgmii1_pin_mux[] = [
[OFFSET(mii1_txen), MODE(2)], /* RGMII1_TCTL */
[OFFSET(mii1_rxdv), MODE(2) | RXACTIVE], /* RGMII1_RCTL */
[OFFSET(mii1_txd3), MODE(2)], /* RGMII1_TD3 */
[OFFSET(mii1_txd2), MODE(2)], /* RGMII1_TD2 */
[OFFSET(mii1_txd1), MODE(2)], /* RGMII1_TD1 */
[OFFSET(mii1_txd0), MODE(2)], /* RGMII1_TD0 */
[OFFSET(mii1_txclk), MODE(2)], /* RGMII1_TCLK */
[OFFSET(mii1_rxclk), MODE(2) | RXACTIVE], /* RGMII1_RCLK */
[OFFSET(mii1_rxd3), MODE(2) | RXACTIVE], /* RGMII1_RD3 */
[OFFSET(mii1_rxd2), MODE(2) | RXACTIVE], /* RGMII1_RD2 */
[OFFSET(mii1_rxd1), MODE(2) | RXACTIVE], /* RGMII1_RD1 */
[OFFSET(mii1_rxd0), MODE(2) | RXACTIVE], /* RGMII1_RD0 */
[OFFSET(mdio_data), MODE(0) | RXACTIVE | PULLUP_EN], /* MDIO_DATA */
[OFFSET(mdio_clk), MODE(0) | PULLUP_EN], /* MDIO_CLK */
[-1],
];
static struct module_pin_mux rgmii2_pin_mux[] = [
[OFFSET(gpmc_a0), MODE(2)], /* RGMII2_TCTL */
[OFFSET(gpmc_a1), MODE(2) | RXACTIVE], /* RGMII2_RCTL */
[OFFSET(gpmc_a2), MODE(2)], /* RGMII2_TD3 */
[OFFSET(gpmc_a3), MODE(2)], /* RGMII2_TD2 */
[OFFSET(gpmc_a4), MODE(2)], /* RGMII2_TD1 */
[OFFSET(gpmc_a5), MODE(2)], /* RGMII2_TD0 */
[OFFSET(gpmc_a6), MODE(2)], /* RGMII2_TCLK */
[OFFSET(gpmc_a7), MODE(2) | RXACTIVE], /* RGMII2_RCLK */
[OFFSET(gpmc_a8), MODE(2) | RXACTIVE], /* RGMII2_RD3 */
[OFFSET(gpmc_a9), MODE(2) | RXACTIVE], /* RGMII2_RD2 */
[OFFSET(gpmc_a10), MODE(2) | RXACTIVE], /* RGMII2_RD1 */
[OFFSET(gpmc_a11), MODE(2) | RXACTIVE], /* RGMII2_RD0 */
[OFFSET(mdio_data), MODE(0) | RXACTIVE | PULLUP_EN], /* MDIO_DATA */
[OFFSET(mdio_clk), MODE(0) | PULLUP_EN], /* MDIO_CLK */
[-1],
];
以上是管教配置,以下是使能配置
configure_module_pin_mux(rgmii1_pin_mux);
configure_module_pin_mux(rgmii2_pin_mux);
到此部分,我确定管教配置是没有问题的,rgmii1的tx[0-3]是有数据输出的,但rgmii2的tx[0-3]的没有,二者都有时钟输出。
2.
cpsw初始化部分代码:
static struct cpsw_platform_data cpsw_data = [
.mdio_base = CPSW_MDIO_BASE,
.cpsw_base = CPSW_BASE,
.mdio_div = 0xff,
.channels = 8,
.cpdma_reg_ofs = 0x800,
.slaves = 2,
.slave_data = cpsw_slaves,
.ale_reg_ofs = 0xd00,
.ale_entries = 1024,
.host_port_reg_ofs = 0x108,
.hw_stats_reg_ofs = 0x900,
.bd_ram_ofs = 0x2000,
.mac_control = (1 << 5),
.control = cpsw_control,
.host_port_num = 0, //此处影响eth0能否ping通 0是可以的
.version = CPSW_CTRL_VERSION_2,
];
这个结构体不是很理解,.slaves = 2这个应该是初始化两路网卡吧?? .host_port_num = 0是对应eth0?? 为什么ping的时候总是自动连接port0??
U-Boot# ping 192.172.1.85
link up on port 0, speed 100, full duplex
Using cpsw device
ping failed; host 192.172.1.85 is not alive

3. 关于phyaddr的设置,这个确定没有问题,因为可以读到芯片id,物理连接是没有问题的。

4. 关于rgmii模式使能,执行
U-Boot# md 0x44e10650
44e10650: 0000003a 00000000 00000000 00000000
可见也设置成功了。
我自己分析认为,ti说的相关设置应该没有问题,应为另外一个开发板通过rgmii1连接phy芯片,是可以ping通的。现在想不通的是,为什么rgmii2的tx[0-3]没有输出?? 难道cpsw部分只初始化了rgmii1相关的部分?? 还请大家多多指教,在线等待ing...!!!!!!!!!

回帖(7)

罗兰君

2018-6-4 13:57:52
可以在U-Boot下直接配置CPSW工作在rgmii方式下。
现在MDIO访问是成功的么?
举报

骆其节

2018-6-4 14:04:31
引用: 344868615qq 发表于 2018-6-4 13:57
可以在U-Boot下直接配置CPSW工作在rgmii方式下。
现在MDIO访问是成功的么?

你好,感谢回复。mdio访问是成功的。 U-Boot下直接配置CPSW工作在rgmii方式下,这个怎么配置呢?要参考数据手册那一部分?或者ti的sdk里面哪里有相关的源码参考,谢谢!
举报

罗兰君

2018-6-4 14:20:43
引用: 旧巷幽草香 发表于 2018-6-4 14:04
你好,感谢回复。mdio访问是成功的。 U-Boot下直接配置CPSW工作在rgmii方式下,这个怎么配置呢?要参考数据手册那一部分?或者ti的sdk里面哪里有相关的源码参考,谢谢!

请参考boardtiam335xboard.c中的board_eth_init()函数,在函数里面进行修改。
举报

骆其节

2018-6-4 14:29:31
引用: 344868615qq 发表于 2018-6-4 14:20
请参考boardtiam335xboard.c中的board_eth_init()函数,在函数里面进行修改。

你好,我换了一个官方的sdk,现在在uboot下可以ping通了,但在内核下ping不通,具体如下:
U-Boot# setenv ipaddr 192.172.1.8;setenv serverip 192.172.1.85;setenv gatewayip 192.172.1.1;ping 192.172.1.85;
link up on port 0, speed 100, full duplex
link up on port 1, speed 100, full duplex
Using cpsw device
host 192.172.1.85 is alive
可以看出rgmii2是绑定在port 1 上的,可以这样理解么??(因为用port 0 一直ping不通) 

2. 以下是内核启动网卡相关的信息:
[ 10.821136] Detected MACID=68:c9:b:c6:af:5e
[ 10.826782] cpsw: Detected MACID = 68:c9:0b:c6:af:60
[ 10.834350] input: gpio-keys as /devices/platform/gpio-keys/input/input1
[ 10.842163] omap_rtc am33xx-rtc: setting system clock to 2000-01-01 00:27:44 UTC (946686464)
[ 13.164489] kjournald starting. Commit interval 5 seconds
[ 13.170318] EXT3-fs (mmcblk0p2): warning: maximal mount count reached, running e2fsck is recommended
[ 13.183502] EXT3-fs (mmcblk0p2): using internal journal
[ 13.188995] EXT3-fs (mmcblk0p2): recovery complete
[ 13.203735] EXT3-fs (mmcblk0p2): mounted filesystem with ordered data mode
[ 13.211029] VFS: Mounted root (ext3 filesystem) on device 179:2.
[ 13.217803] Freeing init memory: 236K
[ 13.543518] FAT-fs (mmcblk0p1): utf8 is not a recommended IO charset for FAT filesystems, filesystem will be case sensitive!
[ 13.565002] FAT-fs (mmcblk0p1): IO charset utf8 not found
mount: mounting /dev/mmcblk0p1 on /sddisk failed: Invalid argument
mount: mounting /dev/mmcblk0p2 on /sddisk failed: Device or resource busy
modprobe: chdir(3.2.0): No such file or directory
Try to bring net interface up ...
sh: 1: unknown operand
ifconfig eth0 hw ether 10:23:45:67:89:ab
[ 13.709899] net eth0: CPSW phy found : id is : 0x1410dd1
ifconfig eth0 192.168.1.6 netmask 255.255.255.0 up
add default gw 192.168.1.2
Done
[01/Jan/2000:00:27:47 +0000] boa: server version Boa/0.94.13
[01/Jan/2000:00:27:47 +0000] boa: server built Jun 5 2012 at 15:18:10.
[01/Jan/2000:00:27:47 +0000] boa: starting server pid=872, port 80
Segmentation fault
/etc/rc.d/init.d/leds: line 16: led-player: not found
Please press Enter to activate this console. [ 15.703002] PHY: 0:00 - Link is Up - 100/Full
可以看出找到了两个mac地址,那我应该用那一个呢?? 
3. 以下是ifconfig输出:
~ # ifconfig -a
eth0 Link encap:Ethernet HWaddr 10:23:45:67:89:AB
inet addr:192.168.1.6 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING 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)
eth1 Link encap:Ethernet HWaddr 68:C9:0B:C6:AF:60
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
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 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:0
~ # ifconfig eth1 192.172.1.88
[ 202.582916] PHY 0:01 not found
~ # ifconfig eth1 up
~ # ifconfig eth1 192.172.1.88
~ # ping 192.172.1.85
PING 192.172.1.85 (192.172.1.85): 56 data bytes
^C
--- 192.172.1.85 ping statistics ---
6 packets transmitted, 0 packets received, 100% packet loss
请问如何处理??我觉得应该是用eth1去ping才能ping通,是这样么??  谢谢
举报

更多回帖

发帖
×
20
完善资料,
赚取积分