summaryrefslogtreecommitdiffstats
path: root/target/linux/brcm63xx/base-files
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/brcm63xx/base-files')
-rwxr-xr-xtarget/linux/brcm63xx/base-files/etc/diag.sh51
-rw-r--r--target/linux/brcm63xx/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom42
-rwxr-xr-xtarget/linux/brcm63xx/base-files/etc/init.d/defconfig18
-rwxr-xr-xtarget/linux/brcm63xx/base-files/etc/uci-defaults/02_network108
-rwxr-xr-xtarget/linux/brcm63xx/base-files/etc/uci-defaults/09_fix_crc (renamed from target/linux/brcm63xx/base-files/etc/uci-defaults/brcm63xx_fixcrc.sh)6
-rwxr-xr-xtarget/linux/brcm63xx/base-files/etc/uci-defaults/network54
-rwxr-xr-xtarget/linux/brcm63xx/base-files/lib/brcm63xx.sh49
-rw-r--r--target/linux/brcm63xx/base-files/lib/preinit/05_failsafe_config_switch_brcm63xx5
-rw-r--r--target/linux/brcm63xx/base-files/lib/preinit/05_init_interfaces_brcm63xx19
-rw-r--r--target/linux/brcm63xx/base-files/lib/preinit/05_reset_button_brcm63xx3
-rw-r--r--target/linux/brcm63xx/base-files/lib/preinit/15_set_preinit_interface_brcm63xx19
-rw-r--r--target/linux/brcm63xx/base-files/lib/upgrade/platform.sh2
12 files changed, 201 insertions, 175 deletions
diff --git a/target/linux/brcm63xx/base-files/etc/diag.sh b/target/linux/brcm63xx/base-files/etc/diag.sh
index d492cd553..a03f89dc3 100755
--- a/target/linux/brcm63xx/base-files/etc/diag.sh
+++ b/target/linux/brcm63xx/base-files/etc/diag.sh
@@ -1,60 +1,13 @@
#!/bin/sh
-#
-# Copyright (C) 2007 OpenWrt.org
-#
-#
+# Copyright (C) 2007-2013 OpenWrt.org
+. /lib/functions/leds.sh
. /lib/brcm63xx.sh
-led_set_attr() {
- [ -f "/sys/class/leds/$1/$2" ] && echo "$3" > "/sys/class/leds/$1/$2"
-}
-
-status_led_set_timer() {
- led_set_attr $status_led "trigger" "timer"
- led_set_attr $status_led "delay_on" "$1"
- led_set_attr $status_led "delay_off" "$2"
- [ -n "$status_led2" ] && {
- led_set_attr $status_led2 "trigger" "timer"
- led_set_attr $status_led2 "delay_on" "$1"
- led_set_attr $status_led2 "delay_off" "$2"
- }
-}
-
-status_led_set_morse() {
- led_set_attr $status_led "trigger" "morse"
- led_set_attr $status_led "delay" "$1"
- led_set_attr $status_led "message" "$2"
- [ -n "$status_led2" ] && {
- led_set_attr $status_led2 "trigger" "morse"
- led_set_attr $status_led2 "delay" "$1"
- led_set_attr $status_led2 "message" "$2"
- }
-}
-
-status_led_on() {
- led_set_attr $status_led "trigger" "none"
- led_set_attr $status_led "brightness" 255
- [ -n "$status_led2" ] && {
- led_set_attr $status_led2 "trigger" "none"
- led_set_attr $status_led2 "brightness" 255
- }
-}
-
-status_led_off() {
- led_set_attr $status_led "trigger" "none"
- led_set_attr $status_led "brightness" 0
- [ -n "$status_led2" ] && {
- led_set_attr $status_led2 "trigger" "none"
- led_set_attr $status_led2 "brightness" 0
- }
-}
-
set_state() {
case "$1" in
preinit)
insmod leds-gpio
- status_led_on
status_led_set_timer 200 200
;;
failsafe)
diff --git a/target/linux/brcm63xx/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom b/target/linux/brcm63xx/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
new file mode 100644
index 000000000..eeb66e0d1
--- /dev/null
+++ b/target/linux/brcm63xx/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
@@ -0,0 +1,42 @@
+#!/bin/sh
+# Based on gabors ralink wisoc implementation.
+
+rt2x00_eeprom_die() {
+ echo "rt2x00 eeprom: " "$*"
+ exit 1
+}
+
+rt2x00_eeprom_extract() {
+ local part=$1
+ local offset=$2
+ local count=$3
+ local mtd
+
+ . /lib/functions.sh
+
+ mtd=$(find_mtd_part $part)
+ [ -n "$mtd" ] || \
+ rt2x00_eeprom_die "no mtd device found for partition $part"
+
+ dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count || \
+ rt2x00_eeprom_die "failed to extract from $mtd"
+}
+
+[ -e /lib/firmware/$FIRMWARE ] && exit 0
+
+. /lib/brcm63xx.sh
+
+board=$board_name
+
+case "$FIRMWARE" in
+"rt2x00.eeprom" )
+ case $board in
+ HW556_A)
+ rt2x00_eeprom_extract "cal_data" 130560 272
+ ;;
+ *)
+ rt2x00_eeprom_die "board $board is not supported yet"
+ ;;
+ esac
+ ;;
+esac
diff --git a/target/linux/brcm63xx/base-files/etc/init.d/defconfig b/target/linux/brcm63xx/base-files/etc/init.d/defconfig
deleted file mode 100755
index a49c32785..000000000
--- a/target/linux/brcm63xx/base-files/etc/init.d/defconfig
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh /etc/rc.common
-#
-# Copyright (C) 2009 OpenWrt.org
-#
-
-START=05
-
-start() {
- . /lib/brcm63xx.sh
-
- [ ! -d /etc/defconfig/$board_name ] && board_name="generic"
-
- for f in $( ls /etc/defconfig/$board_name ); do
- if [ ! -e /etc/config/$f ]; then
- cp /etc/defconfig/$board_name/$f /etc/config/
- fi
- done
-}
diff --git a/target/linux/brcm63xx/base-files/etc/uci-defaults/02_network b/target/linux/brcm63xx/base-files/etc/uci-defaults/02_network
new file mode 100755
index 000000000..f59fed678
--- /dev/null
+++ b/target/linux/brcm63xx/base-files/etc/uci-defaults/02_network
@@ -0,0 +1,108 @@
+#!/bin/sh
+#
+# Copyright (C) 2012 OpenWrt.org
+#
+
+[ -e /etc/config/network ] && exit 0
+
+touch /etc/config/network
+
+. /lib/functions/uci-defaults.sh
+. /lib/brcm63xx.sh
+
+ucidef_set_interface_loopback
+
+case "$board_name" in
+
+RTA770BW |\
+RTA770W |\
+96348W3 |\
+96358-502V |\
+SPW500V)
+ ucidef_set_interface_lan "eth0"
+ ;;
+
+96338GW |\
+96338W |\
+96338W2_E7T |\
+96348A-122 |\
+96348W3 |\
+CPVA642 |\
+CT536_CT5621 |\
+CT6373-1 |\
+D-4P-W |\
+"F@ST2604" |\
+RTA1320_16M |\
+V2110)
+ ucidef_set_interface_lan "eth0"
+ ucidef_add_switch "eth0" "1" "1"
+ ucidef_add_switch_vlan "eth0" "1" "0 1 2 3 4 5"
+ ;;
+
+96348GW |\
+96348GW-10 |\
+96348GW-11 |\
+96348GW-A |\
+96358VW |\
+96358VW2 |\
+AGPF-S0 |\
+"CPVA502+" |\
+DV201AMR |\
+DWV-S0 |\
+"F@ST2404" |\
+HW553 |\
+MAGIC |\
+RTA1025W_16 |\
+V2500V_BB)
+ ucidef_set_interfaces_lan_wan "eth1" "eth0"
+ ucidef_add_switch "eth1" "1" "1"
+ ucidef_add_switch_vlan "eth1" "1" "0 1 2 3 4 5"
+ ;;
+
+AW4139 |\
+HW556*)
+ ucidef_set_interface_lan "eth0.1"
+ ucidef_add_switch "eth0" "1" "1"
+ ucidef_add_switch_vlan "eth0" "1" "0 1 2 3 4 5t"
+ ;;
+
+NB4-* |\
+DVG3810BN)
+ ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
+ ucidef_add_switch "eth1" "1" "1"
+ ucidef_add_switch_vlan "eth1" "1" "0 1 2 3 4 5t"
+ ;;
+
+96328avng |\
+96328A-1241N |\
+96328A-1441N1 |\
+963281TAN |\
+963281T_TEF |\
+96368MVNgr)
+ ucidef_set_interface_lan "eth0.1"
+ ucidef_add_switch "eth0" "1" "1"
+ ucidef_add_switch_vlan "eth0" "1" "0 1 2 3 8t"
+ ;;
+
+96368MVWG)
+ ucidef_set_interface_lan "eth0.1"
+ ucidef_add_switch "eth0" "1" "1"
+ ucidef_add_switch_vlan "eth0" "1" "1 2 4 5 8t"
+ ;;
+
+NB6)
+ ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 9t"
+ ucidef_add_switch_vlan "switch0" "2" "0 9t"
+ ;;
+
+*)
+ ucidef_set_interfaces_lan_wan "eth1" "eth0"
+ ;;
+
+esac
+
+uci commit network
+
+exit 0
diff --git a/target/linux/brcm63xx/base-files/etc/uci-defaults/brcm63xx_fixcrc.sh b/target/linux/brcm63xx/base-files/etc/uci-defaults/09_fix_crc
index f5b6d440e..2bb79cc09 100755
--- a/target/linux/brcm63xx/base-files/etc/uci-defaults/brcm63xx_fixcrc.sh
+++ b/target/linux/brcm63xx/base-files/etc/uci-defaults/09_fix_crc
@@ -14,13 +14,19 @@ brcm63xx_detect
case "$board_name" in
96328avng |\
+ 96328A-1241N |\
+ 96328A-1441N1 |\
963281TAN |\
+ 963281T_TEF |\
+ 96358-502V |\
"CPVA502+" |\
AW4339U |\
CPVA642 |\
CT6373-1 |\
MAGIC |\
V2110 |\
+ RTA770BW |\
+ RTA770W |\
V2500V_BB)
do_fixcrc
;;
diff --git a/target/linux/brcm63xx/base-files/etc/uci-defaults/network b/target/linux/brcm63xx/base-files/etc/uci-defaults/network
deleted file mode 100755
index 53c29ac5a..000000000
--- a/target/linux/brcm63xx/base-files/etc/uci-defaults/network
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2012 OpenWrt.org
-#
-
-[ -e /etc/config/network ] && exit 0
-
-touch /etc/config/network
-
-. /lib/functions/uci-defaults.sh
-. /lib/brcm63xx.sh
-
-ucidef_set_interface_loopback
-
-case "$board_name" in
-
-96328avng |\
-963281TAN |\
-96348A-122 |\
-96358-502V |\
-CT6373-1 |\
-AW4339U |\
-CPVA642 |\
-CT536_CT5621 |\
-D-4P-W |\
-NB6 |\
-SPW303V |\
-SPW500V |\
-V2110 |\
-96348W3)
- ucidef_set_interface_lan "eth0"
- ;;
-
-AW4139)
- ucidef_set_interface_lan "eth0.1"
- ucidef_add_switch "eth0" "1" "1"
- ucidef_add_switch_vlan "eth0" "1" "0 1 2 3 4 5t"
- ;;
-
-DVG3810BN)
- ucidef_set_interfaces_lan_wan "eth1.1" "eth0"
- ucidef_add_switch "eth1" "1" "1"
- ucidef_add_switch_vlan "eth1" "1" "0 1 2 3 4 5t"
- ;;
-
-*)
- ucidef_set_interfaces_lan_wan "eth1" "eth0"
- ;;
-
-esac
-
-uci commit network
-
-exit 0
diff --git a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
index 11774770d..ded946de6 100755
--- a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
+++ b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
@@ -9,11 +9,12 @@ status_led=""
status_led2=""
sys_mtd_part=""
brcm63xx_has_reset_button=""
+ifname=""
brcm63xx_detect() {
board_name=$(awk 'BEGIN{FS="[ \t:/]+"} /system type/ {print $4}' /proc/cpuinfo)
- if [ "$board_name" = "96358VW" ] && [ -e /proc/switch/eth1/enable ]; then
+ if [ "$board_name" = "96358VW" ] && [ -n "$(swconfig dev eth1 help 2>/dev/null)" ]; then
board_name="DVAG3810BN"
fi
@@ -22,12 +23,37 @@ brcm63xx_detect() {
status_led="96328avng::power"
ifname=eth0
;;
+ 96328A-1241N)
+ brcm63xx_has_reset_button="true"
+ status_led="96328A-1241N:green:power"
+ ifname=eth0
+ ;;
+ RTA770BW)
+ brcm63xx_has_reset_button="true"
+ status_led="RTA770BW:green:diag"
+ ifname=eth0
+ ;;
+ RTA770W)
+ brcm63xx_has_reset_button="true"
+ status_led="RTA770W:green:diag"
+ ifname=eth0
+ ;;
+ 96328A-1441N1)
+ brcm63xx_has_reset_button="true"
+ status_led="96328A-1441N1:green:power"
+ ifname=eth0
+ ;;
963281TAN)
status_led="963281TAN::power"
ifname=eth0
;;
+ 963281T_TEF)
+ brcm63xx_has_reset_button="true"
+ status_led="963281T_TEF:green:power"
+ ifname=eth0
+ ;;
96348GW)
- status_led="power"
+ status_led="96348GW:green:power"
brcm63xx_has_reset_button="true"
ifname=eth1
;;
@@ -36,23 +62,28 @@ brcm63xx_detect() {
ifname=eth1
;;
GW6200)
- status_led="line1"
- status_led2="tel"
+ status_led="GW6200:green:line1"
+ status_led2="GW6200:green:tel"
brcm63xx_has_reset_button="true"
ifname=eth1
;;
+ HW556*)
+ status_led="HW556:red:power"
+ brcm63xx_has_reset_button="true"
+ ifname=eth0
+ ;;
96348GW-11)
- status_led="power"
+ status_led="96348GW-11:green:power"
brcm63xx_has_reset_button="true"
ifname=eth1
;;
CT536_CT5621)
- status_led="power"
+ status_led="CT536_CT5621:green:power"
brcm63xx_has_reset_button="true"
ifname=eth0
;;
SPW500V)
- status_led="power:green"
+ status_led="SPW500V:green:power"
brcm63xx_has_reset_button="true"
ifname=eth0
;;
@@ -73,12 +104,12 @@ brcm63xx_detect() {
ifname=eth0
;;
CPVA642)
- status_led="power:green"
+ status_led="CPVA642:green:power:"
brcm63xx_has_reset_button="true"
ifname=eth0
;;
D-4P-W)
- status_led="power:green"
+ status_led="D-4P-W:green:power"
brcm63xx_has_reset_button="true"
ifname=eth0
;;
diff --git a/target/linux/brcm63xx/base-files/lib/preinit/05_failsafe_config_switch_brcm63xx b/target/linux/brcm63xx/base-files/lib/preinit/05_failsafe_config_switch_brcm63xx
index 43da8cc06..e1653e393 100644
--- a/target/linux/brcm63xx/base-files/lib/preinit/05_failsafe_config_switch_brcm63xx
+++ b/target/linux/brcm63xx/base-files/lib/preinit/05_failsafe_config_switch_brcm63xx
@@ -1,11 +1,6 @@
#!/bin/sh
failsafe_ip() {
- [ -d "/proc/switch/$ifname" ] && {
- ifconfig "$ifname" 0.0.0.0 down
- echo "0 1 2 3 4 ${cpu_port:-5u*}" > "/proc/switch/$ifname/vlan/0/ports"
- }
-
[ -n "$pi_ifname" ] && grep -q "$pi_ifname" /proc/net/dev && {
ifconfig $pi_ifname $pi_ip netmask $pi_netmask broadcast $pi_broadcast up
}
diff --git a/target/linux/brcm63xx/base-files/lib/preinit/05_init_interfaces_brcm63xx b/target/linux/brcm63xx/base-files/lib/preinit/05_init_interfaces_brcm63xx
index b7cbecd4f..1de59b79c 100644
--- a/target/linux/brcm63xx/base-files/lib/preinit/05_init_interfaces_brcm63xx
+++ b/target/linux/brcm63xx/base-files/lib/preinit/05_init_interfaces_brcm63xx
@@ -1,26 +1,7 @@
#!/bin/sh
set_preinit_iface() {
- ifname=eth1
-
- . /lib/brcm63xx.sh
-
ifconfig $ifname 0.0.0.0 up
}
-check_module () {
- module="$1"; shift; params="$*"
-
- insmod "$module" "$params"
- sleep 1
- grep "^$module" /proc/modules
- return $?
-}
-
-init_iface() {
- insmod switch-core
- check_module switch-robo || check_module switch-adm || rmmod switch-core
-}
-
boot_hook_add preinit_main set_preinit_iface
-boot_hook_add preinit_main init_iface
diff --git a/target/linux/brcm63xx/base-files/lib/preinit/05_reset_button_brcm63xx b/target/linux/brcm63xx/base-files/lib/preinit/05_reset_button_brcm63xx
index f33825f96..0dfca73c2 100644
--- a/target/linux/brcm63xx/base-files/lib/preinit/05_reset_button_brcm63xx
+++ b/target/linux/brcm63xx/base-files/lib/preinit/05_reset_button_brcm63xx
@@ -1,13 +1,12 @@
#!/bin/sh
-. /lib/brcm63xx.sh
-
enable_reset_button() {
if [ "$brcm63xx_has_reset_button" = "true" ]; then
insmod input-core
insmod input-polldev
insmod gpio_buttons
insmod button-hotplug
+ insmod gpio_keys_polled
fi
}
diff --git a/target/linux/brcm63xx/base-files/lib/preinit/15_set_preinit_interface_brcm63xx b/target/linux/brcm63xx/base-files/lib/preinit/15_set_preinit_interface_brcm63xx
index 9d366fa33..7655fb7d5 100644
--- a/target/linux/brcm63xx/base-files/lib/preinit/15_set_preinit_interface_brcm63xx
+++ b/target/linux/brcm63xx/base-files/lib/preinit/15_set_preinit_interface_brcm63xx
@@ -16,29 +16,12 @@ preinit_ip_deconfig() {
ifconfig $pi_ifname 0.0.0.0 down
}
fi
- [ -d "/proc/switch/$ifname" ] && {
- echo 1 > "/proc/switch/$ifname/reset"
- echo "0 1 2 3 4 ${cpu_port:-5u*}" > "/proc/switch/$ifname/vlan/0/ports"
- }
-
}
preinit_net_echo() {
preinit_ip
-
- [ -d "/proc/switch/$ifname" ] && {
- echo 1 > "/proc/switch/$ifname/reset"
- # this would be easier if we blasted the message across all ports
- # but we don't want packets leaking across interfaces
- for port in $(seq 0 4); do {
- echo "$port ${cpu_port:-5u*}" > "/proc/switch/$ifname/vlan/0/ports"
- port_net_echo $1
- }; done
-
- echo "0 ${cpu_port:-5u*}" > "/proc/switch/$ifname/vlan/0/ports"
-
- } || port_net_echo $1
+ port_net_echo $1
}
diff --git a/target/linux/brcm63xx/base-files/lib/upgrade/platform.sh b/target/linux/brcm63xx/base-files/lib/upgrade/platform.sh
index 1a025f7d7..63ab77418 100644
--- a/target/linux/brcm63xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/brcm63xx/base-files/lib/upgrade/platform.sh
@@ -2,7 +2,7 @@ PART_NAME=linux
platform_check_image() {
[ "$ARGC" -gt 1 ] && return 1
case "$(get_magic_word "$1")" in
- 3600)
+ 3600|3700|3800)
# 6348GW-11 boards use openwrt-96348GW-11-squashfs-cfe.bin files
return 0
;;