diff --git a/target/linux/generic/hack-5.4/999-shortcut-fe-support.patch b/target/linux/generic/hack-5.4/999-shortcut-fe-support.patch index ef6fa664d..a7916f8ef 100644 --- a/target/linux/generic/hack-5.4/999-shortcut-fe-support.patch +++ b/target/linux/generic/hack-5.4/999-shortcut-fe-support.patch @@ -156,7 +156,7 @@ + +config SHORTCUT_FE + bool "Enables kernel network stack path for Shortcut Forwarding Engine -+ default y ++ --- a/net/netfilter/nf_conntrack_proto_tcp.c 2020-06-23 11:43:45.404018000 -0700 +++ b/net/netfilter/nf_conntrack_proto_tcp.c 2020-06-27 18:28:24.610214943 -0700 diff --git a/target/linux/ramips/Makefile b/target/linux/ramips/Makefile index c3d118b2a..2718c5136 100644 --- a/target/linux/ramips/Makefile +++ b/target/linux/ramips/Makefile @@ -20,6 +20,6 @@ define Target/Description endef include $(INCLUDE_DIR)/target.mk -DEFAULT_PACKAGES += kmod-leds-gpio kmod-gpio-button-hotplug +DEFAULT_PACKAGES += kmod-leds-gpio kmod-gpio-button-hotplug -luci-app-sfe luci-app-flowoffload $(eval $(call BuildTarget)) diff --git a/target/linux/ramips/dts/mt7621.dtsi b/target/linux/ramips/dts/mt7621.dtsi index 78979dc42..04b5e895b 100644 --- a/target/linux/ramips/dts/mt7621.dtsi +++ b/target/linux/ramips/dts/mt7621.dtsi @@ -458,6 +458,9 @@ mediatek,ethsys = <ðsys>; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii1_pins &mdio_pins>; + gmac0: mac@0 { compatible = "mediatek,eth-mac"; reg = <0>; diff --git a/target/linux/ramips/dts/mt7621_d-team_newifi-d2.dts b/target/linux/ramips/dts/mt7621_d-team_newifi-d2.dts index 56bb1822e..855dfe68d 100644 --- a/target/linux/ramips/dts/mt7621_d-team_newifi-d2.dts +++ b/target/linux/ramips/dts/mt7621_d-team_newifi-d2.dts @@ -14,7 +14,7 @@ led-failsafe = &led_power_blue; led-running = &led_power_blue; led-upgrade = &led_power_blue; - label-mac-device = &gmac0; + label-mac-device = ðernet; }; chosen { @@ -150,38 +150,19 @@ }; }; -&gmac0 { +ðernet { + compatible = "mediatek,ralink-mt7621-eth"; + mediatek,switch = <&gsw>; mtd-mac-address = <&factory 0xe000>; }; &switch0 { - ports { - port@0 { - status = "okay"; - label = "lan4"; - }; + /delete-property/ compatible; + phy-mode = "rgmii"; +}; - port@1 { - status = "okay"; - label = "lan3"; - }; - - port@2 { - status = "okay"; - label = "lan2"; - }; - - port@3 { - status = "okay"; - label = "lan1"; - }; - - port@4 { - status = "okay"; - label = "wan"; - mtd-mac-address = <&factory 0xe006>; - }; - }; +&gsw { + compatible = "mediatek,ralink-mt7621-gsw"; }; &state_default { diff --git a/target/linux/ramips/dts/mt7621_gehua_ghl-r-001.dts b/target/linux/ramips/dts/mt7621_gehua_ghl-r-001.dts index 8f7e273b1..9070d91e9 100644 --- a/target/linux/ramips/dts/mt7621_gehua_ghl-r-001.dts +++ b/target/linux/ramips/dts/mt7621_gehua_ghl-r-001.dts @@ -10,6 +10,10 @@ compatible = "gehua,ghl-r-001", "mediatek,mt7621-soc"; model = "GeHua GHL-R-001"; + aliases { + label-mac-device = ðernet; + }; + chosen { bootargs = "console=ttyS0,57600"; }; @@ -111,34 +115,19 @@ }; }; -&gmac0 { +ðernet { + compatible = "mediatek,ralink-mt7621-eth"; + mediatek,switch = <&gsw>; mtd-mac-address = <&factory 0xe000>; }; &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@4 { - status = "okay"; - label = "wan"; - mtd-mac-address = <&factory 0xe000>; - mtd-mac-address-increment = <1>; - }; - }; +&gsw { + compatible = "mediatek,ralink-mt7621-gsw"; }; &state_default { diff --git a/target/linux/ramips/dts/mt7621_phicomm_k2p.dts b/target/linux/ramips/dts/mt7621_phicomm_k2p.dts index aa68dddcf..fa02521ba 100644 --- a/target/linux/ramips/dts/mt7621_phicomm_k2p.dts +++ b/target/linux/ramips/dts/mt7621_phicomm_k2p.dts @@ -107,38 +107,19 @@ }; }; -&gmac0 { +ðernet { + compatible = "mediatek,ralink-mt7621-eth"; + mediatek,switch = <&gsw>; mtd-mac-address = <&factory 0xe000>; }; &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 0xe006>; - }; - }; +&gsw { + compatible = "mediatek,ralink-mt7621-gsw"; }; &state_default { diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-ac2100.dts b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-ac2100.dts index 885ea05c6..92dc3311c 100644 --- a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-ac2100.dts +++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-ac2100.dts @@ -12,7 +12,7 @@ led-failsafe = &led_status_yellow; led-running = &led_status_blue; led-upgrade = &led_status_blue; - label-mac-device = &gmac0; + label-mac-device = ðernet; }; leds { diff --git a/target/linux/ramips/dts/mt7621_xiaomi_redmi-router-ac2100.dts b/target/linux/ramips/dts/mt7621_xiaomi_redmi-router-ac2100.dts index ceaeec750..8f102310c 100644 --- a/target/linux/ramips/dts/mt7621_xiaomi_redmi-router-ac2100.dts +++ b/target/linux/ramips/dts/mt7621_xiaomi_redmi-router-ac2100.dts @@ -12,7 +12,7 @@ led-failsafe = &led_status_amber; led-running = &led_status_white; led-upgrade = &led_status_white; - label-mac-device = &gmac0; + label-mac-device = ðernet; }; leds { diff --git a/target/linux/ramips/dts/mt7621_xiaomi_router-ac2100.dtsi b/target/linux/ramips/dts/mt7621_xiaomi_router-ac2100.dtsi index d19a3440b..aa499df89 100644 --- a/target/linux/ramips/dts/mt7621_xiaomi_router-ac2100.dtsi +++ b/target/linux/ramips/dts/mt7621_xiaomi_router-ac2100.dtsi @@ -109,33 +109,19 @@ }; }; -&gmac0 { - mtd-mac-address = <&factory 0xe000>; +ðernet { + compatible = "mediatek,ralink-mt7621-eth"; + mediatek,switch = <&gsw>; + mtd-mac-address = <&factory 0xe006>; }; &switch0 { - ports { - port@0 { - status = "okay"; - label = "wan"; - mtd-mac-address = <&factory 0xe006>; - }; + /delete-property/ compatible; + phy-mode = "rgmii"; +}; - port@2 { - status = "okay"; - label = "lan1"; - }; - - port@3 { - status = "okay"; - label = "lan2"; - }; - - port@4 { - status = "okay"; - label = "lan3"; - }; - }; +&gsw { + compatible = "mediatek,ralink-mt7621-gsw"; }; &state_default { diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7621.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7621.c index 232bcd8cf..e4ba4b2c2 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7621.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/gsw_mt7621.c @@ -195,7 +195,7 @@ static void mt7621_hw_init(struct mt7620_gsw *gsw, struct device_node *np) } static const struct of_device_id mediatek_gsw_match[] = { - { .compatible = "mediatek,mt7621-gsw" }, + { .compatible = "mediatek,ralink-mt7621-gsw" }, {}, }; MODULE_DEVICE_TABLE(of, mediatek_gsw_match); @@ -261,7 +261,7 @@ static struct platform_driver gsw_driver = { .probe = mt7621_gsw_probe, .remove = mt7621_gsw_remove, .driver = { - .name = "mt7621-gsw", + .name = "ralink-mt7621-gsw", .owner = THIS_MODULE, .of_match_table = mediatek_gsw_match, }, diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c index 358a8fc16..a22a8f748 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c @@ -1732,7 +1732,7 @@ static struct platform_driver fe_driver = { .probe = fe_probe, .remove = fe_remove, .driver = { - .name = "mtk_soc_eth", + .name = "ralink_soc_eth", .owner = THIS_MODULE, .of_match_table = of_fe_match, }, diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/soc_mt7621.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/soc_mt7621.c index 26a198fa2..3c04a9d66 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/soc_mt7621.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/soc_mt7621.c @@ -180,7 +180,7 @@ static struct fe_soc_data mt7621_data = { }; const struct of_device_id of_fe_match[] = { - { .compatible = "mediatek,mt7621-eth", .data = &mt7621_data }, + { .compatible = "mediatek,ralink-mt7621-eth", .data = &mt7621_data }, {}, }; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index c592339fb..af8a4359c 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -351,8 +351,8 @@ define Device/gehua_ghl-r-001 IMAGE_SIZE := 32448k DEVICE_VENDOR := GeHua DEVICE_MODEL := GHL-R-001 - DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2 kmod-usb3 \ - kmod-usb-ledtrig-usbport wpad-openssl + DEVICE_PACKAGES := kmod-mt7603e kmod-mt76x2e kmod-usb3 \ + kmod-usb-ledtrig-usbport luci-app-mtwifi endef TARGET_DEVICES += gehua_ghl-r-001 diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds index 8f7a42c3a..e6af879dc 100755 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds @@ -18,12 +18,11 @@ led_wlan="$(get_dt_led wlan)" case $board in d-team,newifi-d2) - ucidef_set_led_netdev "internet" "internet" "$boardname:amber:internet" "wan" + ucidef_set_led_switch "internet" "internet" "$boardname:amber:internet" "switch0" "0x10" ucidef_set_led_netdev "wlan2g" "WiFi 2.4GHz" "$boardname:blue:wlan2g" "ra0" ucidef_set_led_netdev "wlan5g" "WiFi 5GHz" "$boardname:blue:wlan5g" "rai0" ;; -d-team,pbr-m1|\ -gehua,ghl-r-001) +d-team,pbr-m1) ucidef_set_led_netdev "internet" "internet" "$boardname:blue:internet" "wan" ;; dlink,dir-860l-b1) @@ -36,6 +35,9 @@ motorola,mr2600) ucidef_set_led_netdev "wlan2g" "WiFi 2.4GHz" "$boardname:green:wlan2g" "ra0" ucidef_set_led_netdev "wlan5g" "WiFi 5GHz" "$boardname:green:wlan5g" "rai0" ;; +gehua,ghl-r-001) + ucidef_set_led_switch "internet" "internet" "$boardname:blue:internet" "switch0" "0x10" + ;; gnubee,gb-pc1|\ gnubee,gb-pc2) ucidef_set_led_netdev "lan1" "lan1" "$boardname:green:lan1" "lan1" @@ -86,10 +88,10 @@ xzwifi,creativebox-v1) ucidef_set_led_netdev "internet" "internet" "$boardname:blue:internet" "wan" ;; xiaomi,mi-router-ac2100) - ucidef_set_led_netdev "wan" "wan" "$boardname:blue:wan" "wan" + ucidef_set_led_switch "wan" "wan" "$boardname:blue:wan" "switch0" "0x1" ;; xiaomi,redmi-router-ac2100) - ucidef_set_led_netdev "wan" "wan" "$boardname:white:wan" "wan" + ucidef_set_led_switch "wan" "wan" "$boardname:white:wan" "switch0" "0x1" ;; youhua,wr1200js) ucidef_set_led_netdev "internet" "INTERNET" "$boardname:green:wan" "wan" 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 1894ac6e0..eae2f82a2 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 @@ -21,15 +21,19 @@ ramips_setup_interfaces() ucidef_set_interfaces_lan_wan "lan1 lan2" "wan" ;; d-team,newifi-d2) - ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 ra0 rai0" "wan" + ucidef_add_switch "switch0" \ + "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan:5" "6@eth0" + ucidef_set_interface_lan "eth0.1 ra0 rai0 apcli0 apclii0" ;; - gehua,ghl-r-001|\ hiwifi,hc5962|\ - xiaomi,mir3p|\ - xiaomi,mi-router-ac2100|\ - xiaomi,redmi-router-ac2100) + xiaomi,mir3p) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 ra0 rai0" "wan" ;; + gehua,ghl-r-001) + ucidef_add_switch "switch0" \ + "0:lan" "1:lan" "2:lan" "4:wan" "6@eth0" + ucidef_set_interface_lan "eth0.1 ra0 rai0 apcli0 apclii0" + ;; gnubee,gb-pc1|\ gnubee,gb-pc2) ucidef_set_interface_lan "lan1 lan2" @@ -56,7 +60,9 @@ ramips_setup_interfaces() ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 ra0 rai0" "wan" ;; phicomm,k2p) - ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 ra0 rax0" "wan" + ucidef_add_switch "switch0" \ + "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0" + ucidef_set_interface_lan "eth0.1 ra0 rax0 apcli0 apclix0" ;; ubnt,edgerouter-x) ucidef_set_interface_lan_wan "eth1 eth2 eth3 eth4" "eth0" @@ -64,6 +70,12 @@ ramips_setup_interfaces() ubnt,edgerouter-x-sfp) ucidef_set_interface_lan_wan "eth1 eth2 eth3 eth4 eth5" "eth0" ;; + xiaomi,mi-router-ac2100|\ + xiaomi,redmi-router-ac2100) + ucidef_add_switch "switch0" \ + "0:wan" "2:lan:1" "3:lan:2" "4:lan:3" "6@eth0" + ucidef_set_interface_lan "eth0.1 ra0 rai0 apcli0 apclii0" + ;; *) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" ;; @@ -88,6 +100,10 @@ ramips_setup_macs() wan_mac="$(grep -m1 mac= "/dev/mtd${index}" | cut -d= -f2)" lan_mac=$wan_mac ;; + d-team,newifi-d2) + lan_mac=$(cat /sys/class/net/eth0/address) + wan_mac=$(mtd_get_mac_binary factory 0xe006) + ;; dlink,dir-860l-b1) lan_mac=$(mtd_get_mac_ascii factory lanmac) wan_mac=$(mtd_get_mac_ascii factory wanmac) @@ -97,6 +113,10 @@ ramips_setup_macs() lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr) wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr) ;; + gehua,ghl-r-001) + lan_mac=$(cat /sys/class/net/eth0/address) + wan_mac=$(macaddr_add "$lan_mac" 1) + ;; hiwifi,hc5962) lan_mac=$(mtd_get_mac_ascii bdinfo "Vfac_mac ") label_mac=$lan_mac @@ -119,6 +139,11 @@ ramips_setup_macs() wan_mac=$label_mac lan_mac=$(macaddr_add $label_mac 1) ;; + xiaomi,mi-router-ac2100|\ + xiaomi,redmi-router-ac2100) + lan_mac=$(cat /sys/class/net/eth0/address) + wan_mac=$(mtd_get_mac_binary factory 0xe000) + ;; zbtlink,zbt-we1326|\ zbtlink,zbt-wg3526-16m|\ zbtlink,zbt-wg3526-32m) diff --git a/target/linux/ramips/mt7621/config-5.4 b/target/linux/ramips/mt7621/config-5.4 index b2c3ad5ba..4e6c4e50f 100644 --- a/target/linux/ramips/mt7621/config-5.4 +++ b/target/linux/ramips/mt7621/config-5.4 @@ -230,9 +230,15 @@ CONFIG_NET_DSA_MT7530=y CONFIG_NET_DSA_TAG_MTK=y CONFIG_NET_FLOW_LIMIT=y CONFIG_NET_MEDIATEK_SOC=y +CONFIG_NET_RALINK_GSW_MT7621=y +CONFIG_NET_RALINK_MDIO=y +CONFIG_NET_RALINK_MDIO_MT7620=y +CONFIG_NET_RALINK_MT7621=y +CONFIG_NET_RALINK_OFFLOAD=y +CONFIG_NET_RALINK_SOC=y CONFIG_NET_SWITCHDEV=y CONFIG_NET_VENDOR_MEDIATEK=y -# CONFIG_NET_VENDOR_RALINK is not set +CONFIG_NET_VENDOR_RALINK=y CONFIG_NR_CPUS=4 CONFIG_OF=y CONFIG_OF_ADDRESS=y @@ -301,6 +307,8 @@ CONFIG_SPI_MEM=y CONFIG_SPI_MT7621=y # CONFIG_SPI_RT2880 is not set CONFIG_SRCU=y +CONFIG_SWCONFIG=y +CONFIG_SWCONFIG_LEDS=y CONFIG_SWPHY=y CONFIG_SYNC_R4K=y CONFIG_SYSCTL_EXCEPTION_TRACE=y diff --git a/target/linux/ramips/mt7621/target.mk b/target/linux/ramips/mt7621/target.mk index 2684ea5b6..b64e78517 100644 --- a/target/linux/ramips/mt7621/target.mk +++ b/target/linux/ramips/mt7621/target.mk @@ -8,6 +8,7 @@ FEATURES+=nand ramdisk rtc usb minor CPU_TYPE:=24kc KERNEL_PATCHVER:=5.4 +DEFAULT_PACKAGES += swconfig define Target/Description Build firmware images for Ralink MT7621 based boards.