brcm47xx: add bgmac driver
[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 tg3
9         insmod b44
10         insmod bgmac
11
12         # hardware specific overrides
13         case "$(cat /proc/diag/model)" in
14                 "Linksys WAP54G V1") ifname=eth1;;
15                 "ASUS WL-HDD") ifname=eth1;;
16                 "ASUS WL-300g") ifname=eth1;;
17                 "ASUS (unknown, BCM4702)") ifname=eth1;;
18                 "Sitecom WL-105b") ifname=eth1;;
19         esac
20         ifconfig $ifname 0.0.0.0 up
21 }
22
23 check_module () {
24   module="$1"; shift; params="$*"
25
26   insmod "$module" "$params"
27   sleep 1
28   grep -q ^"$module " /proc/modules
29   return $?
30 }
31
32 init_iface() {
33         insmod switch-core
34         check_module switch-robo || check_module switch-adm  || {
35           check_module bcm57xx activate_gpio=0x4 && cpu_port="8u*"
36         } || rmmod switch-core
37 }
38
39 boot_hook_add preinit_main set_preinit_iface
40 boot_hook_add preinit_main init_iface