ETH接口调测参考
本章节以其中一个不同于Atlas 200I DK A2 开发者套件、Atlas 500 A2 智能小站的用户底板设计为例,根据底板的设计来配置对应ETH接口的userBaseConfig文件和DTB文件。
前提条件
已获取设备boardid,本章节以33150为例。具体请参见用户必读。
用户底板的adc_board_id为33,Atlas 200I A2 加速模块的算力为20T(adc_board_id为150),用户整机(Atlas 200I A2 加速模块+底板)boardid为33150(对应十六进制817e)。
修改和编译userBaseConfig和DTB文件
本操作以首次调测接口为例介绍。
- 登录准备环境所搭建Linux服务器。
- 执行如下命令,切换至root用户。
su - root
- 使用WinSCP工具,将下载软件包获取的源码包“Ascend310B-source.tar.gz”上传至root用户属组目录下,例如“/opt”。详细操作请参见使用WinSCP传输文件。
- 执行如下命令,进入源码包所在目录“/opt”。
cd /opt
- 执行如下命令,解压源码包“Ascend310B-source.tar.gz”。
tar -xzvf Ascend310B-source.tar.gz
- 执行如下命令,进入“Ascend310B-source”目录。
cd Ascend310B-source
- 修改“user_base_config.xml”配置文件。
- 执行如下命令,打开“user_base_config.xml”文件。
- 在“user_base_config.xml”中配置用户整机对应的board_id、chip0_strategy、max_power和serdes_info。具体参数含义请参见表1和表2。
<item name="product_strategy_info"><!--产品板策略ID--> <!--33150 对应十六进制817e--> <param board_id ="817e" phy_num = "1" chip0_strategy="0" max_power="0" equal="0"/> </item> <item name="evb_strategy_info"> </item> <item name="strategy_info_array"><!--启动策略矩阵--> <subitem subname="sub_strategy0"> <module class="serdes"> <submodule subclass="serdes_info"> <param lan_index="0" serdes_type="PCIE" ssc_enable="0" polarity_tx = "0" polarity_rx = "0" lan_order = "0" bandwidth="2" align_mode="0" frequency="PCIE_GEN2" port_index = "0"/> <param lan_index="1" serdes_type="PCIE" ssc_enable="0" polarity_tx = "0" polarity_rx = "0" lan_order = "0" bandwidth="ff" align_mode="0" frequency="PCIE_GEN2" port_index = "0"/> <param lan_index="2" serdes_type="SATA" ssc_enable="1" polarity_tx = "0" polarity_rx = "0" lan_order = "0" bandwidth="ff" align_mode="0" frequency="SATA3.0" port_index = "0"/> <param lan_index="3" serdes_type="PCIE" ssc_enable="0" polarity_tx = "0" polarity_rx = "0" lan_order = "0" bandwidth="1" align_mode="0" frequency="PCIE_GEN2" port_index = "0"/> <param lan_index="4" serdes_type="ETH" ssc_enable="0" polarity_tx = "0" polarity_rx = "0" lan_order = "1" bandwidth="ff" align_mode="0" frequency="1GE" port_index = "0"/> <param lan_index="5" serdes_type="ETH" ssc_enable="0" polarity_tx = "0" polarity_rx = "0" lan_order = "1" bandwidth="ff" align_mode="0" frequency="1GE" port_index = "0"/> <param lan_index="6" serdes_type="USB" ssc_enable="0" polarity_tx = "0" polarity_rx = "0" lan_order = "0" bandwidth="ff" align_mode="0" frequency="USB3.0" port_index = "0"/> <param lan_index="7" serdes_type="USB" ssc_enable="0" polarity_tx = "0" polarity_rx = "0" lan_order = "0" bandwidth="ff" align_mode="0" frequency="USB3.0" port_index = "0"/> </submodule> </module>
- 第一处加粗字体修改为用户产品的实际boardid以及算力等级,各参数含义如下。
- 第二处加粗字体修改为用户产品的实际SerDes配置,具体规则如下。
- PCIe控制器0(lane0~lane1)支持RC/EP模式,其他PCIe控制器只支持RC模式。
- Macro0(lane0~lane3)中若存在PCIe和其他协议(SATA)共存,则PCIe只能支持到PCIE_GEN2;若只存在PCIe协议,则PCIe支持到PCIE_GEN3。
- PCIe支持降lane应用,如PCIe x4降lane到PCIe x2/x1。
- Macro0(lane0~lane3)支持PCIE和SATA协议,Macro1(lane4~lane7)支持PCIe、USB、GE协议,每个Macro同时最多只能配置两种协议。
- SATA只能在Macro0(lane0~lane3)使用。
- USB控制器0(lane4)只支持HOST,USB控制器1~USB控制器3(lane5~lane7)支持HOST+DEVICE。
- USB只能在Macro1(lane4~lane7)使用。
- 若为系统直出的USB 2.0,则无需配置SerDes。
各参数含义如下。
表2 参数说明 param
配置值
说明
lan_index
0~7。
lane编号,Atlas 200I A2 加速模块一共有8条serdes lane。
serdes_type
Atlas 200I A2 加速模块支持PCIE、SATA、USB、ETH。
该条lane使用的协议。
ssc_enable
- 0:否。
- 1:是。
是否开展频,只有用作PCIe和SATA时才能打开。
polarity_tx
- 0:否。
- 1:是。
tx极性是否翻转。
polarity_rx
- 0:否。
- 1:是。
rx极性是否翻转。
lan_order
- 0:否。
- 1:是。
lane序是否反转。
bandwidth
- 1表示x1。
- 2表示x2。
- 4表示x4。
- ff表示不配置。
用作PCIe时,表示位宽x4/x2/x1,其他协议不使用。
- x4:使用四条lane。
- x2:使用两条lane。
- x1:使用一条lane。
align_mode
0。
该lane是master还是slave,Atlas 200I A2 加速模块不使用该参数。
frequency
- PCIE_GEN2。
- PCIE_GEN3。
- 1GE。
- 2.5GE。
- USB3.0
- SATA3.0
使用的频点,主要用来区分PCIE GEN2/3,和ETH的1GE/2.5GE。
port_index
0~n。
用作ETH时,表示lane的网口端口号,其他协议不使用。
弹性配置中的SerDes复用关系参数必须与实际硬件单板保持一致,SerDes错误配置可能导致启动挂死,功能不可用。
根据表3中用户产品的实际serdes配置,为使能ETH功能,user_base_config.xml文件中serdes_info配置的示例如下。
表3 SerDes接口复用关系 lan编号
协议
是否开展频
tx极性是否翻转
rx极性是否翻转
lane序是否反转
位宽
频点
lane0
PCIE
否
否
否
否
x2
PCIE_GEN2
lane1
PCIE
否
否
否
否
不配置a
PCIE_GEN2
lane2
SATA
是
否
否
否
不配置
SATA3.0
lane3
PCIE
否
否
否
否
x1
PCIE_GEN2
lane4
ETH
否
否
否
是
不配置
1GE
lane5
ETH
否
否
否
是
不配置
1GE
lane6
USB
否
否
否
否
不配置
USB3.0
lane7
USB
否
否
否
否
不配置
USB3.0
a:lane0的PCIe位宽为x2,需要使用两条lane,所以lane1不设置位宽。
user_base_config.xml文件中serdes_info配置如下。
<submodule subclass="serdes_info"> <param lan_index="0" serdes_type="PCIE" ssc_enable="0" polarity_tx = "0" polarity_rx = "0" lan_order = "0" bandwidth="2" align_mode="0" frequency="PCIE_GEN2" port_index = "0"/> <param lan_index="1" serdes_type="PCIE" ssc_enable="0" polarity_tx = "0" polarity_rx = "0" lan_order = "0" bandwidth="ff" align_mode="0" frequency="PCIE_GEN2" port_index = "0"/> <param lan_index="2" serdes_type="SATA" ssc_enable="1" polarity_tx = "0" polarity_rx = "0" lan_order = "0" bandwidth="ff" align_mode="0" frequency="SATA3.0" port_index = "0"/> <param lan_index="3" serdes_type="PCIE" ssc_enable="0" polarity_tx = "0" polarity_rx = "0" lan_order = "0" bandwidth="1" align_mode="0" frequency="PCIE_GEN2" port_index = "0"/> <param lan_index="4" serdes_type="ETH" ssc_enable="0" polarity_tx = "0" polarity_rx = "0" lan_order = "1" bandwidth="ff" align_mode="0" frequency="1GE" port_index = "0"/> <param lan_index="5" serdes_type="ETH" ssc_enable="0" polarity_tx = "0" polarity_rx = "0" lan_order = "1" bandwidth="ff" align_mode="0" frequency="1GE" port_index = "0"/> <param lan_index="6" serdes_type="USB" ssc_enable="0" polarity_tx = "0" polarity_rx = "0" lan_order = "0" bandwidth="ff" align_mode="0" frequency="USB3.0" port_index = "0"/> <param lan_index="7" serdes_type="USB" ssc_enable="0" polarity_tx = "0" polarity_rx = "0" lan_order = "0" bandwidth="ff" align_mode="0" frequency="USB3.0" port_index = "0"/> </submodule>
位宽只能配置为x4/x2/x1。
- 配置完成后,按“Esc”键,再执行:wq!保存修改,并按“Enter”键退出。
- 编译userBaseConfig文件。
- 执行如下命令,返回“Ascend310B-source”目录。
cd /opt/Ascend310B-source
- 执行如下命令,编译userBaseConfig文件。
出现如下回显,表示编译内核userBaseConfig文件成功。
generate /opt/Ascend310B-source/output/userBaseConfig.bin success! sign /opt/Ascend310B-source/output/userBaseConfig.bin success!
编译后的“userBaseConfig.bin”文件会自动存放于“Ascend310B-source/output”目录下。
- 执行如下命令,返回“Ascend310B-source”目录。
- 新增并修改整机dts文件。
用户整机的boardid为33150,故dts文件名称为“hi1910B-asic-M150-B33.dts”。具体请参见DTB文件。
- 执行如下命令,新增适配boardid33150的dts文件。
cp hi1910B-asic-M150-B50.dts hi1910B-asic-M150-B33.dts
将“hi1910B-asic-M150-B50.dts”另存为boardid33150的dts文件“hi1910B-asic-M150-B33.dts”。
- 执行以下命令修改dts文件,配置用户产品的实际整机boardid,确认所使用的PCIe的.dtsi文件和ETH的.dtsi文件及路径,具体内容如下加粗字体所示。
compatible = "hisilicon,hi1910B-evb", "hisilicon,ascend610"; hisi,boardid = <0x0 0x3 0x3 0x1 0x5 0x0>; //修改为实际整机boardid #address-cells = <0x2>; #size-cells = <0x2>; interrupt-parent = <0x1>; model = "Hisilicon PhosphorHi1910B evb"; /include/ "base/hi1910B-asic-kernel-rc.dtsi" /include/ "base/hi1910B-commmon-smmu.dtsi" /include/ "base/hi1910B-mpam.dtsi" /include/ "base/hi1910B-lp-pm.dtsi" /include/ "base/hi1910B-lp-devmng.dtsi" /include/ "base/hi1910B-mbigen-ao.dtsi" /include/ "base/hi1910B-gpio.dtsi" /include/ "base/hi1910B-ipcdrv.dtsi" /include/ "base/hi1910B-ts-drv.dtsi" /include/ "base/hi1910B-tsdrv.dtsi" /include/ "base/hi1910B-network-M150-B50.dtsi" //确认所使用的ETH的.dtsi文件及路径 /include/ "base/hi1910B-hidvpp.dtsi" /include/ "base/hi1910B-hdmi.dtsi" /include/ "product/hi1910B-audio.dtsi" /include/ "base/hi1910B-mipitx.dtsi" /include/ "base/hi1910B-vdp.dtsi" /include/ "base/hi1910B-isp.dtsi" /include/ "base/hi1910B-hilink.dtsi" /include/ "base/hi1910B-mntn-milanr3.dtsi" /include/ "base/hi1910B-gpu.dtsi" /include/ "base/hi1910B-ctl.dtsi" /include/ "base/hi1910B-itrustee.dtsi" /include/ "base/hi1910B-sata.dtsi" /include/ "product/hi1910B-pcie-rc-M150-B50.dtsi" //确认所使用的PCIe的.dtsi文件及路径 /include/ "product/hi1910B-mdio-M150-B50.dtsi" /include/ "product/hi1910B-pinctrl-M150-B50.dtsi" /include/ "product/hi1910B-can-M150-B50.dtsi" /include/ "product/hi1910B-hiusbc-B50.dtsi" /include/ "product/hi1910B-emmc-M150-B50.dtsi" /include/ "product/hi1910B-i2c-M150-B50.dtsi" /include/ "product/hi1910B-spi-M150-B50.dtsi"
- 配置完成后,按“Esc”键,再执行:wq!保存修改,并按“Enter”键退出。
- 执行如下命令,新增适配boardid33150的dts文件。
- 修改PCIe的.dtsi文件,配置PCIe控制器。
- 执行如下命令进入“product”目录,并修改PCIe的.dtsi文件。
vim hi1910B-pcie-rc-M150-B50.dtsi
根据7.c中配置的serdes_info选择需要开放的PCIe控制器,lan_index与PCIe控制器的对应关系如下。lan_index
控制器
lane0~lane1
PCIe控制器0
lane2~lane3
PCIe控制器1
lane4~lane5
PCIe控制器2
lane6~lane7
PCIe控制器3
以7.c中serdes_info配置为例,共使用了PCIe控制器0、PCIe控制器1,则在PCIe的.dtsi文件中保留PCIe控制器0、PCIe控制器1两个控制器的配置,将PCIe控制器2、PCIe控制器3的配置代码注释即可,其中/*和*/代表注释代码段,具体修改如下所示。
pcie@0x820000000 { compatible = "pci-host-ecam-generic"; // ECAM 0x820000000 pci host bridge0 // reg = <0x8 0x20000000 0 0x00400000>; reg-names = "ecam-cfg"; bus-range = <0x0 0x3>; msi-map = <0x0 &its 0x0 0x2000>; msi-map-mask = <0xffff>; #address-cells = <3>; #size-cells = <2>; device_type = "pci"; dma-coherent; // BAR MAP: 32bit mem 64M, 64bit mem 256M // ranges = <0x02000000 0x0 0xB0000000 0x0 0xB0000000 0x0 0x04000000 0x43000000 0x8 0x30000000 0x8 0x30000000 0x0 0x10000000>; #interrupt-cells = <1>; interrupt-map-mask = <0xf800 0 0 0x7>; // INTX // interrupt-map = <0x4000 0 0 1 &mbigen_pcie0_local 704 4 0x4000 0 0 2 &mbigen_pcie0_local 705 4 0x4000 0 0 3 &mbigen_pcie0_local 706 4 0x4000 0 0 4 &mbigen_pcie0_local 707 4>; iommu-map = <0 &io_smmu 0 0x400>; status = "ok"; }; pcie@0x840000000 { compatible = "pci-host-ecam-generic"; pcie-core-id = <1>; // ECAM 0x840000000 pci host bridge0 reg = <0x8 0x40400000 0 0x00400000>; reg-names = "ecam-cfg"; bus-range = <0x4 0x7>; msi-map = <0x400 &its 0x400 0x2000>; msi-map-mask = <0xffff>; #address-cells = <3>; #size-cells = <2>; device_type = "pci"; dma-coherent; // BAR MAP: 32bit mem 64M, 64bit mem 256M ranges = <0x02000000 0x0 0xB4000000 0x0 0xB4000000 0x0 0x04000000 0x43000000 0x8 0x50000000 0x8 0x50000000 0x0 0x10000000>; #interrupt-cells = <1>; interrupt-map-mask = <0xff0000 0 0 0x7>; // INTX interrupt-map = <0x40000 0 0 1 &mbigen_pcie1_local 712 4 0x40000 0 0 1 &mbigen_pcie1_local 713 4 0x40000 0 0 1 &mbigen_pcie1_local 714 4 0x40000 0 0 1 &mbigen_pcie1_local 715 4>; iommu-map = <0x400 &io_smmu 0x400 0x400>; status = "ok"; }; /* pcie@0x860000000 { compatible = "pci-host-ecam-generic"; // ECAM 0x860000000 pci host bridge0 // reg = <0x8 0x60800000 0 0x00400000>; reg-names = "ecam-cfg"; bus-range = <0x8 0xb>; msi-map = <0x800 &its 0x800 0x2000>; msi-map-mask = <0xffff>; #address-cells = <3>; #size-cells = <2>; device_type = "pci"; dma-coherent; // BAR MAP: 32bit mem 64M, 64bit mem 256M // ranges = <0x02000000 0x0 0xB8000000 0x0 0xB8000000 0x0 0x04000000 0x43000000 0x8 0x70000000 0x8 0x70000000 0x0 0x10000000>; #interrupt-cells = <1>; interrupt-map-mask = <0xf800 0 0 0x7>; // INTX // interrupt-map = <0x4000 0 0 1 &mbigen_pcie2_local 720 4 0x4000 0 0 2 &mbigen_pcie2_local 721 4 0x4000 0 0 3 &mbigen_pcie2_local 722 4 0x4000 0 0 4 &mbigen_pcie2_local 723 4>; iommu-map = <0x800 &io_smmu 0x800 0x400>; status = "ok"; }; */ /* pcie@0x900000000 { compatible = "pci-host-ecam-generic"; pcie-core-id = <3>; // ECAM 0x900000000 pci host bridge0 reg = <0x9 0x00c00000 0 0x00400000>; reg-names = "ecam-cfg"; bus-range = <0xc 0xf>; msi-map = <0xc00 &its 0xc00 0x2000>; msi-map-mask = <0xffff>; #address-cells = <3>; #size-cells = <2>; device_type = "pci"; dma-coherent; // BAR MAP: 32bit mem 64M, 64bit mem 256M ranges = <0x02000000 0x0 0xBC000000 0x0 0xBC000000 0x0 0x04000000 0x43000000 0x9 0x10000000 0x9 0x10000000 0x0 0x10000000>; #interrupt-cells = <1>; interrupt-map-mask = <0xff0000 0 0 0x7>; // INTX interrupt-map = <0xc0000 0 0 1 &mbigen_pcie3_local 728 4 0xc0000 0 0 1 &mbigen_pcie3_local 729 4 0xc0000 0 0 1 &mbigen_pcie3_local 730 4 0xc0000 0 0 1 &mbigen_pcie3_local 731 4>; iommu-map = <0xc00 &io_smmu 0xc00 0x400>; status = "ok"; }; */
- 若配置PCIe位宽为x4,例如lane0配置为x4,则只需要配置PCIe0控制器即可,无需配置PCIe1控制器。
- /*和*/代表注释代码段,注释成功后,部分软件可能不显示注释格式,如MobaXterm,但不影响注释结果。
- 配置完成后按“Esc”键,再执行:wq!命令保存修改,并按“Enter”键退出。
- 执行如下命令进入“product”目录,并修改PCIe的.dtsi文件。
- 修改ETH的.dtsi文件。
- 执行如下命令进入“base”目录,并修改ETH的.dtsi文件。
cd base
vim hi1910B-network-M150-B50.dtsi
此处以上述产品的配置为例。
eth0:xge0@a7100000 { compatible = "hisilicon,hns3-platform-device"; id = <0>; reg = <0x0 0xa7100000 0x0 0x10000>, <0x0 0xa7000000 0x0 0x800000>, <0x0 0xa0120000 0x0 0x10000>, <0x0 0xa0180000 0x0 0x10000>, <0x0 0xa0160000 0x0 0x10000>, <0x0 0xa0150000 0x0 0x10000>, <0x0 0xa0140000 0x0 0x10000>; reg-names = "network_base"; //249 +#253 - 32 = 0xdd interrupts = < 0x0 0xd9 0x1 0x0 0xda 0x1 0x0 0xdb 0x1 0x0 0xdc 0x1 0x0 0xdd 0x1 0x0 0xde 0x1 0x0 0xdf 0x1 0x0 0xe0 0x1 0x0 0xe1 0x1 0x0 0xe2 0x1 0x0 0xe3 0x1 0x0 0xe4 0x1 0x0 0xe5 0x1 0x0 0xe6 0x1 0x0 0xe7 0x1 0x0 0xe8 0x1 0x0 0xe9 0x4 0x0 0xed 0x4 0x0 0xd1 0x4>; status = "ok"; tc_num = <4>; queue_num = <4>; gpio_index = <6>; phy_addr = <2>; phy_mode = <1>; // 0:sgmii 1:rgmii 2:sfp port_speed = <1000>; // 10: 10M, 100: 100M, 1000: 1G; 2500: 2.5G(only phy_mode sfp support) ds_index = <2>; phy_gpio_index = <12>; }; eth1:xge1@a7200000 { compatible = "hisilicon,hns3-platform-device"; id = <1>; reg = <0x0 0xa7200000 0x0 0x10000>, <0x0 0xa7000000 0x0 0x800000>, <0x0 0xa0120000 0x0 0x10000>, <0x0 0xa0190000 0x0 0x10000>, <0x0 0xa0160000 0x0 0x10000>, <0x0 0xa0150000 0x0 0x10000>, <0x0 0xa0140000 0x0 0x10000>; reg-names = "network_base"; //249 +#253 - 32 = 0xdd interrupts = < 0x0 0xd9 0x1 0x0 0xda 0x1 0x0 0xdb 0x1 0x0 0xdc 0x1 0x0 0xdd 0x1 0x0 0xde 0x1 0x0 0xdf 0x1 0x0 0xe0 0x1 0x0 0xe1 0x1 0x0 0xe2 0x1 0x0 0xe3 0x1 0x0 0xe4 0x1 0x0 0xe5 0x1 0x0 0xe6 0x1 0x0 0xe7 0x1 0x0 0xe8 0x1 0x0 0xea 0x4 0x0 0xee 0x4 0x0 0xd2 0x4>; status = "ok"; tc_num = <4>; queue_num = <4>; gpio_index = <9>; phy_addr = <2>; phy_mode = <1>; // 0:sgmii 1:rgmii 2:sfp port_speed = <1000>; // 10: 10M, 100: 100M, 1000: 1G; 2500: 2.5G(only phy_mode sfp support) ds_index = <3>; phy_gpio_index = <25>; }; xge2@a7300000 { compatible = "hisilicon,hns3-platform-device"; id = <2>; reg = <0x0 0xa7300000 0x0 0x10000>, <0x0 0xa7000000 0x0 0x800000>, <0x0 0xa0120000 0x0 0x10000>, <0x0 0xa0180000 0x0 0x10000>, <0x0 0xa0160000 0x0 0x10000>, <0x0 0xa0150000 0x0 0x10000>, <0x0 0xa0140000 0x0 0x10000>; reg-names = "network_base"; //249 +#253 - 32 = 0xdd interrupts = < 0x0 0xd9 0x1 0x0 0xda 0x1 0x0 0xdb 0x1 0x0 0xdc 0x1 0x0 0xdd 0x1 0x0 0xde 0x1 0x0 0xdf 0x1 0x0 0xe0 0x1 0x0 0xe1 0x1 0x0 0xe2 0x1 0x0 0xe3 0x1 0x0 0xe4 0x1 0x0 0xe5 0x1 0x0 0xe6 0x1 0x0 0xe7 0x1 0x0 0xe8 0x1 0x0 0xeb 0x4 0x0 0xef 0x4 0x0 0xd3 0x4>; status = "ok"; tc_num = <4>; queue_num = <4>; gpio_index = <6>; phy_addr = <4>; phy_mode = <0>; // 0:sgmii 1:rgmii 2:sfp port_speed = <1000>; // 10: 10M, 100: 100M, 1000: 1G; 2500: 2.5G(only phy_mode sfp support) ds_index = <0>; phy_gpio_index = <12>; }; xge3@a7400000 { compatible = "hisilicon,hns3-platform-device"; id = <3>; reg = <0x0 0xa7400000 0x0 0x10000>, <0x0 0xa7000000 0x0 0x800000>, <0x0 0xa0120000 0x0 0x10000>, <0x0 0xa0190000 0x0 0x10000>, <0x0 0xa0160000 0x0 0x10000>, <0x0 0xa0150000 0x0 0x10000>, <0x0 0xa0140000 0x0 0x10000>; reg-names = "network_base"; //249 +#253 - 32 = 0xdd interrupts = < 0x0 0xd9 0x1 0x0 0xda 0x1 0x0 0xdb 0x1 0x0 0xdc 0x1 0x0 0xdd 0x1 0x0 0xde 0x1 0x0 0xdf 0x1 0x0 0xe0 0x1 0x0 0xe1 0x1 0x0 0xe2 0x1 0x0 0xe3 0x1 0x0 0xe4 0x1 0x0 0xe5 0x1 0x0 0xe6 0x1 0x0 0xe7 0x1 0x0 0xe8 0x1 0x0 0xec 0x4 0x0 0xf0 0x4 0x0 0xd4 0x4>; status = "ok"; tc_num = <4>; queue_num = <4>; gpio_index = <9>; phy_addr = <4>; phy_mode = <0>; // 0:sgmii 1:rgmii 2:sfp port_speed = <1000>; // 10: 10M, 100: 100M, 1000: 1G; 2500: 2.5G(only phy_mode sfp support) ds_index = <1>; phy_gpio_index = <12>; };
- phy_addr为底板设计的phy地址(PHYADD),例如ETH设计的phy的地址为1(PHYADD1),则phy_addr配置为1。
- phy_mode为底板设计时MAC和phy的连接通道,例如ETH使用rgmii作为MAC和phy的连接通道,则phy_mode配置为1。
使用sgmii作为MAC和phy的连接通道,则phy_mode配置为0,使用sfp作为MAC和phy的连接通道,则phy_mode配置为2。
- phy_gpio_index为底板设计时复位phy芯片的管脚,此ETH使用gpio6_25作为复位phy芯片的管脚,则phy_gpio_index配置为25。管脚复用关系请参见表2。
- Atlas 200I A2 加速模块提供了两个MDIO的控制器,寄存器基址分别为(MDIO0: 0xA0180000)和(MDIO1: 0xA0190000),用户应根据具体硬件配置选择。MDIO的信息请参考MDIO。
- 源码文件中默认未开放xge2、xge3编译,用户需要使用时需要将compatible参数修改为hisilicon,hns3-platform-device。
- tc_num参数负责划分流量等级使用,最多支持8个tc。
- queue_num为队列数,是硬件上的一种资源,最多支持16个,一个端口分配的队列数量不能少于tc_num数量。
- 按“Esc”键,再执行:wq!保存修改,并按“Enter”键退出。
- 执行如下命令进入“base”目录,并修改ETH的.dtsi文件。
- 将新增的整机dts文件添加到编译路径中。
- 执行如下命令,进入“dtbtool”目录。
- 执行如下命令,修改CMakelists文件,将所增加的dts文件添加到编译路径中,具体修改如下加粗字体所示。
set(DTS_BASE_DIR ${TOP_DIR}/tools/customize/dts) if(PRODUCT STREQUAL "ascend310Besl" OR PRODUCT STREQUAL "ascend310B" OR PRODUCT STREQUAL "ascend310Bemu" OR PRODUCT STREQUAL "ascend310Brc" OR PRODUCT STREQUAL "ascend310Brcesl" OR PRODUCT STREQUAL "ascend310Brcemu") # 当前driver跟esl用相同的dts,后期需要更新到单独的目录 set(DTS_SRC_DIR ${DTS_BASE_DIR}/hi1910b/hi1910BL) set(DTS_FILE_LIST hi1910B-default.dts unreleased/hi1911-esl/hi1911-esl-b600.dts unreleased/hi1911-esl/hi1911-esl-rc-b600.dts unreleased/hi1911-fpga/hi1911-fpga-b600_b0.dts unreleased/hi1911-fpga/hi1911-fpga-b600_b0_b1.dts unreleased/hi1911-fpga/hi1911-fpga-b600_b0_b2.dts unreleased/hi1911-fpga/hi1911-fpga-rc-b600_b0.dts unreleased/hi1911-fpga/hi1911-fpga-rc-b600_b0_b1.dts unreleased/hi1911-fpga/hi1911-fpga-rc-b600_b0_b2.dts hi1910B-evb-900.dts hi1910B-evb-901.dts hi1910B-evb-902.dts hi1910B-evb-903.dts hi1910B-evb-905.dts hi1910B-asic-M150-B50.dts hi1910B-asic-M100-B51.dts hi1910B-asic-M150-B51.dts hi1910B-asic-M160-B51.dts hi1910B-asic-M100-B00.dts hi1910B-asic-M101-B00.dts hi1910B-asic-M150-B00.dts hi1910B-asic-M151-B00.dts hi1910B-asic-M150-B33.dts)
新增加的dts只能在加粗字体段落末尾添加。
- 配置完成后,按“Esc”键,再执行:wq!保存修改,并按“Enter”键退出。
- 编译DTB文件。
生效userBaseConfig和DTB文件
- 准备网线,连接PC和Atlas 200I A2 加速模块底板网口,登录Atlas 200I A2 加速模块整机,具体操作请参见使用PuTTY登录设备(网口方式)。
- 执行如下命令,切换至root用户。
su - root
- 使用“WinSCP”,将编译后的“userBaseConfig.bin”和“dt.img”文件上传至任意目录下,例如“/run”。详细操作请参见使用WinSCP传输文件。
- 升级“userBaseConfig.bin”文件。
- 升级“dt.img”文件。具体请参见生效DTB文件。
- 升级完成后重启生效。
reboot
建议查看串口日志确认升级重启进展。
验证接口功能
此处以eth2为例。
- 准备串口线,连接PC和Atlas 200I A2 加速模块底板串口。
- 登录Atlas 200I A2 加速模块OS。详细信息请参见使用PuTTY登录设备(串口方式)。
- Atlas 200I A2 加速模块(使用非Atlas 200I DK A2 开发者套件底板)USB接口登录的默认IP为192.168.1.2,Atlas 200I DK A2 开发者套件USB接口登录的默认IP为192.168.0.2。
- 若Atlas 200I A2 加速模块上电后网络可以ping通,但无法通过SSH登录,请参见使用root用户SSH登录服务器出现Access Denied错误解决。
- 执行ifconfig命令配置eth2网口ip。
- 准备网线,连接PC和Atlas 200I A2 加速模块底板eth2网口。
- 通过网线登录Atlas 200I A2 加速模块,详细信息请参见使用PuTTY登录设备(网口方式)
正常登录。eth2接口通信正常。