ipq806x: convert to dt-based board-detection
[openwrt/openwrt.git] / target / linux / ipq806x / base-files / etc / board.d / 02_network
1 #!/bin/sh
2 #
3 # Copyright (c) 2015 The Linux Foundation. All rights reserved.
4 # Copyright (c) 2011-2015 OpenWrt.org
5 #
6
7 . /lib/functions/uci-defaults.sh
8 . /lib/functions/system.sh
9
10 board_config_update
11
12 board=$(board_name)
13
14 case "$board" in
15 netgear,d7800 |\
16 netgear,r7500 |\
17 netgear,r7500v2 |\
18 netgear,r7800 |\
19 qcom,ipq8064-ap148 |\
20 tplink,vr2600v)
21 ucidef_add_switch "switch0" \
22 "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
23 ;;
24 tplink,c2600)
25 ucidef_add_switch "switch0" \
26 "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "6@eth1" "5:wan" "0@eth0"
27 ;;
28 qcom,ipq8064-db149)
29 ucidef_set_interface_lan "eth1 eth2 eth3"
30 ucidef_add_switch "switch0" \
31 "1:lan" "2:lan" "3:lan" "4:lan" "6u@eth1" "5:wan" "0u@eth0"
32 ;;
33 linksys,ea8500)
34
35 hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
36 ucidef_add_switch "switch0" \
37 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
38 ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
39 ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
40 ;;
41 avm,fritzbox-4040)
42 ucidef_set_interfaces_lan_wan "eth0" "eth1"
43 ucidef_add_switch "switch0" \
44 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
45 ;;
46 zyxel,nbg6817)
47 hw_mac_addr=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
48 ucidef_add_switch "switch0" \
49 "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
50 ucidef_set_interface_macaddr "lan" "$(macaddr_add $hw_mac_addr 2)"
51 ucidef_set_interface_macaddr "wan" "$(macaddr_add $hw_mac_addr 3)"
52 ;;
53 *)
54 echo "Unsupported hardware. Network interfaces not intialized"
55 ;;
56 esac
57
58 board_config_flush
59
60 exit 0