brcm47xx: load pps_core and ptp before tg3 to make the interface available for failsafe.
[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 check_module () {
26   module="$1"; shift; params="$*"
27
28   insmod "$module" "$params"
29   sleep 1
30   grep -q ^"$module " /proc/modules
31   return $?
32 }
33
34 init_iface() {
35         insmod switch-core
36         check_module switch-robo || check_module switch-adm  || {
37           check_module bcm57xx activate_gpio=0x4 && cpu_port="8u*"
38         } || rmmod switch-core
39 }
40
41 boot_hook_add preinit_main set_preinit_iface
42 boot_hook_add preinit_main init_iface