求助:Micrel KSZ8041FTL 光口PHY芯片在Linux下的驱动调试

heat.huang 2019-04-05 01:26:35
(一)开发环境:
平台:SAMA5D27-SOM1-EK
处理器:ARM Cortex A5
Linux系统版本:4.14.88
PHY芯片:Micrel KSZ8041FTL (Fiber-Mode)

(二)问题描述:
在设备树 macb 节点下添加 phy子节点,并添加compatible属性包含了phy的ID,用于phy驱动的匹配。
			macb0: ethernet@f8008000 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_macb0_default>;
phy-mode = "rmii";

/* 光 PHY */
ethernet-phy@1 {
compatible = "ethernet-phy-id0022.1510", "ethernet-phy-ieee802.3-c22";
reg = <0x1>; /*The default PHY Address is 00001 */
interrupt-parent = <&pioA>;
interrupts = <PIN_PD31 IRQ_TYPE_LEVEL_LOW>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_macb0_phy_irq>;
// reset-gpios = <&pioD 19 1>;
// micrel,rmii-reference-clock-select-25-mhz;

micrel,fiber-mode; /*光纤模式*/

};


};

KSZ8041FTL 驱动: \drivers\net\phy\micrel.c ,内核中已支持。
目前系统跑起来后,加载了phy的驱动,启动信息如下。但初试化网卡时提示网卡没有被激活,udhcpc也没有办法分配IP地址。应该从哪些地方去排查问题呢?
【启动信息如下,有些信息是我自己添加的打印日志】
CAN device driver interface
m_can fc050000.can: m_can device registered (irq=47, version=31)
========== macb_probe =========
macb f8008000.ethernet: invalid hw address, using random
========> macb_mii_init =======
-- of_mdiobus_register --
=============> Enter mdiobus_register =========
libphy: MACB_mii_bus: probed
== bus->name: MACB_mii_bus==
=== End mdiobus_register ===
=== of_mdio_parse_addr: addr = 1 ===
==== enter: of_mdiobus_register_phy =====
is_c45 = 0
ret = 0
value = 1
==== enter: phy_device_create =====
== phy_device init ok ==
==== kszphy_probe ok. =====
=== Limit supported and advertised modes in fiber mode ===
Micrel KSZ8041 f8008000.ethernet-ffffffff:01: attached PHY driver [Micrel KSZ8041] (mi
macb f8008000.ethernet eth0: Cadence GEM rev 0x00020203 at 0xf8008000 irq 28 (46:2e:5


分配地址:
Starting network: IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
=== Skip auto-negotiation in fiber mode ===
== phydev->speed : 100 ==
== phydev->duplex : 1 ==
== phydev->phy_id : 221510 ==
== phydev->autoneg : 0 ==
udhcpc: started, v1.26.2
udhcpc: sending discover
udhcpc: sending discover
udhcpc: sending discover
udhcpc: no lease, failing
FAIL


进入系统后,ifconfig查看网卡状态
# ifconfig
eth0 Link encap:Ethernet HWaddr 46:2E:53:1D:E1:E4
UP 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)
Interrupt:28 Base address:0x8000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING 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:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

#
# ethtool eth0
Settings for eth0:
Supported ports: [ ]
Supported link modes: 100baseT/Half 100baseT/Full
Supported pause frame use: No
Supports auto-negotiation: No
Advertised link modes: 100baseT/Half 100baseT/Full
Advertised pause frame use: No
Advertised auto-negotiation: No
Speed: 100Mb/s
Duplex: Full
Port: MII
PHYAD: 1
Transceiver: external
Auto-negotiation: off
Link detected: no


(三) 希望大神们帮忙分析分析,万分感激!
...全文
805 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
gz0797 2019-04-24
  • 打赏
  • 举报
回复
试试ifconfig eth0 up命令,看看起来 没有

21,595

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 驱动开发/核心开发
社区管理员
  • 驱动开发/核心开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧