免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4840 | 回复: 8

[硬件及驱动] 内核网卡无法驱动 [复制链接]

论坛徽章:
0
发表于 2013-04-09 17:16 |显示全部楼层
本帖最后由 shuimu_1 于 2013-04-09 17:17 编辑

首先说一下这个帖子在嵌入式那边发过,没人搭理,感觉CU的版块好细,但是细的同时好多板块很多内容就重叠了。
所以在这里重新发一下,见谅哦,您的一句话可能就点醒我咯,先谢:

再说情况:平台:MPC8313ERDB  网卡设备:两块MV88E1111

问题:
在移植的过程中,u-boot下两个网卡都可以ping通虚拟机,移植完uImage以后其中一个网卡无法ping通,自己分析了一些,但是还不够,
总觉得缺少什么,所以还请各位帮忙想想问题出现的可能原因。

先说说对于千兆网设备驱动加载 我的理解是:
1、platform总线注册
2、mdio总线注册
3、platform总线上设备注册   
4、mdio总线上的驱动添加
5、platform上的mdio设备驱动添加并绑定设备
6、mdio总线设备添加并绑定驱动
7、platform上的gianfar设备驱动添加并绑定设备
8、gianfar和phy连接
问题一:启动kernel后最末打印一段如下信息
PHY: 0:01 - Link is Up - 1000/Full
PHY: e0024520:04 - Link is Up - 100/Full
网卡一俨然是没有驱动起来了,何解呢?
问题二:我跟踪内核源代码的时候,在完成第三步时候,共注册了三个相关网卡的设备:e0024000.ethernet,e0024520.mdio,e0025000.ethernet
(硬件上两个千兆网公用一个cpu上面的mdio口),所以我想知道这里还需要注册设备:e0025520.mdio吗?注册不上可能是什么原因呢?
问题三:完成第5步的时候,我添加了打印消息如下:
driver_probe_device() - mdio_bus: Matched Device e0024520:04 with Driver Marvell 88E1111
driver_probe_device() - mdio_bus: Matched Device e0024520:05 with Driver Marvell 88E1111
貌似驱动和设备绑定不正确,求解?
问题四:这下面打印的信息是我在phy初始化中添加的,可以看到eth0没有连接到设备上去,但是我不知道下一步该怎么做了,希望您能给点建议,不甚感激
Setting up networking on loopback device:
Setting up networking on eth0:
init_phy:priv->einfo->bus_id = 0 ---priv->einfo->phy_id = 1
init_phy:phy_id = 0:01
phy_connect :1phy_id = 0:01
phy_attach:d = c7e45608--- phy_id = 0:01
shit!!!!phy_connect :2phy_id = 0:01
Adding static route for default gateway to 192.168.1.1:
Setting nameserver to 192.168.1.1 in /etc/resolv.conf:
Setting up networking on eth1:
init_phy:priv->einfo->bus_id = e0024520 ---priv->einfo->phy_id = 4
init_phy:phy_id = e0024520:04
phy_connect :1phy_id = e0024520:04
phy_attach:d = c7e45e08--- phy_id = e0024520:04
phy_connect :2phy_id = e0024520:04
Adding static route for default gateway to 192.168.1.1:
Setting nameserver to 192.168.1.1 in /etc/resolv.conf:


这个博客是我一直参考的:http://blog.csdn.net/gorilla0123/article/details/6010991
写的比较简单,但是比较全了

最后面贴一段我的uboot以及kernel启动信息吧:
U-Boot 1.3.0 (Mar 26 2013 - 18:11:12) MPC83XX

Reset Status:

CPU:   e300c3, MPC8313E, Rev: 21 at 333.333 MHz, CSB:  166 MHz
Board: Freescale MPC8313ERDB
I2C:   ready
DRAM:  128 MB
FLASH:  8 MB
NAND:
In:    serial
Out:   serial
Err:   serial
Net:   TSEC0, TSEC1 [PRIME]
=> bootm fe100000 fe300000 fe700000
## Booting image at fe100000 ...
   Image Name:   Linux-2.6.23
   Created:      2013-03-27   5:51:58 UTC
   Image Type:   PowerPC Linux Kernel Image (gzip compressed)
   Data Size:    1617272 Bytes =  1.5 MB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
## Loading RAMDisk Image at fe300000 ...
   Image Name:   uboot ext2 ramdisk rootfs
   Created:      2012-11-23  19:22:37 UTC
   Image Type:   PowerPC Linux RAMDisk Image (gzip compressed)
   Data Size:    3539456 Bytes =  3.4 MB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
   Booting using the fdt at 0xfe700000
   Loading Ramdisk to 07bd9000, end 07f39200 ... OK
   Loading Device Tree to 007fc000, end 007fefff ... OK
Using MPC8313 RDB machine description
Linux version 2.6.23 (kanbin@ubuntu) (gcc version 4.1.2) #1 Tue Mar 26 22:51:53 PDT 2013
Found initrd at 0xc7bd9000:0xc7f39200
console [udbg0] enabled
setup_arch: bootmem
mpc8313_rdb_setup_arch()
Found MPC83xx PCI host bridge at 0x00000000e0008500. Firmware bus number: 0->0
arch: exit
Zone PFN ranges:
  DMA             0 ->    32768
  Normal      32768 ->    32768
Movable zone start PFN for each node
early_node_map[1] active PFN ranges
    0:        0 ->    32768
Built 1 zonelists in Zone order.  Total pages: 32512
Kernel command line: root=/dev/ram console=ttyS0,115200
IPIC (128 IRQ sources) at fdef9700
PID hash table entries: 512 (order: 9, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 122848k/131072k available (3188k kernel code, 8064k reserved, 148k data, 94k bss, 152k init)
Mount-cache hash table entries: 512
NET: Registered protocol family 16
            
PCI: Probing PCI hardware
Generic PHY: Registered new driver
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
checking if image is initramfs...it isn't (no cpio magic); looks like an initrd
Freeing initrd memory: 3456k freed
JFFS2 version 2.2. (NAND) �© 2001-2006 Red Hat, Inc.
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0xe0004500 (irq = 1 is a 16550A
console handover: boot [udbg0] -> real [ttyS0]
serial8250.0: ttyS1 at MMIO 0xe0004600 (irq = 19) is a 16550A
RAMDISK driver initialized: 16 RAM disks of 32768K size 1024 blocksize
loop: module loaded
Intel(R) PRO/1000 Network Driver - version 7.3.20-k2-NAPI
Copyright (c) 1999-2006 Intel Corporation.
Gianfar MII Bus: probed
fsl-gianfar fsl-gianfar.0: enabling Lossless Flow Control
eth0: Gianfar Ethernet Controller Version 1.3-skbr, 00:e0:0c:00:95:01
GFAR: SKB Handler initialized at CPU#0(max=32)
eth0: MTU = 1500 (frame size=1526, truesize=1800)
eth0: Running with NAPI enabled
eth0: 64/64 RX/TX BD ring size
fsl-gianfar fsl-gianfar.1: enabling Lossless Flow Control
eth1: Gianfar Ethernet Controller Version 1.3-skbr, 00:e0:0c:00:95:02
GFAR: SKB Handler initialized at CPU#0(max=32)
eth1: MTU = 1500 (frame size=1526, truesize=1800)
eth1: Running with NAPI enabled
eth1: 64/64 RX/TX BD ring size
e100: Intel(R) PRO/100 Network Driver, 3.5.23-k4-NAPI
e100: Copyright(c) 1999-2006 Intel Corporation
Marvell 88E1101: Registered new driver
Marvell 88E1112: Registered new driver
Marvell 88E1111: Registered new driver
Marvell 88E1145: Registered new driver
Fixed MDIO Bus: probed
nor: Found 1 x16 devices at 0x0 in 16-bit bank
Amd/Fujitsu Extended Query Table at 0x0040
nor: Swapping erase regions for broken CFI table.
number of CFI chips: 1
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
RedBoot partition parsing not available
physmap-flash nor: Using OF partition information
Creating 5 MTD partitions on "nor":
0x00000000-0x00100000 : "U-Boot"
0x00100000-0x00300000 : "Kernel"
0x00300000-0x00700000 : "rootfs"
0x00700000-0x00710000 : "DTB"
0x00710000-0x00800000 : "vsc-util"
Freescale eLBC NAND Driver (C) 2006-2007 Freescale
No NAND device found!!!
mpc83xx_spi.0: MPC83xx SPI Controller driver at 0xc9066000 (irq = 21)
usbmon: debugfs is not available
fsl-ehci fsl-ehci.0: Freescale On-Chip EHCI Host Controller
fsl-ehci fsl-ehci.0: new USB bus registered, assigned bus number 1
fsl-ehci fsl-ehci.0: irq 38, io base 0xe0023000
fsl-ehci fsl-ehci.0: USB 2.0 started, EHCI 1.00, driver 10 Dec 2004
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
i2c /dev entries driver
rtc-ds1307 0-0068: rtc core: registered ds1339 as rtc0
WDT driver for MPC83xx initialized. mode:reset timeout=65535 (25 seconds)
mmc_spi spi28672.0: SD/MMC host mmc0, no DMA, no WP, no poweroff
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
rtc-ds1307 0-0068: setting the system clock to 2000-01-18 18:41:37 (948220897)
RAMDISK: Compressed image found at block 0
VFS: Mounted root (ext2 filesystem) readonly.
Freeing unused kernel memory: 152k init
Setting the hostname to mpc8313erdb
Mounting filesystems
Running sysctl
Setting up networking on loopback device:
Setting up networking on eth0:
Adding static route for default gateway to 192.168.1.1:
Setting nameserver to 192.168.1.1 in /etc/resolv.conf:
Setting up networking on eth1:
Adding static route for default gateway to 192.168.1.1:
Setting nameserver to 192.168.1.1 in /etc/resolv.conf:
Starting inetd:


        Welcome to Freescale Semiconductor Embedded Linux Environment

!!!!! WARNING !!!!!!!

The default password for the root account is: root
please change this password using the 'passwd' command
and then edit this message (/etc/issue) to remove this message

mpc8313erdb login:
PHY: 0:01 - Link is Up - 1000/Full
PHY: e0024520:04 - Link is Up - 100/Full

论坛徽章:
0
发表于 2013-04-09 23:54 |显示全部楼层
你们是自己做的板子? 还是就是开发板。8313开发板 应该etsec1应该直接连的是一个switch。etsec2直接通过rgmii连一个phy。所以你说的两个phy 是你们自己做的板子etsec1也换成连接phy了?

论坛徽章:
0
发表于 2013-04-10 08:35 |显示全部楼层
这个是我们自己做的板子,但是也是参考一个MPC8313E的板子做的,etsec1和etsec2都连接phy的

论坛徽章:
10
戌狗
日期:2013-10-17 09:43:0215-16赛季CBA联赛之广东
日期:2018-02-05 11:22:1215-16赛季CBA联赛之八一
日期:2016-07-04 12:26:1815-16赛季CBA联赛之青岛
日期:2016-06-08 11:15:4115-16赛季CBA联赛之辽宁
日期:2016-04-05 10:10:1415-16赛季CBA联赛之辽宁
日期:2016-03-11 11:11:48酉鸡
日期:2014-12-18 14:35:48狮子座
日期:2014-02-20 10:14:07寅虎
日期:2013-12-02 13:48:2915-16赛季CBA联赛之广夏
日期:2018-03-21 08:51:10
发表于 2013-04-10 10:16 |显示全部楼层
如果boot能通,估计kernel配置mac有点问题,直接接到phy,配置需要修改下吧。
这算好的,要boot不通就杯具了。

论坛徽章:
0
发表于 2013-04-10 11:03 |显示全部楼层
boot通了,是不是意味着boot传给kernel的参数是没有错误的?而对于直接连接到phy:etsec1和etsec2我在u-boot里面改成都是直接通过rgmii连到phy的,所以其他的配置可能还要改哪里呢?是不是在kernel里面还要改一遍etsec1通过rgmii连接到phy?

论坛徽章:
10
戌狗
日期:2013-10-17 09:43:0215-16赛季CBA联赛之广东
日期:2018-02-05 11:22:1215-16赛季CBA联赛之八一
日期:2016-07-04 12:26:1815-16赛季CBA联赛之青岛
日期:2016-06-08 11:15:4115-16赛季CBA联赛之辽宁
日期:2016-04-05 10:10:1415-16赛季CBA联赛之辽宁
日期:2016-03-11 11:11:48酉鸡
日期:2014-12-18 14:35:48狮子座
日期:2014-02-20 10:14:07寅虎
日期:2013-12-02 13:48:2915-16赛季CBA联赛之广夏
日期:2018-03-21 08:51:10
发表于 2013-04-10 13:26 |显示全部楼层
回复 5# shuimu_1
是这样的,读写寄存器的方法会有不同。


   

论坛徽章:
0
发表于 2013-04-10 14:46 |显示全部楼层
回复 5# shuimu_1
你etsec1现在也是直连phy嘛,你自己修改了u-boot当然能通了,kernel你要改dts,dts里面默认etsec1是接switch 所以mac的配置都是写死了 千兆的。你要把dts etsec1也改成和etsec2一样。

   

论坛徽章:
0
发表于 2013-04-10 18:19 |显示全部楼层
嗯,我也是今天下午才知道要改dts文件,很谢谢的,我在试着改,虽然以前没改过。

论坛徽章:
0
发表于 2013-04-11 16:47 |显示全部楼层
问题解决,修改一下dts文件就行了
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP