sunxi: add support for FriendlyARM NanoPi R1S H5
[openwrt/openwrt.git] / target / linux / sunxi / base-files / etc / board.d / 02_network
1 #
2 # Copyright (C) 2013-2015 OpenWrt.org
3 #
4
5 . /lib/functions/uci-defaults.sh
6 . /lib/functions/system.sh
7
8 sunxi_setup_interfaces()
9 {
10 local board="$1"
11
12 case "$board" in
13 friendlyarm,nanopi-r1|\
14 friendlyarm,nanopi-r1s-h5)
15 ucidef_set_interfaces_lan_wan "eth1" "eth0"
16 ;;
17 lamobo,lamobo-r1)
18 ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" wan
19 ;;
20 olimex,a20-olinuxino-micro)
21 ucidef_set_interface_lan "wlan0"
22 ;;
23 xunlong,orangepi-r1)
24 ucidef_set_interfaces_lan_wan "eth0" "eth1"
25 ;;
26 *)
27 ucidef_set_interface_lan "eth0"
28 ;;
29 esac
30 }
31
32 sunxi_setup_macs()
33 {
34 local board="$1"
35 local lan_mac=""
36 local wan_mac=""
37 local label_mac=""
38
39 case "$board" in
40 friendlyarm,nanopi-r1s-h5)
41 lan_mac=$(get_mac_binary "/sys/bus/i2c/devices/0-0051/eeprom" 0xfa)
42 ;;
43 esac
44
45 [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
46 [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
47 [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
48 }
49
50 board_config_update
51 board=$(board_name)
52 sunxi_setup_interfaces $board
53 sunxi_setup_macs $board
54 board_config_flush
55
56 exit 0