ipq806x: ecw5410: 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 if [ -b "$(find_mtd_part 0:art)" ]; then
32 ucidef_set_interface_macaddr "lan" "$(mtd_get_mac_binary "0:art" 0x6)"
33 ucidef_set_interface_macaddr "wan" "$(mtd_get_mac_binary "0:art" 0x0)"
34 else
35 # XXX: drop upper case after kernel v5.4 is gone (qcom-smem)
36 ucidef_set_interface_macaddr "lan" "$(mtd_get_mac_binary "0:ART" 0x6)"
37 ucidef_set_interface_macaddr "wan" "$(mtd_get_mac_binary "0:ART" 0x0)"
38 fi
39 ;;
40 linksys,ea7500-v1)
41 hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
42 ucidef_add_switch "switch0" \
43 "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "6@eth1" "1:wan" "0@eth0"
44 ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
45 ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
46 ;;
47 linksys,ea8500)
48 hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
49 ucidef_add_switch "switch0" \
50 "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
51 ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
52 ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
53 ;;
54 nec,wg2600hp3)
55 ucidef_add_switch "switch0" \
56 "2:lan" "3:lan" "4:lan" "5:lan" "0@eth1" "1:wan" "6@eth0"
57 ;;
58 netgear,r7800 |\
59 tplink,ad7200 |\
60 tplink,c2600)
61 ucidef_add_switch "switch0" \
62 "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "6@eth1" "5:wan" "0@eth0"
63 ;;
64 qcom,ipq8064-ap161)
65 ucidef_set_interface_lan "eth1 eth2"
66 ucidef_add_switch "switch0" \
67 "0:lan" "1:lan" "2:lan" "3u@eth1" "6:wan" "4u@eth0"
68 ;;
69 qcom,ipq8064-db149)
70 ucidef_set_interface_lan "eth1 eth2 eth3"
71 ucidef_add_switch "switch0" \
72 "1:lan" "2:lan" "3:lan" "4:lan" "6u@eth1" "5:wan" "0u@eth0"
73 ;;
74 ubnt,unifi-ac-hd)
75 ucidef_set_interface_lan "eth0 eth1"
76 ;;
77 zyxel,nbg6817)
78 hw_mac_addr=$(mtd_get_mac_ascii 0:appsblenv ethaddr)
79 # XXX: drop upper case after kernel v5.4 is gone (qcom-smem)
80 [ -n "$hw_mac_addr" ] || \
81 hw_mac_addr=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
82 ucidef_add_switch "switch0" \
83 "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
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 *)
88 echo "Unsupported hardware. Network interfaces not intialized"
89 ;;
90 esac
91
92 board_config_flush
93
94 exit 0