[OpenWrt-Devel] [PATCH] ramips: fix switch init in failsafe-mode on some MT7621 boards

Daniel Golle daniel at makrotopia.org
Tue Jan 12 10:28:18 EST 2016


On at least some MT7621AT based boards the bootloader leaves the switch
uninitialized, thus neither eth0 nor eth0.1 would work as a failsafe
interface without priorly initializing the switch chip.
As a work-around, initialize the switch so the device will be listening
on its LAN ports during failsafe mode.

Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
 .../base-files/lib/preinit/07_set_preinit_iface_ramips   | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips b/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips
index 3dce1b6..c076a94 100644
--- a/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips
+++ b/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips
@@ -27,7 +27,21 @@ ramips_set_preinit_iface() {
 		ip link set eth0 up
 		ifname=eth0.1
 	else
-		ifname=eth0
+		case $(ramips_board_name) in
+			pbr-m1|\
+			zbt-wg2626)
+				swconfig dev mt7530 set enable_vlan 1
+				swconfig dev mt7530 vlan 1 set ports "0 1 2 3 6t"
+				swconfig dev mt7530 set apply 1
+				ip link add link eth0 name eth0.1 type vlan id 1
+				ip link set eth0 up
+				ifname=eth0.1
+				;;
+			*)
+				ifname=eth0
+				;;
+		esac
+
 	fi
 }
 
-- 
2.7.0
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list