ipq806x: nbg6817: case-insensitive qcom-smem partitions
[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 board_config_update
10
11 board=$(board_name)
12
13 case "$board" in
14 asrock,g10 |\
15 nec,wg2600hp)
16 ucidef_add_switch "switch0" \
17 "2:lan" "3:lan" "4:lan" "5:lan" "6@eth1" "1:wan" "0@eth0"
18 ;;
19 buffalo,wxr-2533dhp |\
20 compex,wpq864 |\
21 netgear,d7800 |\
22 netgear,r7500 |\
23 netgear,r7500v2 |\
24 qcom,ipq8064-ap148 |\
25 tplink,vr2600v)
26 ucidef_add_switch "switch0" \
27 "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
28 ;;
29 edgecore,ecw5410)
30 ucidef_set_interfaces_lan_wan "eth1" "eth0"
31 ucidef_set_interface_macaddr "lan" "$(mtd_get_mac_binary "0:ART" 0x6)"
32 ucidef_set_interface_macaddr "wan" "$(mtd_get_mac_binary "0:ART" 0x0)"
33 ;;
34 linksys,ea7500-v1)
35 hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
36 ucidef_add_switch "switch0" \
37 "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "6@eth1" "1:wan" "0@eth0"
38 ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
39 ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
40 ;;
41 linksys,ea8500)
42 hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
43 ucidef_add_switch "switch0" \
44 "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
45 ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
46 ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
47 ;;
48 nec,wg2600hp3)
49 ucidef_add_switch "switch0" \
50 "2:lan" "3:lan" "4:lan" "5:lan" "0@eth1" "1:wan" "6@eth0"
51 ;;
52 netgear,r7800 |\
53 tplink,ad7200 |\
54 tplink,c2600)
55 ucidef_add_switch "switch0" \
56 "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "6@eth1" "5:wan" "0@eth0"
57 ;;
58 qcom,ipq8064-ap161)
59 ucidef_set_interface_lan "eth1 eth2"
60 ucidef_add_switch "switch0" \
61 "0:lan" "1:lan" "2:lan" "3u@eth1" "6:wan" "4u@eth0"
62 ;;
63 qcom,ipq8064-db149)
64 ucidef_set_interface_lan "eth1 eth2 eth3"
65 ucidef_add_switch "switch0" \
66 "1:lan" "2:lan" "3:lan" "4:lan" "6u@eth1" "5:wan" "0u@eth0"
67 ;;
68 ubnt,unifi-ac-hd)
69 ucidef_set_interface_lan "eth0 eth1"
70 ;;
71 zyxel,nbg6817)
72 hw_mac_addr=$(mtd_get_mac_ascii 0:appsblenv ethaddr)
73 # XXX: drop upper case after kernel v5.4 is gone (qcom-smem)
74 [ -n "$hw_mac_addr" ] || \
75 hw_mac_addr=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
76 ucidef_add_switch "switch0" \
77 "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
78 ucidef_set_interface_macaddr "lan" "$(macaddr_add $hw_mac_addr 2)"
79 ucidef_set_interface_macaddr "wan" "$(macaddr_add $hw_mac_addr 3)"
80 ;;
81 *)
82 echo "Unsupported hardware. Network interfaces not intialized"
83 ;;
84 esac
85
86 board_config_flush
87
88 exit 0