ipq806x: Add support for IPQ8064 AP161 board
[openwrt/staging/wigyori.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 compex,wpq864 |\
16 netgear,d7800 |\
17 netgear,r7500 |\
18 netgear,r7500v2 |\
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 qcom,ipq8064-ap161)
25 ucidef_set_interface_lan "eth1 eth2"
26 ucidef_add_switch "switch0" \
27 "0:lan" "1:lan" "2:lan" "3u@eth1" "6:wan" "4u@eth0"
28 ;;
29 linksys,ea8500)
30 hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
31 ucidef_add_switch "switch0" \
32 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
33 ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
34 ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
35 ;;
36 nec,wg2600hp)
37 ucidef_add_switch "switch0" \
38 "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" "1:wan" "0@eth0"
39 ;;
40 netgear,r7800 |\
41 tplink,c2600)
42 ucidef_add_switch "switch0" \
43 "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "6@eth1" "5:wan" "0@eth0"
44 ;;
45 qcom,ipq8064-db149)
46 ucidef_set_interface_lan "eth1 eth2 eth3"
47 ucidef_add_switch "switch0" \
48 "1:lan" "2:lan" "3:lan" "4:lan" "6u@eth1" "5:wan" "0u@eth0"
49 ;;
50 zyxel,nbg6817)
51 hw_mac_addr=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
52 ucidef_add_switch "switch0" \
53 "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
54 ucidef_set_interface_macaddr "lan" "$(macaddr_add $hw_mac_addr 2)"
55 ucidef_set_interface_macaddr "wan" "$(macaddr_add $hw_mac_addr 3)"
56 ;;
57 *)
58 echo "Unsupported hardware. Network interfaces not intialized"
59 ;;
60 esac
61
62 board_config_flush
63
64 exit 0