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