ramips: Revert 'allow to set switchdev by board in ramips_set_preinit_iface' (#3000)

This may affect wireless and network.
This commit is contained in:
AmadeusGhost 2020-02-08 17:14:44 +08:00 committed by GitHub
parent 7fce313c4c
commit da5186e8f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 63 additions and 71 deletions

View File

@ -3,54 +3,27 @@
# Copyright (C) 2013 OpenWrt.org
#
. /lib/functions.sh
ramips_switchdev_from_soc() {
# The ethernet switch driver enables VLAN by default, but
# failsafe uses eth0, making the device unreachable:
# https://dev.openwrt.org/ticket/18768
local switchdev
local RT3X5X=$(grep -E "(RT3.5|RT5350|MT7628|MT7688|MT7620|MT7621)" /proc/cpuinfo)
[ -n "$RT3X5X" ] || return 1
case "$RT3X5X" in
*MT7620*)
switchdev=mt7620
;;
*MT7621*)
switchdev=mt7530
;;
*)
switchdev=rt305x
;;
esac
echo "$switchdev"
}
ramips_switchdev_from_board() {
# For these devices, external ethernet switch should be used
# instead of the SoC internal switch.
local switchdev
local board=$(board_name)
case "$board" in
esac
echo "$switchdev"
}
ramips_set_preinit_iface() {
local switchdev=$(ramips_switchdev_from_board)
[ -n "$switchdev" ] || switchdev=$(ramips_switchdev_from_soc)
RT3X5X=$(grep -E "(RT3.5|RT5350|MT7628|MT7688|MT7620|MT7621)" /proc/cpuinfo)
if [ -n "$switchdev" ]; then
swconfig dev $switchdev set reset 1
swconfig dev $switchdev set enable_vlan 0
swconfig dev $switchdev set apply 1
if [ -n "${RT3X5X}" ]; then
# The ethernet switch driver enables VLAN by default, but
# failsafe uses eth0, making the device unreachable:
# https://dev.openwrt.org/ticket/18768
case "${RT3X5X}" in
*MT7620*)
ralink_switchdev=mt7620
;;
*MT7621*)
ralink_switchdev=mt7530
;;
*)
ralink_switchdev=rt305x
;;
esac
swconfig dev $ralink_switchdev set reset 1
swconfig dev $ralink_switchdev set enable_vlan 0
swconfig dev $ralink_switchdev set apply 1
fi
ifname=eth0

View File

@ -6,8 +6,8 @@
#include <dt-bindings/input/input.h>
/ {
compatible = "netis,wf-2881", "mediatek,mt7621-soc";
model = "NETIS WF-2881";
compatible = "netis,wf2881", "mediatek,mt7621-soc";
model = "NETIS WF2881";
aliases {
led-boot = &led_wps;
@ -25,14 +25,14 @@
compatible = "gpio-leds";
usb {
label = "wf-2881:green:usb";
label = "wf2881:green:usb";
gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
trigger-sources = <&xhci_ehci_port1>, <&ehci_port2>;
linux,default-trigger = "usbport";
};
led_wps: wps {
label = "wf-2881:green:wps";
label = "wf2881:green:wps";
gpios = <&gpio0 0 GPIO_ACTIVE_LOW>;
};
};
@ -75,9 +75,22 @@
};
partition@140000 {
compatible = "denx,uimage";
label = "firmware";
reg = <0x140000 0x7e40000>;
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "kernel";
reg = <0x0 0x400000>;
};
partition@400000 {
label = "ubi";
reg = <0x400000 0x7a40000>;
};
};
};
};

View File

@ -7,6 +7,21 @@ include ./common-tp-link.mk
DEFAULT_SOC := mt7621
KERNEL_DTB += -d21
DEVICE_VARS += UIMAGE_MAGIC
# The OEM webinterface expects an kernel with initramfs which has the uImage
# header field ih_name.
# We don't want to set the header name field for the kernel include in the
# sysupgrade image as well, as this image shouldn't be accepted by the OEM
# webinterface. It will soft-brick the board.
define Build/custom-initramfs-uimage
mkimage -A $(LINUX_KARCH) \
-O linux -T kernel \
-C lzma -a $(KERNEL_LOADADDR) $(if $(UIMAGE_MAGIC),-M $(UIMAGE_MAGIC),) \
-e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
-n '$(1)' -d $@ $@.new
mv $@.new $@
endef
define Build/elecom-gst-factory
$(eval product=$(word 1,$(1)))
@ -74,19 +89,6 @@ define Build/ubnt-erx-factory-image
fi
endef
# The OEM webinterface expects an kernel with initramfs which has the uImage
# header field ih_name.
# We don't wan't to set the header name field for the kernel include in the
# sysupgrade image as well, as this image shouldn't be accepted by the OEM
# webinterface. It will soft-brick the board.
define Build/wr1201-factory-header
mkimage -A $(LINUX_KARCH) \
-O linux -T kernel \
-C lzma -a $(KERNEL_LOADADDR) -e $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR)) \
-n 'WR1201_8_128' -d $@ $@.new
mv $@.new $@
endef
define Device/afoundry_ew1200
IMAGE_SIZE := 16064k
DEVICE_VENDOR := AFOUNDRY
@ -466,7 +468,7 @@ define Device/mtc_wr1201
IMAGE_SIZE := 16000k
DEVICE_VENDOR := MTC
DEVICE_MODEL := Wireless Router WR1201
KERNEL_INITRAMFS := $(KERNEL_DTB) | wr1201-factory-header
KERNEL_INITRAMFS := $(KERNEL_DTB) | custom-initramfs-uimage WR1201_8_128
DEVICE_PACKAGES := kmod-sdhci-mt7620 kmod-mt76x2 kmod-usb3 \
kmod-usb-ledtrig-usbport wpad-openssl
endef
@ -586,21 +588,24 @@ define Device/netgear_wndr3700-v5
endef
TARGET_DEVICES += netgear_wndr3700-v5
define Device/netis_wf-2881
define Device/netis_wf2881
BLOCKSIZE := 128k
PAGESIZE := 2048
FILESYSTEMS := squashfs
KERNEL_SIZE := 4096k
IMAGE_SIZE := 129280k
KERNEL := $(KERNEL_DTB) | pad-offset $$(BLOCKSIZE) 64 | uImage lzma
UBINIZE_OPTS := -E 5
IMAGE/sysupgrade.bin := append-kernel | append-ubi | append-metadata | \
IMAGES += factory.bin
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \
check-size $$$$(IMAGE_SIZE)
DEVICE_VENDOR := NETIS
DEVICE_MODEL := WF-2881
DEVICE_MODEL := WF2881
DEVICE_PACKAGES := kmod-mt76x2 kmod-usb3 kmod-usb-ledtrig-usbport wpad-openssl
SUPPORTED_DEVICES += wf-2881
endef
TARGET_DEVICES += netis_wf-2881
TARGET_DEVICES += netis_wf2881
define Device/phicomm_k2p
IMAGE_SIZE := 15744k

View File

@ -48,7 +48,7 @@ ramips_setup_interfaces()
netgear,r6800|\
netgear,r6850|\
netgear,wndr3700-v5|\
netis,wf-2881|\
netis,wf2881|\
wevo,11acnas|\
wevo,w2914ns-v2|\
zio,freezio)
@ -184,7 +184,7 @@ ramips_setup_macs()
elecom,wrc-1900gst|\
elecom,wrc-2533gst|\
lenovo,newifi-d1|\
netis,wf-2881|\
netis,wf2881|\
phicomm,k2p|\
planex,vr500|\
samknows,whitebox-v8|\

View File

@ -50,6 +50,7 @@ platform_do_upgrade() {
netgear,r6350|\
netgear,r6800|\
netgear,r6850|\
netis,wf2881|\
xiaomi,mir3g|\
xiaomi,mir3p)
nand_do_upgrade "$1"