mvebu: add support for Fortinet FortiGate 50E
[openwrt/openwrt.git] / target / linux / mvebu / cortexa9 / base-files / etc / board.d / 02_network
1 #
2 # Copyright (C) 2014-2016 OpenWrt.org
3 # Copyright (C) 2016 LEDE-Project.org
4 #
5
6 . /lib/functions.sh
7 . /lib/functions/uci-defaults.sh
8 . /lib/functions/system.sh
9
10 mvebu_setup_interfaces()
11 {
12 local board="$1"
13
14 case "$board" in
15 ctera,c200-v2)
16 ucidef_set_interface_lan "eth0" "dhcp"
17 ;;
18 cznic,turris-omnia)
19 ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3 lan4" "eth2"
20 ;;
21 fortinet,fg-50e)
22 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5" "eth1 eth2"
23 ;;
24 iptime,nas1dual)
25 ucidef_set_interface_lan "eth0 eth1" "dhcp"
26 ;;
27 linksys,wrt1200ac|\
28 linksys,wrt1900ac-v1|\
29 linksys,wrt1900ac-v2|\
30 linksys,wrt1900acs|\
31 linksys,wrt3200acm|\
32 linksys,wrt32x)
33 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
34 ;;
35 marvell,a385-db-ap)
36 ucidef_set_interfaces_lan_wan "eth0 eth1" "eth2"
37 ;;
38 marvell,axp-gp)
39 ucidef_set_interface_lan "eth0 eth1 eth2 eth3"
40 ;;
41 solidrun,clearfog-base-a1)
42 # eth0 is standalone ethernet
43 # eth1 is standalone ethernet
44 # eth2 is SFP
45 ucidef_set_interfaces_lan_wan "eth1" "eth0 eth2"
46 ;;
47 solidrun,clearfog-pro-a1)
48 # eth0 is standalone ethernet
49 # eth1 is switch
50 # eth2 is SFP
51 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5 lan6" "eth0 eth2"
52 ;;
53 *)
54 ucidef_set_interface_lan "eth0"
55 ;;
56 esac
57 }
58
59 mvebu_setup_macs()
60 {
61 local board="$1"
62 local lan_mac=""
63 local wan_mac=""
64 local label_mac=""
65
66 case "$board" in
67 buffalo,ls220de|\
68 buffalo,ls421de)
69 lan_mac=$(mtd_get_mac_ascii u-boot-env eth1addr)
70 ;;
71 ctera,c200-v2)
72 label_mac=$(mtd_get_mac_ascii dev_params mac)
73 lan_mac=$label_mac
74 ;;
75 linksys,wrt1200ac|\
76 linksys,wrt1900ac-v2|\
77 linksys,wrt1900acs|\
78 linksys,wrt3200acm|\
79 linksys,wrt32x)
80 label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
81 wan_mac=$(macaddr_setbit_la $label_mac)
82 ;;
83 linksys,wrt1900ac-v1)
84 label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
85 lan_mac=$label_mac
86 wan_mac=$label_mac
87 ;;
88 esac
89
90 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
91 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
92 [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
93 }
94
95 board_config_update
96 board=$(board_name)
97 mvebu_setup_interfaces $board
98 mvebu_setup_macs $board
99 board_config_flush
100
101 exit 0