3521a/3520d烧录kernel后无法查询到网卡设备

3521A/3520D 板子调试开发中遇到问题:

新烧录的kernel 启动后,rootfs 中无法查询到网卡设备。

 

查看内核启动log, 发现如下log 信息:

Cannot found a valid SPI Nand Device

libphy: Fixed MDIO Bus: probed

Higmac dma_sg_phy: 0x83a80000

libphy: higmac_mdio_bus: probed

PHY mdio0:01 not found

ETH0: rmii, phy_addr=1, mii_name=mdio0

ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver

 

顺着log 在代码中搜索。PHY mdio0 无法查到,根据搜索 Higmac dma_sg_phy 查到所在文件位置。

Higmac dma_sg_phy 所在文件及位置:

W:\hisi\3520_3521_project\Hi3521A_SDK_V1.0.5.0\osdrv\opensource\kernel\linux-3.10.y\drivers\net\ethernet\hieth-gmac\higmac.c 中

static int higmac_init_sg_desc_queue(struct higmac_netdev_local *ld)

{

......

#ifdef HIGMAC_TSO_DEBUG

pr_info("Higmac dma_sg_phy: 0x%x\n", ld->dma_sg_phy);

#endif

......

}

 

根据这个地方 查看 higmac_init_sg_desc_queue 被调用地方。

 

依然是higmac.c 中

static int  higmac_dev_probe(struct platform_device *platdev)

{

#ifdef HIGMAC_TSO_SUPPORTED

ret = higmac_init_sg_desc_queue(ld);

if (ret)

goto _error_sg_desc_queue;

#endif

/* 7) register mdio bus */

ret = higmac_mdio_register();

}

 

执行完higmac_init_sg_desc_queue, 执行  higmac_mdio_register();

很显然 我们log 中看到的  libphy: higmac_mdio_bus: probed

PHY mdio0:01 not found

 是在 higmac_mdio_register函数 中出现的。进入 higmac_mdio_register 分析。

 

 

跟了这些代码发现,添加打印phy id. Phy id 打印出是0。 那phy id 并没有找到。可能phy 没注册上,也可能注册地址错了,对应不上。内核中可以配置phy addr 。默认配置时1。

  需要修改Phy 地址。在SDK 代码中 默认启用的是phy addr 1。 我这板子里需要修改为2, 接口模式 选择6。

         (2)   hieth-gmac phy0 addr                                                                
         (6)   hieth-gmac phy0 interface mode 

Symbol:HIGMAC_PHY0_ADDR [=2] 


Location:                                                                                                                 ->Device Drivers   

->Network device support (NETDEVICES [=y]) 

  |         -> Ethernet driver support (ETHERNET [=y])      

  |             -> hieth gmac family network device support (HIETH_GMAC [=y]) 
->(2)   hieth-gmac phy0 addr    

编译好后烧录启动的log, 可以读到phy_id:

libphy: Fixed MDIO Bus: probed
Higmac dma_sg_phy: 0x83a80000
libphy: higmac_mdio_bus: probed
phydev->phy_id = 0x7c0f1
ETH0: rgmii, phy_addr=2, mii_name=mdio0
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
before uhci_hcd and ohci_hcd, not after

烧录好后查看、配置好接口:

~ # ifconfig -a
eth0      Link encap:Ethernet  HWaddr F2:63:B5:22:82:8C  
          inet addr:192.168.0.55  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2410 errors:0 dropped:92 overruns:0 frame:0
          TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:134852 (131.6 KiB)  TX bytes:280 (280.0 B)
          Interrupt:48 

lo        Link encap local Loopback  
          LOOPBACK  MTU:65536  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 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

测试网络,ping 网关:
~ # ping 192.168.0.1
PING 192.168.0.1 (192.168.0.1): 56 data bytes
64 bytes from 192.168.0.1: seq=0 ttl=64 time=0.902 ms
64 bytes from 192.168.0.1: seq=1 ttl=64 time=0.810 ms
64 bytes from 192.168.0.1: seq=2 ttl=64 time=0.793 ms
64 bytes from 192.168.0.1: seq=3 ttl=64 time=0.786 ms

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值