brcm47xx: improve cpuport detection for filesafe
[openwrt/openwrt.git] / target / linux / brcm47xx / base-files / lib / preinit / 05_init_interfaces_brcm
1 #!/bin/sh
2
3 set_preinit_iface() {
4 ifname=eth0
5
6 insmod diag
7 insmod hwmon
8 insmod pps_core
9 insmod ptp
10 insmod tg3
11 insmod b44
12 insmod bgmac
13
14 # hardware specific overrides
15 case "$(cat /proc/diag/model)" in
16 "Linksys WAP54G V1") ifname=eth1;;
17 "ASUS WL-HDD") ifname=eth1;;
18 "ASUS WL-300g") ifname=eth1;;
19 "ASUS (unknown, BCM4702)") ifname=eth1;;
20 "Sitecom WL-105b") ifname=eth1;;
21 esac
22 ifconfig $ifname 0.0.0.0 up
23 }
24
25 init_iface() {
26 insmod switch-core
27 insmod switch-robo
28 insmod switch-adm
29
30 [ -d /proc/switch/eth0 ] && [ "$ifname" = "eth0" ] && {
31 case "$(cat /proc/switch/eth0/cpuport)" in
32 "5") cpu_port="5u*";;
33 "8") cpu_port="8u*";;
34 esac
35 }
36 }
37
38 boot_hook_add preinit_main set_preinit_iface
39 boot_hook_add preinit_main init_iface