接前一篇文章:Linux网络驱动之Fixed-Link(2)
本文内容参考:
linux phy fixed-link-CSDN博客
fixed-link 网口驱动设备树-CSDN博客
GMAC网卡Fixed-Link模式 - StepForwards - 博客园
RTL8367RB的国产P2P替代方案用JL6107-PC的可行性及实现方法-CSDN博客
fixed-link 网口驱动设备树-CSDN博客
设备树 fixed-link 使用说明-CSDN博客
特此致谢!
三、深入了解
3. 设备树中Fixed-Link项的详细解析
上一回给出了Fixed-link核心定义以及设备树中Fixed-Link的写法。再来回顾一下:
甭管是新写法还是老写法,规则都是一个规则。下边就来看一下Linux内核对于设备树中Fixed-Link相关的说明:
Fixed link Device Tree binding ------------------------------ Some Ethernet MACs have a "fixed link", and are not connected to a normal MDIO-managed PHY device. For those situations, a Device Tree binding allows to describe a "fixed link". Such a fixed link situation is described by creating a 'fixed-link' sub-node of the Ethernet MAC device node, with the following properties: * 'speed' (integer, mandatory), to indicate the link speed. Accepted values are 10, 100 and 1000 * 'full-duplex' (boolean, optional), to indicate that full duplex is used. When absent, half duplex is assumed. * 'pause' (boolean, optional), to indicate that pause should be enabled. * 'asym-pause' (boolean, optional), to indicate that asym_pause should be enabled. * 'link-gpios' ('gpio-list', optional), to indicate if a gpio can be read to determine if the link is up. Old, deprecated 'fixed-link' binding: * A 'fixed-link' property in the Ethernet MAC node, with 5 cells, of the form <a b c d e> with the following accepted values: - a: emulated PHY ID, choose any but but unique to the all specified fixed-links, from 0 to 31 - b: duplex configuration: 0 for half duplex, 1 for full duplex - c: link speed in Mbits/sec, accepted values are: 10, 100 and 1000 - d: pause configuration: 0 for no pause, 1 for pause - e: asymmetric pause configuration: 0 for no asymmetric pause, 1 for asymmetric pause Examples: ethernet@0 { ... fixed-link { speed = <1000>; full-duplex; }; ... }; ethernet@1 { ... fixed-link { speed = <1000>; pause; link-gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; }; ... };中文翻译如下(逐段):
(1)第1段
固定链接(Fixed link)设备树绑定
------------------------------
某些以太网MAC具有“固定链接”,并且未连接到普通的MDIO管理的PHY设备。对于此类情况,设备树绑定允许描述“固定链接”。
(2)第2段
通过创建“fixed-link”以太网MAC设备结点的子结点,来描述这种固定链接情况,(该子结点)具有以下属性:
- speed(整数,必填):表示链接速度。可接受值为10、100和1000。
- 全双工(布尔值,可选):表示全双工被使用。如果未指定,则假定为半双工。
- pause(布尔值,可选):表示是否启用pause(暂停流控)。
- asym-pause(布尔值,可选):表示是否启用asym_pause(非对称暂停流控)。
- link-gpios('gpio-list',可选):指示是否可以通过读取gpio,以确定链接是否正常。
(3)第3段
旧的,已弃用的“fixed-link”绑定:
以太网MAC节点中具有5个单元的“固定链接”属性,格式为<a b c d e>,具有以下可接受的值:
- a:模拟PHY ID,可以从0到31中选择任何一个,但对所有指定的固定链路都是唯一的
- b:双工配置,半双工为0、全双工为1
- c:链接速度(以Mbits /秒为单位),可接受的值为:10、100和1000
- d:暂停配置,0表示不暂停、1表示暂停
- e:非对称暂停配置,0表示没有非对称暂停、1表示非对称暂停
(4)第4段
示例代码就无需翻译了。
至此,设备树中的“fixed-link”就基本讲清楚了。更多内容请看下回。