MTK7621上自带的交换芯片为mt7530
admin@OpenWrt:~# /sbin/swconfig list
Found: switch0 - mt7530
交换芯片的配置工具为swconfig程序。MTK7621采用内部的MDIO(Management Data Input/Output)接口管理MT7530的switch芯片。
MT7530共有7个物理口,通过/sbin/swconfig dev switch0 show命令可以查看每个物理口的状态。其中第7个phy接口连接到MTK7621芯片的eth0网口,MTK7621通过MDIO进行寄存器读写配置使用,逻辑框图如下:
通过设备树查看MT7530交换芯片
linux内核源码相对路径
OpenWrt/mtk7621-19.07/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7621/linux-4.14.200
设备树文件路径
/OpenWrt/mtk7621-19.07$ ls target/linux/ramips/dts/ |grep 7621
AP-MT7621A-V60.dts
MT7621.dts
mt7621.dtsi
U7621-06-256M-16M.dts
U7621-06-256M-64M.dts
U7621-06-512M-64M.dts
U7621-06.dtsi
mt7621.dtsi 文件内容
文件名称: target/linux/ramips/dts/mt7621.dtsi
ethernet: ethernet@1e100000 {
compatible = "mediatek,mt7621-eth"; # 对应的驱动程序 soc_mt7621.c 文件中
reg = <0x1e100000 0x10000>;
#address-cells = <1>;
#size-cells = <1>;
resets = <&rstctrl 6 &rstctrl 23>;
reset-names = "fe", "eth";
interrupt-parent = <&gic>;
interrupts = <GIC_SHARED 3 IRQ_TYPE_LEVEL_HIGH>;
mediatek,switch = <&gsw>; #交换芯片 mt7530
mdio-bus {
#address-cells = <1>;
#size-cells = <0>;
phy1f: ethernet-phy@1f { # 内部 MDIO 总线描述
reg = <0x1f>;
phy-mode = "rgmii";
};
};
hnat: hnat@0 {
compatible = "mediatek,mt7623-hnat";
reg &