aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/lantiq/xway/base-files/etc
diff options
context:
space:
mode:
authorAdrian Schmutzler <freifunk@adrianschmutzler.de>2019-12-17 14:37:26 +0100
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>2020-01-14 22:04:44 +0100
commit2fe464a712f8da597475d63a0ad28ec678eb404a (patch)
tree8dd8bdff4c78a56d63b2c4ea38c519ff49b28aad /target/linux/lantiq/xway/base-files/etc
parent18e089aaed58cb474c40b63da8562d7805f8b776 (diff)
downloadupstream-2fe464a712f8da597475d63a0ad28ec678eb404a.tar.gz
upstream-2fe464a712f8da597475d63a0ad28ec678eb404a.tar.bz2
upstream-2fe464a712f8da597475d63a0ad28ec678eb404a.zip
lantiq: reorganize 02_network board.d files
This reorganizes 02_network board.d files based on what's done for ath79 and ramips: Instead of putting all settings into a single big case, the interface/dsl/MAC address setup is put into separate functions with a specific switch case for each of them. This makes grouping of devices much easier and should be easier to read, too. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Diffstat (limited to 'target/linux/lantiq/xway/base-files/etc')
-rwxr-xr-xtarget/linux/lantiq/xway/base-files/etc/board.d/02_network193
1 files changed, 99 insertions, 94 deletions
diff --git a/target/linux/lantiq/xway/base-files/etc/board.d/02_network b/target/linux/lantiq/xway/base-files/etc/board.d/02_network
index 71d36696db..89368d8bfb 100755
--- a/target/linux/lantiq/xway/base-files/etc/board.d/02_network
+++ b/target/linux/lantiq/xway/base-files/etc/board.d/02_network
@@ -7,107 +7,112 @@
. /lib/functions/system.sh
. /lib/functions/lantiq.sh
-board_config_update
+lantiq_setup_interfaces()
+{
+ local board="$1"
-annex="a"
+ case "$board" in
+ arcadyan,arv4510pw)
+ ucidef_add_switch "switch0" \
+ "0:lan:4" "2:lan:2" "1:lan:3" "3:lan:1" "5t@eth0"
+ ;;
+ arcadyan,arv4519pw|\
+ arcadyan,arv7510pw22|\
+ arcadyan,arv7518pw|\
+ arcadyan,arv752dpw22|\
+ arcadyan,arv8539pw22|\
+ buffalo,wbmr-hp-g300h)
+ ucidef_add_switch "switch0" \
+ "0t@eth0" "2:lan" "3:lan" "4:lan" "5:lan"
+ ;;
+ arcadyan,arv7506pw11|\
+ audiocodes,mp-252|\
+ siemens,gigaset-sx76x)
+ ucidef_add_switch "switch0" \
+ "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5t@eth0"
+ ;;
+ arcadyan,arv7519pw|\
+ zte,h201l)
+ ucidef_add_switch "switch0" \
+ "0:lan" "1:lan" "2:lan" "3:lan" "4t@eth0"
+ ;;
+ bt,homehub-v2b)
+ ucidef_add_switch "switch0" \
+ "1:lan" "2:lan" "3:lan" "4:lan" "5t@eth0"
+ ;;
+ netgear,dgn3500|\
+ netgear,dgn3500b)
+ ucidef_add_switch "switch0" \
+ "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5t@eth0"
+ ;;
+ zyxel,p-2601hn)
+ ucidef_add_switch "switch0" \
+ "0:lan" "1:lan" "2:lan" "3:lan" "5t@eth0"
+ ;;
+ *)
+ ucidef_set_interface_lan 'eth0'
+ ;;
+ esac
+}
-lan_mac=""
-wan_mac=""
+lantiq_setup_dsl()
+{
+ local board="$1"
+ local annex="a"
-board=$(board_name)
+ case "$board" in
+ arcadyan,arv7506pw11|\
+ arcadyan,arv7525pw|\
+ arcadyan,arv752dpw|\
+ arcadyan,arv752dpw22|\
+ arcadyan,arv8539pw22|\
+ avm,fritz7312|\
+ avm,fritz7320|\
+ siemens,gigaset-sx76x|\
+ zte,h201l)
+ annex="b"
+ ;;
+ esac
+
+ lantiq_setup_dsl_helper "$annex"
+}
-case "$board" in
-arcadyan,arv4510pw)
- lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
- wan_mac=$(macaddr_add "$lan_mac" 1)
- ucidef_add_switch "switch0" \
- "0:lan:4" "2:lan:2" "1:lan:3" "3:lan:1" "5t@eth0"
- ;;
-arcadyan,arv4519pw|\
-arcadyan,arv7510pw22|\
-arcadyan,arv7518pw)
- ucidef_add_switch "switch0" \
- "0t@eth0" "2:lan" "3:lan" "4:lan" "5:lan"
- ;;
-arcadyan,arv7506pw11)
- annex="b"
- wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 0x16)" 2)
- ucidef_add_switch "switch0" \
- "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5t@eth0"
- ;;
-arcadyan,arv7519pw)
- wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 0x16)" 1)
- ucidef_add_switch "switch0" \
- "0:lan" "1:lan" "2:lan" "3:lan" "4t@eth0"
- ;;
-arcadyan,arv7525pw|\
-arcadyan,arv752dpw)
- annex="b"
- ucidef_set_interface_lan 'eth0'
- ;;
-arcadyan,arv752dpw22|\
-arcadyan,arv8539pw22)
- annex="b"
- ucidef_add_switch "switch0" \
- "0t@eth0" "2:lan" "3:lan" "4:lan" "5:lan"
- ;;
-audiocodes,mp-252)
- ucidef_add_switch "switch0" \
- "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5t@eth0"
- ;;
-avm,fritz7312|\
-avm,fritz7320)
- annex="b"
- wan_mac=$(macaddr_add "$(mtd_get_mac_binary urlader 0xa91)" 1)
- ucidef_set_interface_lan 'eth0'
- ;;
-bt,homehub-v2b)
- lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
- wan_mac=$(macaddr_add "$lan_mac" 1)
- ucidef_add_switch "switch0" \
- "1:lan" "2:lan" "3:lan" "4:lan" "5t@eth0"
- ;;
-bt,homehub-v3a)
- lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
- wan_mac=$(macaddr_add "$lan_mac" 1)
- ucidef_set_interface_lan 'eth0'
- ;;
-buffalo,wbmr-hp-g300h)
- ucidef_add_switch "switch0" \
- "0t@eth0" "2:lan" "3:lan" "4:lan" "5:lan"
- ;;
-netgear,dgn3500|\
-netgear,dgn3500b)
- lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr)
- wan_mac=$(macaddr_add "$lan_mac" 1)
- ucidef_add_switch "switch0" \
- "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5t@eth0"
- ;;
-siemens,gigaset-sx76x)
- annex="b"
- ucidef_add_switch "switch0" \
- "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5t@eth0"
- ;;
-zte,h201l)
- annex="b"
- ucidef_add_switch "switch0" \
- "0:lan" "1:lan" "2:lan" "3:lan" "4t@eth0"
- ;;
-zyxel,p-2601hn)
- ucidef_add_switch "switch0" \
- "0:lan" "1:lan" "2:lan" "3:lan" "5t@eth0"
- ;;
-*)
- ucidef_set_interface_lan 'eth0'
- ;;
-esac
+lantiq_setup_macs()
+{
+ local board="$1"
+ local lan_mac=""
+ local wan_mac=""
-lantiq_setup_dsl_helper "$annex"
+ case "$board" in
+ arcadyan,arv4510pw|\
+ bt,homehub-v2b|\
+ bt,homehub-v3a|\
+ netgear,dgn3500|\
+ netgear,dgn3500b)
+ lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr)
+ wan_mac=$(macaddr_add "$lan_mac" 1)
+ ;;
+ arcadyan,arv7506pw11)
+ wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 0x16)" 2)
+ ;;
+ arcadyan,arv7519pw)
+ wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 0x16)" 1)
+ ;;
+ avm,fritz7312|\
+ avm,fritz7320)
+ wan_mac=$(macaddr_add "$(mtd_get_mac_binary urlader 0xa91)" 1)
+ ;;
+ esac
-[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac"
-[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac"
+ [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" "$lan_mac"
+ [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" "$wan_mac"
+}
+board_config_update
+board=$(board_name)
+lantiq_setup_interfaces $board
+lantiq_setup_dsl $board
+lantiq_setup_macs $board
board_config_flush
exit 0
-