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 { &gmac0 {
compatible = "mediatek,ralink-mt7621-eth";
mediatek,switch = <&gsw>;
mtd-mac-address = <&factory 0xe000>; mtd-mac-address = <&factory 0xe000>;
}; };
&switch0 { &gmac1 {
/delete-property/ compatible; mtd-mac-address = <&factory 0xe006>;
phy-mode = "rgmii"; status = "okay";
}; };
&gsw { &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 { &state_default {

View File

@ -12,7 +12,7 @@
led-failsafe = &led_sys; led-failsafe = &led_sys;
led-running = &led_sys; led-running = &led_sys;
led-upgrade = &led_sys; led-upgrade = &led_sys;
label-mac-device = &ethernet; label-mac-device = &gmac0;
}; };
leds { leds {
@ -84,19 +84,31 @@
status = "okay"; status = "okay";
}; };
&ethernet { &gmac0 {
compatible = "mediatek,ralink-mt7621-eth";
mediatek,switch = <&gsw>;
mtd-mac-address = <&factory 0x4>; mtd-mac-address = <&factory 0x4>;
}; };
&switch0 { &gmac1 {
/delete-property/ compatible; mtd-mac-address = <&factory 0x4>;
phy-mode = "rgmii"; mtd-mac-address-increment = <1>;
status = "okay";
}; };
&gsw { &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 { &state_default {

View File

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