ramips/mt7621: re-added hwnat support for kernel 5.4 (#5120)

* ramips: mt7621.dtsi: add missing pinctrl to ethernet node

Add rgmii1_pins (1st GMAC) and mdio_pins to ethernet node
pinctrl to ensure they are set to correct mode

* ramips: kernel: ralink-eth support mt7621

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>

* ramips: some devices use ralink-eth driver

Also re-added mt7621 hwnat support for some devices.

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
Signed-off-by: AmadeusGhost <amadeus@openjmu.xyz>

* ramips/mt7621: re-added hwnat support

Co-authored-by: LGA1150 <dqfext@gmail.com>
Co-authored-by: Chen Minqiang <ptpt52@gmail.com>
This commit is contained in:
AmadeusGhost 2020-07-18 01:02:11 +08:00 committed by GitHub
parent 6e2f7ac729
commit 0635250cda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 99 additions and 123 deletions

View File

@ -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

View File

@ -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))

View File

@ -458,6 +458,9 @@
mediatek,ethsys = <&ethsys>;
pinctrl-names = "default";
pinctrl-0 = <&rgmii1_pins &mdio_pins>;
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;

View File

@ -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 = &ethernet;
};
chosen {
@ -150,38 +150,19 @@
};
};
&gmac0 {
&ethernet {
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 {

View File

@ -10,6 +10,10 @@
compatible = "gehua,ghl-r-001", "mediatek,mt7621-soc";
model = "GeHua GHL-R-001";
aliases {
label-mac-device = &ethernet;
};
chosen {
bootargs = "console=ttyS0,57600";
};
@ -111,34 +115,19 @@
};
};
&gmac0 {
&ethernet {
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 {

View File

@ -107,38 +107,19 @@
};
};
&gmac0 {
&ethernet {
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 {

View File

@ -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 = &ethernet;
};
leds {

View File

@ -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 = &ethernet;
};
leds {

View File

@ -109,33 +109,19 @@
};
};
&gmac0 {
mtd-mac-address = <&factory 0xe000>;
&ethernet {
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 {

View File

@ -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,
},

View File

@ -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,
},

View File

@ -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 },
{},
};

View File

@ -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

View File

@ -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"

View File

@ -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)

View File

@ -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

View File

@ -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.