1. 概述
交换机设备树主要是要配置它的端口数量,每个Port 的物理模式(例如Mac to Phy )、双工模式、连接速度、地址和与之连接的PHY 地址等等,这一节就以88EA6321 做例子解析一下DSA 设备树,以主控S32G274A 为例。
2. 参考文档
Linux5.10 中,有Marvell 的交换机系列的设备树配置参考手册,具体如下:
- 源码地址:
/linux/Documentation/devicetree/bindings/net/dsa/marvell.txt
3.设备树配置
3.1 Marvell 交换机引脚Pinctrl配置
&pinctrl0 {
/* 复位引脚 */
pinctrl_mv88exxx_gpio_reset: mv88exxx_reset {
fsl,pins = <
S32_GEN1_PAD_PC_11_LLCE_CAN0_RX_O
S32_GEN1_PAD_PC_12_LLCE_CAN0_TX
>;
};
/* 中断引脚 */
pinctrl_switch_mv88exxx_irq: mv88exxx_irq {
fsl,pins = <
S32_GEN1_PAD_PC_11_LLCE_CAN0_RX_O
S32_GEN1_PAD_PC_12_LLCE_CAN0_TX
>;
};
};
3.2 添加交换机复位引脚
在前几章硬件篇中总结到,Marvell 交换机有一个复位引脚,主要是用来主动复位交换机的,具体配置方法如下:
/ {
gpio-marverll{
compatible = "marvell_gpio,mv88e6321";
reset {
label = "marvell-reset";
gpios = <&gpiosb 21 GPIO_ACTIVE_LOW>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_mv88exxx_gpio_reset>;
status = "okay";
};
};
};
3.3 S32G274A GMAC配置
对于GMAC 或者MAC 来说,配置方法都大同小异,因为交换机与S32G274A 是以MAC TO MAC 的方式连接,所以要修改原设备书中的MAC TO PHY 为MAC TO MAC ;其次,由于使用的是RGMII 的方式连接,应当设置tx-delay 和rx-delay 为2ns ,具体如下:
&gmac0 {
status = "okay";
phy-mode = "rgmii-id";
phy-handle = <&switch_cpu>;
tx_delay=<0x2f>;
rx_delay=<0x24>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl0_gmac0_rgmii_c>,
<&pinctrl0_gmac0_mdio_c>;
};
3.4 配置Marvell交换机Port口配置
Marvell 88EA6321 是采用SMI 通信配置的,所以首先需要给它配置一个PHY ID ,其次再给它的每个Port MAC 配置PHY ID 和Port MAC 的连接方式 ,具体如下:
&gmac0_mdio {
marvell88ea6321:mv88ea6321-phy@5{
compatible = "marvell,mv88e6085";
pinctrl-0 = <&pinctrl_switch_mv88exxx_irq>;
pinctrl-names = "default";
status = "okay";
reg = <5>;
dsa,member = <0 0>;
eeprom-length = <512>;
interrupt-parent = <&gic>;
interrupts = <15 IRQ_TYPE_LEVEL_LOW>;
interrupt-controller;
#interrupt-cells = <2>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <1>;
label = "lan0";
phy-handle = <&switchphy0>;
};
port@1 {
reg = <2>;
label = "lan1";
phy-handle = <&switchphy1>;
};
port@2 {
reg = <3>;
label = "lan2";
phy-handle = <&switchphy5>;
};
port@3 {
reg = <4>;
label = "lan3";
phy-handle = <&switchphy3>;
};
port@4 {
reg = <5>;
label = "lan4";
phy-handle = <&switchphy4>;
};
switch_cpu: port@5 {
reg = <6>;
label = "cpu";
phy-mode = "rgmii";
ethernet = <&gmac0>;
fixed-link {
speed = <1000>;
full-duplex;
};
};
port@6 {
reg = <7>;
label = "lan6";
phy-handle = <&switchphy6>;
};
};
mdio {
#address-cells = <1>;
#size-cells = <0>;
switchphy0: switchphy@0 {
reg = <1>;
interrupt-parent = <&marvell88ea6321>;
interrupts = <0 IRQ_TYPE_LEVEL_HIGH>;
};
switchphy1: switchphy@1 {
reg = <2>;
interrupt-parent = <&marvell88ea6321>;
interrupts = <1 IRQ_TYPE_LEVEL_HIGH>;
};
switchphy2: switchphy@2 {
reg = <3>;
interrupt-parent = <&marvell88ea6321>;
interrupts = <2 IRQ_TYPE_LEVEL_HIGH>;
};
switchphy3: switchphy@3 {
reg = <4>;
interrupt-parent = <&marvell88ea6321>;
interrupts = <3 IRQ_TYPE_LEVEL_HIGH>;
};
switchphy4: switchphy@4 {
reg = <5>;
interrupt-parent = <&marvell88ea6321>;
interrupts = <4 IRQ_TYPE_LEVEL_HIGH>;
};
switchphy5: switchphy@5 {
reg = <6>;
interrupt-parent = <&marvell88ea6321>;
interrupts = <5 IRQ_TYPE_LEVEL_HIGH>;
};
switchphy6: switchphy@6 {
reg = <7>;
interrupt-parent = <&marvell88ea6321>;
interrupts = <6 IRQ_TYPE_LEVEL_HIGH>;
};
};
};
返回总目录
|