ipq806x: add support for Extreme Networks AP3935
[openwrt/openwrt.git] / target / linux / ipq806x / base-files / etc / board.d / 02_network
1 #
2 # Copyright (c) 2015 The Linux Foundation. All rights reserved.
3 # Copyright (c) 2011-2015 OpenWrt.org
4 #
5
6 . /lib/functions/uci-defaults.sh
7 . /lib/functions/system.sh
8
9 ipq806x_setup_interfaces()
10 {
11 local board="$1"
12
13 case "$board" in
14 arris,tr4400-v2)
15 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "eth2"
16 ;;
17 askey,rt4230w-rev6 |\
18 asrock,g10 |\
19 nec,wg2600hp |\
20 buffalo,wxr-2533dhp |\
21 compex,wpq864 |\
22 netgear,d7800 |\
23 netgear,r7500 |\
24 netgear,r7500v2 |\
25 qcom,ipq8064-ap148 |\
26 linksys,ea7500-v1 |\
27 linksys,ea8500 |\
28 nec,wg2600hp3 |\
29 netgear,r7800 |\
30 netgear,xr500 |\
31 netgear,xr450 |\
32 tplink,c2600 |\
33 tplink,vr2600v |\
34 tplink,ad7200 |\
35 zyxel,nbg6817)
36 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
37 ;;
38 asus,onhub |\
39 tplink,onhub)
40 ucidef_set_interfaces_lan_wan "lan1" "wan"
41 ;;
42 edgecore,ecw5410 |\
43 extreme,ap3935)
44 ucidef_set_interfaces_lan_wan "eth1" "eth0"
45 ;;
46 qcom,ipq8064-ap161)
47 ucidef_set_interface_lan "eth1 eth2 lan1 lan2 lan3 lan4" "wan"
48 ;;
49 qcom,ipq8064-db149)
50 ucidef_set_interface_lan "eth1 eth2 eth3 lan1 lan2 lan3 lan4" "wan"
51 ;;
52 ubnt,unifi-ac-hd)
53 ucidef_set_interface_lan "eth0 eth1"
54 ;;
55 meraki,mr42)
56 ucidef_set_interface_lan "eth0"
57 ;;
58 meraki,mr52)
59 ucidef_set_interfaces_lan_wan "eth0" "eth1"
60 ;;
61 *)
62 echo "Unsupported hardware. Network interfaces not intialized"
63 ;;
64 esac
65 }
66
67 ipq806x_setup_macs()
68 {
69 local board="$1"
70
71 case "$board" in
72 linksys,ea7500-v1)
73 hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
74 ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
75 ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
76 ;;
77 linksys,ea8500)
78 hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
79 ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
80 ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
81 ;;
82 zyxel,nbg6817)
83 hw_mac_addr=$(mtd_get_mac_ascii 0:appsblenv ethaddr)
84 ucidef_set_interface_macaddr "lan" "$(macaddr_add $hw_mac_addr 2)"
85 ucidef_set_interface_macaddr "wan" "$(macaddr_add $hw_mac_addr 3)"
86 ;;
87 asrock,g10)
88 hw_mac_addr=$(mtd_get_mac_ascii hwconfig HW.LAN.MAC.Address)
89 ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
90 hw_mac_addr=$(mtd_get_mac_ascii hwconfig HW.WAN.MAC.Address)
91 ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
92 ;;
93 esac
94 }
95
96 board_config_update
97 board=$(board_name)
98
99 ipq806x_setup_macs $board
100 ipq806x_setup_interfaces $board
101
102 board_config_flush
103
104 exit 0