3 # Copyright (C) 2013 OpenWrt.org
8 ramips_switchdev_from_soc
() {
9 # The ethernet switch driver enables VLAN by default, but
10 # failsafe uses eth0, making the device unreachable:
11 # https://dev.openwrt.org/ticket/18768
14 local RT3X5X
=$
(grep -E "(RT3.5|RT5350|MT7628|MT7688|MT7620|MT7621)" /proc
/cpuinfo
)
16 [ -n "$RT3X5X" ] ||
return 1
33 ramips_switchdev_from_board
() {
34 # For these devices, external ethernet switch should be used
35 # instead of the SoC internal switch.
38 local board
=$
(board_name
)
46 ramips_set_preinit_iface
() {
47 local switchdev
=$
(ramips_switchdev_from_board
)
48 [ -n "$switchdev" ] || switchdev
=$
(ramips_switchdev_from_soc
)
50 if [ -n "$switchdev" ]; then
51 swconfig dev
$switchdev set reset 1
52 swconfig dev
$switchdev set enable_vlan
0
53 swconfig dev
$switchdev set apply
1
59 boot_hook_add preinit_main ramips_set_preinit_iface