aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/lantiq/xrx200
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/xrx200
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/xrx200')
-rwxr-xr-xtarget/linux/lantiq/xrx200/base-files/etc/board.d/02_network271
1 files changed, 156 insertions, 115 deletions
diff --git a/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network b/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network
index 05e235b096..f39898263d 100755
--- a/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network
+++ b/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network
@@ -7,128 +7,169 @@
. /lib/functions/system.sh
. /lib/functions/lantiq.sh
-board_config_update
+lantiq_setup_interfaces()
+{
+ local board="$1"
-annex="a"
+ case "$board" in
+ alphanetworks,asl56026)
+ ucidef_add_switch "switch0" \
+ "2:lan" "3:lan" "6t@eth0"
+ ;;
+ arcadyan,arv7519rw22)
+ ucidef_add_switch "switch0" \
+ "0:lan:5" "2:lan:3" "3:lan:4" "4:lan:1" "5:lan:2" "6t@eth0"
+ ;;
+ arcadyan,vg3503j)
+ ucidef_add_switch "switch0" \
+ "2:lan:2" "4:lan:1" "6t@eth0"
+ ;;
+ arcadyan,vgv7510kw22-brn|\
+ arcadyan,vgv7510kw22-nor)
+ ucidef_add_switch "switch0" \
+ "2:lan:2" "3:lan:1" "4:lan:4" "5:lan:3" "0:wan:5" "6t@eth0"
+ ;;
+ arcadyan,vgv7519-brn|\
+ arcadyan,vgv7519-nor|\
+ lantiq,easy80920-nand|\
+ lantiq,easy80920-nor)
+ ucidef_add_switch "switch0" \
+ "0:lan:4" "1:lan:3" "2:lan:2" "4:lan:1" "5:wan:5" "6t@eth0"
+ ;;
+ avm,fritz3370-rev2-hynix|\
+ avm,fritz3370-rev2-micron|\
+ avm,fritz7360sl|\
+ avm,fritz7362sl)
+ ucidef_add_switch "switch0" \
+ "0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "6t@eth0"
+ ;;
+ bt,homehub-v5a)
+ ucidef_add_switch "switch0" \
+ "0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "5:wan:5" "6t@eth0"
+ ;;
+ buffalo,wbmr-300hpd)
+ ucidef_add_switch "switch0" \
+ "5:lan:2" "2:lan:3" "3:lan:4" "4:wan:1" "6t@eth0"
+ ;;
+ tplink,tdw8970|\
+ tplink,tdw8980)
+ ucidef_add_switch "switch0" \
+ "0:lan:2" "2:lan:3" "4:lan:4" "5:lan:1" "6t@eth0"
+ ;;
+ tplink,vr200|\
+ tplink,vr200v)
+ ucidef_add_switch "switch0" \
+ "0:lan" "2:lan" "4:lan" "5:lan" "6t@eth0"
+ ;;
+ zyxel,p-2812hnu-f1|\
+ zyxel,p-2812hnu-f3)
+ ucidef_add_switch "switch0" \
+ "0:lan" "1:lan" "2:lan" "4:lan" "5:wan" "6t@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,vgv7510kw22-brn|\
+ arcadyan,vgv7510kw22-nor|\
+ avm,fritz3370-rev2-hynix|\
+ avm,fritz3370-rev2-micron|\
+ avm,fritz7360sl|\
+ avm,fritz7362sl|\
+ avm,fritz7412)
+ annex="b"
+ ;;
+ esac
+
+ lantiq_setup_dsl_helper "$annex"
+}
-case "$board" in
-alphanetworks,asl56026)
- lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
- wan_mac=$(mtd_get_mac_ascii uboot_env wanmac)
- ucidef_add_switch "switch0"\
- "2:lan" "3:lan" "6t@eth0"
- ;;
-arcadyan,arv7519rw22)
- wan_mac=$(macaddr_add "$(mtd_get_mac_binary boardconfig 0x16)" 1)
- ucidef_add_switch "switch0" \
- "0:lan:5" "2:lan:3" "3:lan:4" "4:lan:1" "5:lan:2" "6t@eth0"
- ;;
-arcadyan,vg3503j)
- lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr)
- wan_mac=$(macaddr_add "$lan_mac" 1)
- ucidef_add_switch "switch0" \
- "2:lan:2" "4:lan:1" "6t@eth0"
- ;;
-arcadyan,vgv7510kw22-brn|\
-arcadyan,vgv7510kw22-nor)
- annex="b"
- wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 0x16)" 2)
- ucidef_add_switch "switch0" \
- "2:lan:2" "3:lan:1" "4:lan:4" "5:lan:3" "0:wan:5" "6t@eth0"
- ;;
-arcadyan,vgv7519-brn|\
-arcadyan,vgv7519-nor)
- wan_mac=$(mtd_get_mac_binary board_config 0x16)
- ucidef_add_switch "switch0" \
- "0:lan:4" "1:lan:3" "2:lan:2" "4:lan:1" "5:wan:5" "6t@eth0"
- ;;
-avm,fritz3370-rev2-hynix|\
-avm,fritz3370-rev2-micron)
- annex="b"
- lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)"))
- wan_mac=$(macaddr_add "$lan_mac" 3)
- ucidef_add_switch "switch0" \
- "0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "6t@eth0"
- ;;
-avm,fritz7360sl)
- annex="b"
- wan_mac=$(macaddr_add "$(mtd_get_mac_binary urlader 0xa91)" 1)
- ucidef_add_switch "switch0" \
- "0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "6t@eth0"
- ;;
-avm,fritz7362sl)
- annex="b"
- lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)"))
- wan_mac=$(fritz_tffs -n macdsl -i $(find_mtd_part "tffs (1)"))
- ucidef_add_switch "switch0" \
- "0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "6t@eth0"
- ;;
-avm,fritz7412)
- tffsdev=$(find_mtd_chardev "nand-tffs")
- annex="b"
- lan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n maca -o)
- wan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n macdsl -o)
- ucidef_set_interface_lan 'eth0'
- ;;
-bt,homehub-v5a)
- lan_mac=$(mtd_get_mac_binary_ubi caldata 0x110c)
- wan_mac=$(macaddr_add "$lan_mac" 1)
- ucidef_add_switch "switch0" \
- "0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "5:wan:5" "6t@eth0"
- ;;
-buffalo,wbmr-300hpd)
- lan_mac=$(mtd_get_mac_ascii ubootconfig ethaddr)
- wan_mac="$lan_mac"
- ucidef_add_switch "switch0" \
- "5:lan:2" "2:lan:3" "3:lan:4" "4:wan:1" "6t@eth0"
- ;;
-lantiq,easy80920-nand|\
-lantiq,easy80920-nor)
- 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" "4:lan:1" "5:wan:5" "6t@eth0"
- ;;
-netgear,dm200)
- lan_mac=$(mtd_get_mac_binary ART 0x0)
- wan_mac=$(macaddr_add "$lan_mac" 1)
- ucidef_set_interface_lan 'eth0'
- ;;
-tplink,tdw8970|\
-tplink,tdw8980)
- wan_mac=$(macaddr_add "$(mtd_get_mac_binary boardconfig 0xf100)" 1)
- ucidef_add_switch "switch0" \
- "0:lan:2" "2:lan:3" "4:lan:4" "5:lan:1" "6t@eth0"
- ;;
-tplink,vr200|\
-tplink,vr200v)
- wan_mac=$(macaddr_add "$(mtd_get_mac_binary romfile 0xf100)" 1)
- ucidef_add_switch "switch0" \
- "0:lan" "2:lan" "4:lan" "5:lan" "6t@eth0"
- ;;
-zyxel,p-2812hnu-f1|\
-zyxel,p-2812hnu-f3)
- lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr)
- wan_mac=$(macaddr_add "$lan_mac" 1)
- ucidef_add_switch "switch0" \
- "0:lan" "1:lan" "2:lan" "4:lan" "5:wan" "6t@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
+ alphanetworks,asl56026)
+ lan_mac=$(mtd_get_mac_ascii uboot_env ethaddr)
+ wan_mac=$(mtd_get_mac_ascii uboot_env wanmac)
+ ;;
+ arcadyan,arv7519rw22)
+ wan_mac=$(macaddr_add "$(mtd_get_mac_binary boardconfig 0x16)" 1)
+ ;;
+ arcadyan,vg3503j|\
+ lantiq,easy80920-nand|\
+ lantiq,easy80920-nor|\
+ zyxel,p-2812hnu-f1|\
+ zyxel,p-2812hnu-f3)
+ lan_mac=$(mtd_get_mac_ascii uboot-env ethaddr)
+ wan_mac=$(macaddr_add "$lan_mac" 1)
+ ;;
+ arcadyan,vgv7510kw22-brn|\
+ arcadyan,vgv7510kw22-nor)
+ wan_mac=$(macaddr_add "$(mtd_get_mac_binary board_config 0x16)" 2)
+ ;;
+ arcadyan,vgv7519-brn|\
+ arcadyan,vgv7519-nor)
+ wan_mac=$(mtd_get_mac_binary board_config 0x16)
+ ;;
+ avm,fritz3370-rev2-hynix|\
+ avm,fritz3370-rev2-micron)
+ lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)"))
+ wan_mac=$(macaddr_add "$lan_mac" 3)
+ ;;
+ avm,fritz7360sl)
+ wan_mac=$(macaddr_add "$(mtd_get_mac_binary urlader 0xa91)" 1)
+ ;;
+ avm,fritz7362sl)
+ lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)"))
+ wan_mac=$(fritz_tffs -n macdsl -i $(find_mtd_part "tffs (1)"))
+ ;;
+ avm,fritz7412)
+ tffsdev=$(find_mtd_chardev "nand-tffs")
+ lan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n maca -o)
+ wan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n macdsl -o)
+ ;;
+ bt,homehub-v5a)
+ lan_mac=$(mtd_get_mac_binary_ubi caldata 0x110c)
+ wan_mac=$(macaddr_add "$lan_mac" 1)
+ ;;
+ buffalo,wbmr-300hpd)
+ lan_mac=$(mtd_get_mac_ascii ubootconfig ethaddr)
+ wan_mac="$lan_mac"
+ ;;
+ netgear,dm200)
+ lan_mac=$(mtd_get_mac_binary ART 0x0)
+ wan_mac=$(macaddr_add "$lan_mac" 1)
+ ;;
+ tplink,tdw8970|\
+ tplink,tdw8980)
+ wan_mac=$(macaddr_add "$(mtd_get_mac_binary boardconfig 0xf100)" 1)
+ ;;
+ tplink,vr200|\
+ tplink,vr200v)
+ wan_mac=$(macaddr_add "$(mtd_get_mac_binary romfile 0xf100)" 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
-