From 3fdc484aba350ace787e47477b7e1efa3826b54a Mon Sep 17 00:00:00 2001 From: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com> Date: Tue, 6 Oct 2020 22:40:31 +0800 Subject: [PATCH] ramips: XiaoYu-C5: reuse ralink-eth driver --- .../linux/ramips/dts/mt7621_xiaoyu_xy-c5.dts | 38 +++++-------------- .../mt7621/base-files/etc/board.d/02_network | 8 +++- 2 files changed, 15 insertions(+), 31 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_xiaoyu_xy-c5.dts b/target/linux/ramips/dts/mt7621_xiaoyu_xy-c5.dts index 5eacdfaaed..3563090031 100644 --- a/target/linux/ramips/dts/mt7621_xiaoyu_xy-c5.dts +++ b/target/linux/ramips/dts/mt7621_xiaoyu_xy-c5.dts @@ -14,7 +14,7 @@ led-failsafe = &led_sys; led-running = &led_sys; led-upgrade = &led_sys; - label-mac-device = &gmac0; + label-mac-device = ðernet; }; leds { @@ -86,39 +86,19 @@ status = "okay"; }; -&gmac0 { +ðernet { + compatible = "mediatek,ralink-mt7621-eth"; + mediatek,switch = <&gsw>; mtd-mac-address = <&factory 0x4>; }; &switch0 { - ports { - port@0 { - status = "okay"; - label = "lan1"; - }; + /delete-property/ compatible; + phy-mode = "rgmii"; +}; - port@1 { - status = "okay"; - label = "lan2"; - }; - - port@2 { - status = "okay"; - label = "lan3"; - }; - - port@3 { - status = "okay"; - label = "lan4"; - }; - - port@4 { - status = "okay"; - label = "wan"; - mtd-mac-address = <&factory 0x4>; - mtd-mac-address-increment = <1>; - }; - }; +&gsw { + compatible = "mediatek,ralink-mt7621-gsw"; }; &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 7605f931be..062d9fe488 100755 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -64,7 +64,8 @@ ramips_setup_interfaces() mikrotik,routerboard-760igs) ucidef_set_interfaces_lan_wan "lan2 lan3 lan4 lan5" "wan sfp" ;; - phicomm,k2p) + phicomm,k2p|\ + xiaoyu,xy-c5) ucidef_add_switch "switch0" \ "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0" ucidef_set_interface_lan "eth0.1 ra0 rax0" @@ -77,7 +78,7 @@ ramips_setup_interfaces() ;; xiaomi,mir4) ucidef_add_switch "switch0" \ - "1:lan:1" "2:lan:2" "4:wan" "6t@eth0" + "1:lan:2" "2:lan:1" "4:wan" "6t@eth0" ucidef_set_interface_lan "eth0.1 ra0 rai0" ;; xiaomi,mi-router-ac2100|\ @@ -167,6 +168,9 @@ ramips_setup_macs() lan_mac=$(mtd_get_mac_binary factory 0xe006) wan_mac=$(mtd_get_mac_binary factory 0xe000) ;; + xiaoyu,xy-c5) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1) + ;; wavlink,wl-wn531a6|\ winstars,ws-wn583a6|\ zbtlink,zbt-we1326|\