add preinit modularization work by Daniel Dickinson (cshore)
[openwrt/svn-archive/archive.git] / target / linux / atheros / base-files / lib / preinit / 15_preinit_iface_atheros
1 #!/bin/sh
2
3 # reset button only supported on ar5315+ at the moment
4 preinit_ip() {
5 if [ -z "$pi_ifname" ]; then
6 grep 'Atheros AR231[567]' /proc/cpuinfo > /dev/null && {
7 if [ -e "/sys/bus/mdio_bus/drivers/Infineon ADM6996/0:00" -o \
8 -e "/sys/bus/mdio_bus/drivers/Marvell 88E6060/0:10" ]; then
9 vconfig set_name_type DEV_PLUS_VID_NO_PAD
10 ifconfig eth0 up
11 vconfig add eth0 1
12 ifname=eth0.1
13 else
14 ifname=eth0
15 fi
16 pi_ifname=$ifname
17 }
18 [ -n "$pi_ifname" ] && grep "$pi_ifname" /proc/net/dev >/dev/null && {
19 ifconfig $pi_ifname $pi_ip netmask $pi_netmask broadcast $pi_broadcast up
20 }
21 }
22
23
24 # reset button only supported on ar5315+ at the moment
25
26 preinit_ip_deconfig() {
27 if [ -e "/sys/bus/mdio_bus/drivers/Infineon ADM6996/0:00" -o \
28 -e "/sys/bus/mdio_bus/drivers/Marvell 88E6060/0:10" ]; then
29 vconfig rem eth0.1 2>/dev/null
30 ifconfig $pi_ifname down
31 fi
32 }