ramips: c5/k2p: switch to new hnat driver

This commit is contained in:
AmadeusGhost 2022-05-30 19:06:18 +08:00 committed by AmadeusGhost
parent 58accb6699
commit b31fe9b0f6
3 changed files with 39 additions and 20 deletions

View File

@ -101,19 +101,30 @@
};
};
&ethernet {
compatible = "mediatek,ralink-mt7621-eth";
mediatek,switch = <&gsw>;
&gmac0 {
mtd-mac-address = <&factory 0xe000>;
};
&switch0 {
/delete-property/ compatible;
phy-mode = "rgmii";
&gmac1 {
mtd-mac-address = <&factory 0xe006>;
status = "okay";
};
&gsw {
compatible = "mediatek,ralink-mt7621-gsw";
mediatek,portmap = "llllw";
status = "okay";
};
&hnat {
mtketh-wan = "eth1";
mtketh-ppd = "eth0";
mtketh-lan = "eth0";
mtketh-max-gmac = <2>;
/delete-property/ mtkdsa-wan-port;
};
&switch0 {
status = "disabled";
};
&state_default {

View File

@ -12,7 +12,7 @@
led-failsafe = &led_sys;
led-running = &led_sys;
led-upgrade = &led_sys;
label-mac-device = &ethernet;
label-mac-device = &gmac0;
};
leds {
@ -84,19 +84,31 @@
status = "okay";
};
&ethernet {
compatible = "mediatek,ralink-mt7621-eth";
mediatek,switch = <&gsw>;
&gmac0 {
mtd-mac-address = <&factory 0x4>;
};
&switch0 {
/delete-property/ compatible;
phy-mode = "rgmii";
&gmac1 {
mtd-mac-address = <&factory 0x4>;
mtd-mac-address-increment = <1>;
status = "okay";
};
&gsw {
compatible = "mediatek,ralink-mt7621-gsw";
mediatek,portmap = "llllw";
status = "okay";
};
&hnat {
mtketh-wan = "eth1";
mtketh-ppd = "eth0";
mtketh-lan = "eth0";
mtketh-max-gmac = <2>;
/delete-property/ mtkdsa-wan-port;
};
&switch0 {
status = "disabled";
};
&state_default {

View File

@ -78,7 +78,7 @@ ramips_setup_interfaces()
phicomm,k2p|\
xiaoyu,xy-c5)
ucidef_add_switch "switch0" \
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0"
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6u@eth0" "5u@eth1"
;;
raisecom,msg1500-x-00)
ucidef_add_switch "switch0" \
@ -143,7 +143,6 @@ ramips_setup_macs()
lan_mac=$wan_mac
;;
d-team,newifi-d2|\
phicomm,k2p|\
xiaomi,mi-router-ac2100|\
xiaomi,redmi-router-ac2100)
lan_mac=$(cat /sys/class/net/eth0/address)
@ -214,9 +213,6 @@ ramips_setup_macs()
lan_mac=$(macaddr_add "$wan_mac" -3)
label_mac=$lan_mac
;;
xiaoyu,xy-c5)
wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1)
;;
esac
[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac