gpt4 book ai didi

linux - 用于与 DSA 交换机的无 PHY 连接的设备树

转载 作者:太空狗 更新时间:2023-10-29 12:14:17 41 4
gpt4 key购买 nike

我们在为 Marvell DSA 交换机和 Xilinx Zynq 处理器的配置创 build 备树时遇到了一个小问题。它们是这样连接的:

|——————————————|               |——————————————————————————————|
| e000b000—|———— SGMII ————|—port6 (0x16) port3 —— PHY3
| Zynq | | mv88e6321 |
| e000c000—|—x x—|—port5 port4 —— PHY4
|——————————————| |——————————————————————————————|
|___________ MDIO _______________|

我们有一个 Linux 内核的设备树,如下所示:

ps7_ethernet_0: ps7-ethernet@e000b000 {
#address-cells = <1>;
#size-cells = <0>;
clock-names = "ref_clk", "aper_clk";
clocks = <&clkc 13>, <&clkc 30>;
compatible = "xlnx,ps7-ethernet-1.00.a";
interrupt-parent = <&ps7_scugic_0>;
interrupts = <0 22 4>;
local-mac-address = [00 0a 35 00 00 00];
phy-handle = <&phy0>;
phy-mode = "gmii";
reg = <0xe000b000 0x1000>;
xlnx,ptp-enet-clock = <0x69f6bcb>;
xlnx,enet-reset = "";
xlnx,eth-mode = <0x0>;
xlnx,has-mdio = <0x1>;
mdio_0: mdio {
#address-cells = <1>;
#size-cells = <0>;
phy0: phy@16 {
compatiable = "marvell,dsa";
reg = <0x16>;
} ;
} ;

} ;

dsa@0 {
compatible = "marvell,dsa";

#address-cells = <2>;
#size-cells = <0>;

interrupts = <10>;

dsa,ethernet = <&ps7_ethernet_0>;
dsa,mii-bus = <&mdio_0>;

switch@0 {
#address-cells = <1>;
#size-cells = <0>;
reg = <0 0>;
port@3 {
reg = <3>;
label = "lan0";
};
port@4 {
reg = <4>;
label = "lan1";
};
port@5 {
reg = <5>;
label = "lan2";
};
port@6 {
reg = <6>;
label = "cpu";
};
};
};
} ;

问题是,正如您从图片中看到的那样,没有 PHY 连接到端口 6,即 Zynq 和交换机之间的连接是无 PHY 的,但我必须指定 <phy0>在设备树中使 dsa 驱动程序看到开关。但随后它尝试与不存在的 PHY 通信,但显然失败了。

所以问题是:如何为连接到处理器的 dsa 交换机创建合适的设备树?

感谢您的帮助!

(有一个有点类似的问题 P1010 MAC to Switch port direct connection without PHY 但我无法评论它,不幸的是没有答案)

最佳答案

当没有 &phy0 时,您可以将其写为固定链接,而不是指定 &phy0

固定链接 = <0 1 1000 0 0>;

其中 0 是仿真 PHY ID,1-> 全双工,速度为 1000 Mb/s。您还希望禁用交换机端口 6 所连接的处理器端口的自动协商。

ps7_ethernet_0: ps7-ethernet@e000b000 {
#address-cells = <1>;
#size-cells = <0>;
clock-names = "ref_clk", "aper_clk";
clocks = <&clkc 13>, <&clkc 30>;
compatible = "xlnx,ps7-ethernet-1.00.a";
interrupt-parent = <&ps7_scugic_0>;
interrupts = <0 22 4>;
local-mac-address = [00 0a 35 00 00 00];
fixed-link = <0 1 1000 0 0>;
phy-mode = "gmii";
reg = <0xe000b000 0x1000>;
xlnx,ptp-enet-clock = <0x69f6bcb>;
xlnx,enet-reset = "";
xlnx,eth-mode = <0x0>;
xlnx,has-mdio = <0x1>;
mdio_0: mdio {
#address-cells = <1>;
#size-cells = <0>;
} ;

};

dsa@0 {
compatible = "marvell,dsa";

#address-cells = <2>;
#size-cells = <0>;

interrupts = <10>;

dsa,ethernet = <&ps7_ethernet_0>;
dsa,mii-bus = <&mdio_0>;

switch@0 {
#address-cells = <1>;
#size-cells = <0>;
reg = <22 0>;
port@3 {
reg = <3>;
label = "lan0";
};
port@4 {
reg = <4>;
label = "lan1";
};
port@5 {
reg = <5>;
label = "lan2";
};
port@6 {
reg = <6>;
label = "cpu";
};
};
};

};

我假设交换芯片 SMI 地址是 0x16;如果不是,请将 reg = <22,0> 设置为 <0,0>,就像之前在 switch@0 下一样。此外,您可能需要添加 mdio 驱动程序注册地址和兼容属性,这些在您的设备树中未指定。

关于linux - 用于与 DSA 交换机的无 PHY 连接的设备树,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31046172/

41 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com