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.

求教 am335x 网口问题!!!



公司做了块 am335x 的板,现在网口配成了双网口,rmii模式,网口的 ref_clk 用的外部50M时钟,启动后,会有下面的输出:

[ OK ] Started Network Service.
[ 14.741319] net eth1: initializing cpsw version 1.12 (0)
[ 14.749424] net eth0: initialized cpsw ale version 1.4
[ 14.849601] net eth1: phy found : id is : 0x221513
[ 14.854581] Unable to handle kernel NULL pointer dereference at virtual address 0000004c
[ 14.885041] pgd = cc008000
[ 14.887804] [0000004c] *pgd=00000000
[ 14.901457] Internal error: Oops: 5 [#1] PREEMPT ARM
[ 14.906454] Modules linked in:
[ 14.909535] CPU: 0 PID: 324 Comm: systemd-network Not tainted 4.4.12-g3639bea54a #1
[ 14.917223] Hardware name: Generic AM33XX (Flattened Device Tree)
[ 14.923341] task: cd995dc0 ti: cdfb2000 task.ti: cdfb2000
[ 14.928790] PC is at cpsw_phy_sel+0x50/0x74
[ 14.933002] LR is at bus_find_device+0x88/0xa8
[ 14.937464] pc : [<c04a72f8>] lr : [<c0436658>] psr: 60070113
[ 14.937464] sp : cdfb3b20 ip : cdfb3af8 fp : cdfb3b3c
[ 14.948989] r10: cdea60c0 r9 : cdfc0d10 r8 : 00000000
[ 14.954233] r7 : cd99b5c8 r6 : 00000001 r5 : 00000006 r4 : cd8e4410
[ 14.960784] r3 : 00000000 r2 : 00000001 r1 : 00000006 r0 : 00000000
[ 14.967340] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
[ 14.974503] Control: 10c5387d Table: 8c008019 DAC: 00000051
[ 14.980269] Process systemd-network (pid: 324, stack limit = 0xcdfb2210)
[ 14.986997] Stack: (0xcdfb3b20 to 0xcdfb4000)
[ 14.991375] 3b20: cd99b480 cdb0d6b4 00000000 cd99b5c8 cdfb3b6c cdfb3b40 c04a9ccc c04a72b4
[ 14.999589] 3b40: 00000003 00000000 cdfb3b6c cd99b000 00000001 cd99b480 00001002 00000000
[ 15.007803] 3b60: cdfb3bfc cdfb3b70 c04ac7b4 c04a9b0c 00000000 fffffff2 fffffff1 cdfb3c04
[ 15.016017] 3b80: 0000000d 00000000 00000000 cdfc0d10 cdfb3bc4 cdfb3ba0 c005a04c c06370e8
[ 15.024231] 3ba0: cdfb3c04 0000000d cd99b000 00001002 00000000 cdfc0d10 cdfb3bdc cdfb3bc8
[ 15.032445] 3bc0: c005a188 c005a00c 00000000 00000000 cdfb3bfc cdfb3be0 cd99b000 c0844c40
[ 15.040659] 3be0: 00001003 00001002 00000000 cdfc0d10 cdfb3c1c cdfb3c00 c062f83c c04ac63c
[ 15.048873] 3c00: c062f774 cd99b000 cd99b000 00000001 cdfb3c44 cdfb3c20 c062faf8 c062f788
[ 15.057087] 3c20: cd99b000 cd99b138 00001002 c0844c40 00000000 cdfc0d10 cdfb3c6c cdfb3c48
[ 15.065301] 3c40: c062fbc8 c062fa68 cd99b000 cdfb3ce8 00000000 c0844c40 00000000 cdfc0d10
[ 15.073515] 3c60: cdfb3ccc cdfb3c70 c063fdc0 c062fbb4 cdfb3c9c 00000000 00000000 00000000
[ 15.081728] 3c80: 00000000 00000000 00000000 00000000 00000000 cdfc0d28 cdfb3ccc cdfb3ca8
[ 15.089943] 3ca0: c063cce4 cd99b000 cdea60c0 cdfc0d10 00000000 00000000 00000000 00000000
[ 15.098156] 3cc0: cdfb3da4 cdfb3cd0 c0640370 c063fb00 cdfb3cd8 00000000 cd33fb00 cd848400
[ 15.106370] 3ce0: cd003020 00000001 00000000 00000000 00000000 00000000 00000000 00000000
[ 15.114583] 3d00: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 15.122796] 3d20: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 15.131010] 3d40: 00000000 00000000 00000000 00000000 cdfc0d20 00000000 00000000 00000000
[ 15.139223] 3d60: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 15.147437] 3d80: 00000000 00000000 cdfb3da4 00000024 cdfc0d00 cdea60c0 cdfb3de4 cdfb3da8
[ 15.155651] 3da0: c063f288 c06402a0 cdfb3dd4 cdfb3db8 c0154a2c c011d128 00150015 cd2f84c8
[ 15.163866] 3dc0: 00000000 cdfc0d00 c063f1ac cdea60c0 cdea60c0 00000000 cdfb3e04 cdfb3de8
[ 15.172080] 3de0: c06812d4 c063f1b8 cdea60c0 00000030 cdd86800 cdea60c0 cdfb3e1c cdfb3e08
[ 15.180294] 3e00: c063f1a4 c0681238 cd8c0800 00000030 cdfb3e4c cdfb3e20 c0680c58 c063f184
[ 15.188508] 3e20: 00000008 7fffffff 00000000 cdfb3edc cdd86800 cdea60c0 00000008 00000030
[ 15.196722] 3e40: cdfb3eac cdfb3e50 c0681054 c0680b00 c007be14 c0079de8 cd33fcf0 c07d062c
[ 15.204936] 3e60: c07d062c cd33fcf0 c07d062c cdfbd3c0 00000000 00000144 000003e3 000003e0
[ 15.213151] 3e80: c007c024 00000000 00000000 cd0d3c00 00000122 c000f9c4 cdfb2000 00000000
[ 15.221365] 3ea0: cdfb3ebc cdfb3eb0 c06147e0 c0680de0 cdfb3fa4 cdfb3ec0 c0615864 c06147d0
[ 15.229579] 3ec0: cdfb3ee4 cdfb3ed0 c007c024 00000000 00000000 7f656788 00000030 cdfb3f08
[ 15.237792] 3ee0: 00000010 00000001 00000000 00000000 cdfb3edc 00000000 00000000 00000000
[ 15.246007] 3f00: 00000000 c0078870 00000010 00000000 00000000 00000000 05363a80 00ddbab2
[ 15.254221] 3f20: a87fd37f ffffffff 8c0066df 0000c8eb cdfb3f4c cdfb3f88 7f650b08 b6fe2ce0
[ 15.262436] 3f40: 00000107 c000f9c4 cdfb2000 00000000 cdfb3f84 cdfb3f60 c0082f5c c00875d8
[ 15.270650] 3f60: 0000000e 00000051 b6fe2ce0 00000107 c000f9c4 be8f193c 00000008 00000000
[ 15.278864] 3f80: be8f193c c0084430 0000000e be8f193c 00000010 b6fe2ce0 00000000 cdfb3fa8
[ 15.287079] 3fa0: c000f800 c06157b0 be8f193c 00000010 00000003 7f656788 00000030 00000000
[ 15.295293] 3fc0: be8f193c 00000010 b6fe2ce0 00000122 be8f196c 7f6537d8 0000c0ff b6fe2ce0
[ 15.303507] 3fe0: be8f1930 be8f1924 7f5bb98c b6fb327c 60010030 00000003 8e7f2861 8e7f2c61
[ 15.311714] Backtrace:
[ 15.314188] [<c04a72a8>] (cpsw_phy_sel) from [<c04a9ccc>] (cpsw_slave_open+0x1cc/0x2a0)
[ 15.322223] r7:cd99b5c8 r6:00000000 r5:cdb0d6b4 r4:cd99b480
[ 15.327932] [<c04a9b00>] (cpsw_slave_open) from [<c04ac7b4>] (cpsw_ndo_open+0x184/0x690)
[ 15.336053] r8:00000000 r7:00001002 r6:cd99b480 r5:00000001 r4:cd99b000
[ 15.342832] [<c04ac630>] (cpsw_ndo_open) from [<c062f83c>] (__dev_open+0xc0/0x124)
[ 15.350430] r9:cdfc0d10 r8:00000000 r7:00001002 r6:00001003 r5:c0844c40 r4:cd99b000
[ 15.358240] [<c062f77c>] (__dev_open) from [<c062faf8>] (__dev_change_flags+0x9c/0x14c)
[ 15.366273] r5:00000001 r4:cd99b000
[ 15.369877] [<c062fa5c>] (__dev_change_flags) from [<c062fbc8>] (dev_change_flags+0x20/0x50)
[ 15.378347] r9:cdfc0d10 r8:00000000 r7:c0844c40 r6:00001002 r5:cd99b138 r4:cd99b000
[ 15.386169] [<c062fba8>] (dev_change_flags) from [<c063fdc0>] (do_setlink+0x2cc/0x7a0)
[ 15.394116] r9:cdfc0d10 r8:00000000 r7:c0844c40 r6:00000000 r5:cdfb3ce8 r4:cd99b000
[ 15.401924] [<c063faf4>] (do_setlink) from [<c0640370>] (rtnl_setlink+0xdc/0x118)
[ 15.409434] r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:cdfc0d10 r5:cdea60c0
[ 15.417323] r4:cd99b000
[ 15.419874] [<c0640294>] (rtnl_setlink) from [<c063f288>] (rtnetlink_rcv_msg+0xdc/0x220)
[ 15.427995] r6:cdea60c0 r5:cdfc0d00 r4:00000024
[ 15.432653] [<c063f1ac>] (rtnetlink_rcv_msg) from [<c06812d4>] (netlink_rcv_skb+0xa8/0xc4)
[ 15.440949] r8:00000000 r7:cdea60c0 r6:cdea60c0 r5:c063f1ac r4:cdfc0d00
[ 15.447709] [<c068122c>] (netlink_rcv_skb) from [<c063f1a4>] (rtnetlink_rcv+0x2c/0x34)
[ 15.455655] r7:cdea60c0 r6:cdd86800 r5:00000030 r4:cdea60c0
[ 15.461379] [<c063f178>] (rtnetlink_rcv) from [<c0680c58>] (netlink_unicast+0x164/0x20c)
[ 15.469501] r5:00000030 r4:cd8c0800
[ 15.473104] [<c0680af4>] (netlink_unicast) from [<c0681054>] (netlink_sendmsg+0x280/0x33c)
[ 15.481399] r8:00000030 r7:00000008 r6:cdea60c0 r5:cdd86800 r4:cdfb3edc
[ 15.488175] [<c0680dd4>] (netlink_sendmsg) from [<c06147e0>] (sock_sendmsg+0x1c/0x2c)
[ 15.496033] r10:00000000 r9:cdfb2000 r8:c000f9c4 r7:00000122 r6:cd0d3c00 r5:00000000
[ 15.503923] r4:00000000
[ 15.506475] [<c06147c4>] (sock_sendmsg) from [<c0615864>] (SyS_sendto+0xc0/0xe8)
[ 15.513917] [<c06157a4>] (SyS_sendto) from [<c000f800>] (ret_fast_syscall+0x0/0x3c)
[ 15.521602] r6:b6fe2ce0 r5:00000010 r4:be8f193c
[ 15.526258] Code: e34c00af ebfe3cb7 e1a02006 e1a01005 (e590004c)
[ 16.689597] ---[ end trace 07ca2072902c2ad0 ]---

我查看cpsw.c里的 cpsw_phy_sel() 函数,发现调用bus_find_device() 时,传递了一个NULL指针,请问这没什么问题么???

另外,我用了外部时钟,请问设备树需要更改时钟方面的配置么!!!!先谢过各位了!!!!

  • 网口这部分的driver用的很久了,在MII/RMI/RGMII模式下都有大量的人在使用,所以个人建议如果使用的是原生态的代码,没有改过,先不用考量说这个CPWSdriver中是否存在问题,主要还是看移植网口驱动的那几个基本点:1. pinmux是否有设置正确,2. phy id是否正确;3. gmii_sel模式是否正确。对于RMII而言,还需要多留心一点,就是时钟源来自于外部,所以在配置0x44e10650中的bit6,7位时要注意选择input模式。

    rmii2_io_clk_en R/W

    0: RMII Reference Clock Output mode. Enable RMII clock to be sourced from PLL.

    1: RMII Reference Clock Input mode. Enable RMII clock to be sourced from chip pin.

    除了这个问题之外,从系统的角度,还要强调一点,是否有做过DDR3 software leveling的测试,确保DDR的稳定性?

  • 您好,外部时钟脚的设置,是不是只要在设备树里设置成输入就OK了?还是要在源码里更改?

  • 建议你直接加打印把0x44e10650这个寄存器的数值打印出来做确认。

  • 是dts的问题 现在已经可以了  谢谢!!!