From b31fe9b0f6f534f95b5ee2f728c35a871fe65404 Mon Sep 17 00:00:00 2001 From: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com> Date: Mon, 30 May 2022 19:06:18 +0800 Subject: [PATCH] ramips: c5/k2p: switch to new hnat driver --- .../linux/ramips/dts/mt7621_phicomm_k2p.dts | 25 ++++++++++++----- .../linux/ramips/dts/mt7621_xiaoyu_xy-c5.dts | 28 +++++++++++++------ .../mt7621/base-files/etc/board.d/02_network | 6 +--- 3 files changed, 39 insertions(+), 20 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_phicomm_k2p.dts b/target/linux/ramips/dts/mt7621_phicomm_k2p.dts index 5c5e94556..ad64ee5d5 100644 --- a/target/linux/ramips/dts/mt7621_phicomm_k2p.dts +++ b/target/linux/ramips/dts/mt7621_phicomm_k2p.dts @@ -101,19 +101,30 @@ }; }; -ðernet { - 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 { diff --git a/target/linux/ramips/dts/mt7621_xiaoyu_xy-c5.dts b/target/linux/ramips/dts/mt7621_xiaoyu_xy-c5.dts index cfb9a7c10..57e6cc42a 100644 --- a/target/linux/ramips/dts/mt7621_xiaoyu_xy-c5.dts +++ b/target/linux/ramips/dts/mt7621_xiaoyu_xy-c5.dts @@ -12,7 +12,7 @@ led-failsafe = &led_sys; led-running = &led_sys; led-upgrade = &led_sys; - label-mac-device = ðernet; + label-mac-device = &gmac0; }; leds { @@ -84,19 +84,31 @@ status = "okay"; }; -ðernet { - 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 { diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index ab33cf795..2050c080c 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -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