ath79: add AVM FRITZ!WLAN Repeater 300E
[oweals/openwrt.git] / target / linux / ath79 / base-files / etc / board.d / 02_network
1 #!/bin/sh
2
3 . /lib/functions/system.sh
4 . /lib/functions/uci-defaults.sh
5
6 ath79_setup_interfaces()
7 {
8         local board="$1"
9
10         case "$board" in
11         "avm,fritz300e"|\
12         "ubnt,unifi")
13                 ucidef_set_interface_lan "eth0"
14                 ;;
15
16         "tplink,tl-wr1043nd-v1")
17                 ucidef_add_switch "switch0" \
18                         "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5@eth0"
19                 ;;
20         "netgear,wndr3800")
21                 ucidef_set_interfaces_lan_wan "eth0" "eth1"
22                 ucidef_add_switch "switch0" \
23                         "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "5u@eth0"
24
25                 ucidef_add_switch_attr "switch0" "blinkrate" 2
26                 ucidef_add_switch_port_attr "switch0" 1 led 6
27                 ucidef_add_switch_port_attr "switch0" 2 led 9
28                 ucidef_add_switch_port_attr "switch0" 5 led 2
29                 ;;
30         "buffalo,wzr-hp-g450h")
31                 ucidef_add_switch "switch0" \
32                         "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
33                 ;;
34         *)
35                 ucidef_set_interfaces_lan_wan "eth0" "eth1"
36                 ;;
37         esac
38 }
39
40 ath79_setup_macs()
41 {
42         local board="$1"
43
44         case "$board" in
45         avm,fritz300e)
46                 lan_mac=$(fritz_tffs -n maca -i $(find_mtd_part "tffs (1)"))
47                 ;;
48         esac
49
50         [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
51 }
52
53 board_config_update
54 board=$(board_name)
55 ath79_setup_interfaces $board
56 ath79_setup_macs $board
57 board_config_flush
58
59 exit 0