网卡驱动基础知识

您所在的位置:网站首页 网卡知识 网卡驱动基础知识

网卡驱动基础知识

2024-02-18 08:08| 来源: 网络整理| 查看: 265

网卡驱动基础知识

目录网卡驱动基础知识网络分层网络接口imx的网卡移植

网络分层

mark

我们的网卡驱动就是最下面的两层,一个是mac这个一般是soc带的,另一个是phy这个是外挂的,常用的其他形式有几种

1. soc(带mac和phy) -----差分信号-----RJ45接口网线 2. soc(带mac,不带phy) -- RGMII/RMII ----phy -----差分信号-----RJ45接口网线 3. soc(不带mac,不带phy) - mdio接口/spi接口/gpio接口-- mac(带phy) -----差分信号-----RJ45接口网线 |________MDIO/MDCK_________________________| 4. soc(不带mac,不带phy) - mdio接口/spi接口/gpio接口-- mac(不带phy) ---RGMII/RMII---phy -----差分信号-----RJ45接口网线 |________MDIO/MDCK________________________| 网络接口

更多其他的接口知识查看01-以太网接口分析.pdf

mark

imx的网卡移植

其实phy是有通用驱动的

修改设备树

修改phy地址 修改复位管脚 &fec1 { pinctrl-names = "default"; pinctrl-0 = ; phy-mode = "rmii"; phy-reset-gpios = ; /* GPIO1_12 */ phy-handle = ; status = "okay"; }; &fec2 { pinctrl-names = "default"; pinctrl-0 = ; phy-mode = "rmii"; phy-reset-gpios = ; /* GPIO1_10 */ phy-handle = ; status = "okay"; mdio { #address-cells = ; #size-cells = ; ethphy0: ethernet-phy@5 { compatible = "ethernet-phy-i00d22.1537"; reg = ; status = "okay"; };/*compatible = "ethernet-phy-i00d22.1537","ethernet-phy-ieee802.3-c22","ethernet-phy-ieee802.3-c45";*/ ethphy1: ethernet-phy@1 { compatible = "ethernet-phy-id0022.1537";/*compatible = "ethernet-phy-id0022.1537","ethernet-phy-ieee802.3-c22","ethernet-phy-ieee802.3-c45";*/ reg = ; status = "okay"; }; }; };

启动信息如下,下面这个是通用驱动,如果是指定了具体驱动,这里会有显示驱动名字的

ifconfig eth0 up   fec 2188000.ethernet eth0: Freescale FEC PHY driver [Generic PHY] (mii_bus:phy_addr2188000.ethernet:00, irq=-1)  IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready  

当插上网线提示

libphy: 2188000.ethernet:00 - Link is Up - 100/Full   IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready 

设置ip就可以ping通局域网地址了,或者使用udhpc,添加网关使用route add default gw 192.168.2.1我之前ping不通,是由于外接50M晶振,所以无法ping,后面去除了就能ping通

关键文件

关键文件 arch/arm/mach-imx/mach-imx6u.c 这里有对专门的phy的一些fixup imx.c drivers/net/phy/mdio_bus.c 当使用通用驱动的时候会调用到这里,可以查看调用关系 drivers/regulator/core.c > _regulator_get 在这里使用dump_stack()


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3