ipq806x: fix EA8500 switch configuration
[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/ipq806x.sh
9 . /lib/functions/system.sh
10
11 board_config_update
12
13 board=$(ipq806x_board_name)
14
15 case "$board" in
16 ap148 |\
17 c2600 |\
18 d7800 |\
19 r7500 |\
20 r7500v2 |\
21 r7800 |\
22 vr2600v)
23 ucidef_add_switch "switch0" \
24 "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
25 ;;
26 db149)
27 ucidef_set_interface_lan "eth1 eth2 eth3"
28 ucidef_add_switch "switch0" \
29 "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
30 ;;
31 ea8500)
32
33 hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
34 ucidef_add_switch "switch0" \
35 "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
36 ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
37 ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
38 ;;
39 nbg6817)
40 hw_mac_addr=$(mtd_get_mac_ascii 0:APPSBLENV ethaddr)
41 ucidef_add_switch "switch0" \
42 "1:lan" "2:lan" "3:lan" "4:lan" "6@eth1" "5:wan" "0@eth0"
43 ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
44 ucidef_set_interface_macaddr "wan" "$(macaddr_add $hw_mac_addr 1)"
45 ;;
46 *)
47 echo "Unsupported hardware. Network interfaces not intialized"
48 ;;
49 esac
50
51 board_config_flush
52
53 exit 0