aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/ar71xx/base-files/etc/defconfig/wndr3700v2/network69
-rw-r--r--target/linux/ar71xx/base-files/etc/defconfig/wndr3800/network69
-rwxr-xr-xtarget/linux/ar71xx/base-files/etc/diag.sh2
-rwxr-xr-xtarget/linux/ar71xx/base-files/etc/uci-defaults/leds4
-rwxr-xr-xtarget/linux/ar71xx/base-files/lib/ar71xx.sh52
-rwxr-xr-xtarget/linux/ar71xx/base-files/lib/upgrade/platform.sh14
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c132
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h4
-rw-r--r--target/linux/ar71xx/generic/profiles/netgear.mk4
-rw-r--r--target/linux/ar71xx/image/Makefile6
10 files changed, 59 insertions, 297 deletions
diff --git a/target/linux/ar71xx/base-files/etc/defconfig/wndr3700v2/network b/target/linux/ar71xx/base-files/etc/defconfig/wndr3700v2/network
deleted file mode 100644
index 69d7dc712b..0000000000
--- a/target/linux/ar71xx/base-files/etc/defconfig/wndr3700v2/network
+++ /dev/null
@@ -1,69 +0,0 @@
-config interface loopback
- option ifname lo
- option proto static
- option ipaddr 127.0.0.1
- option netmask 255.0.0.0
-
-config interface lan
- option ifname eth0.1
- option type bridge
- option proto static
- option ipaddr 192.168.1.1
- option netmask 255.255.255.0
-
-config interface wan
- option ifname eth1
- option proto dhcp
-
-config switch
- option name rtl8366s
- option reset 1
- option enable_vlan 1
- # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
- option blinkrate 2
-
-config switch_vlan
- option device rtl8366s
- option vlan 1
- option ports "0 1 2 3 5t"
-
-config switch_port
- # Port 1 controls the GREEN configuration of LEDs for
- # the switch and the section does not correspond to a real
- # switch port.
- #
- # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
- # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
- # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
- # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
- # 14: Link (master); 15: separate register
-
- option device rtl8366s
- option port 1
- option led 6
-
-config switch_port
- # Port 2 controls the ORANGE configuration of LEDs for
- # the switch and the section does not correspond to a real
- # switch port.
- #
- # See the key above for switch port 1 for the meaning of the
- # 'led' setting below.
-
- option device rtl8366s
- option port 2
- option led 9
-
-config switch_port
- # Port 5 controls the configuration of the WAN LED and the
- # section does not correspond to a real switch port.
- #
- # To toggle the use of green or orange LEDs for the WAN port,
- # see the LED setting for wndr3700:green:wan in /etc/config/system.
- #
- # See the key above for switch port 1 for the meaning of the
- # 'led' setting below.
-
- option device rtl8366s
- option port 5
- option led 2
diff --git a/target/linux/ar71xx/base-files/etc/defconfig/wndr3800/network b/target/linux/ar71xx/base-files/etc/defconfig/wndr3800/network
deleted file mode 100644
index 69d7dc712b..0000000000
--- a/target/linux/ar71xx/base-files/etc/defconfig/wndr3800/network
+++ /dev/null
@@ -1,69 +0,0 @@
-config interface loopback
- option ifname lo
- option proto static
- option ipaddr 127.0.0.1
- option netmask 255.0.0.0
-
-config interface lan
- option ifname eth0.1
- option type bridge
- option proto static
- option ipaddr 192.168.1.1
- option netmask 255.255.255.0
-
-config interface wan
- option ifname eth1
- option proto dhcp
-
-config switch
- option name rtl8366s
- option reset 1
- option enable_vlan 1
- # Blinkrate: 0=43ms; 1=84ms; 2=120ms; 3=170ms; 4=340ms; 5=670ms
- option blinkrate 2
-
-config switch_vlan
- option device rtl8366s
- option vlan 1
- option ports "0 1 2 3 5t"
-
-config switch_port
- # Port 1 controls the GREEN configuration of LEDs for
- # the switch and the section does not correspond to a real
- # switch port.
- #
- # 0=LED off; 1=Collision/FDX; 2=Link/activity; 3=1000 Mb/s;
- # 4=100 Mb/s; 5=10 Mb/s; 6=1000 Mb/s+activity; 7=100 Mb/s+activity;
- # 8=10 Mb/s+activity; 9=10/100 Mb/s+activity; 10: Fiber;
- # 11: Fault; 12: Link/activity(tx); 13: Link/activity(rx);
- # 14: Link (master); 15: separate register
-
- option device rtl8366s
- option port 1
- option led 6
-
-config switch_port
- # Port 2 controls the ORANGE configuration of LEDs for
- # the switch and the section does not correspond to a real
- # switch port.
- #
- # See the key above for switch port 1 for the meaning of the
- # 'led' setting below.
-
- option device rtl8366s
- option port 2
- option led 9
-
-config switch_port
- # Port 5 controls the configuration of the WAN LED and the
- # section does not correspond to a real switch port.
- #
- # To toggle the use of green or orange LEDs for the WAN port,
- # see the LED setting for wndr3700:green:wan in /etc/config/system.
- #
- # See the key above for switch port 1 for the meaning of the
- # 'led' setting below.
-
- option device rtl8366s
- option port 5
- option led 2
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index cb3b85177c..3af66b7e34 100755
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -111,7 +111,7 @@ get_status_led() {
wzr-hp-g300nh)
status_led="buffalo:green:router"
;;
- wndr3700 | wndr3700v2 | wndr3800)
+ wndr3700)
status_led="wndr3700:green:power"
;;
wnr2000)
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/leds b/target/linux/ar71xx/base-files/etc/uci-defaults/leds
index 0a724221cf..a0779effd8 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/leds
@@ -123,9 +123,7 @@ wrt160nl)
set_led_wlan "wlan" "WLAN" "wrt160nl:blue:wlan" "phy0tpt"
;;
-wndr3700 | \
-wndr3700v2 | \
-wndr3800)
+wndr3700)
set_led_default "wan" "WAN LED (green)" "wndr3700:green:wan" "0"
set_led_usbdev "usb" "USB" "wndr3700:green:usb" "1-1"
;;
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 02286e9aab..22e951d143 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -6,6 +6,48 @@
AR71XX_BOARD_NAME=
AR71XX_MODEL=
+ar71xx_get_mem_total() {
+ $(awk '/MemTotal:/ {print($2)}' /proc/meminfo)
+}
+
+ar71xx_get_mtd_part_magic() {
+ local part="$1"
+ local mtd
+
+ mtd=$(find_mtd_part $part)
+ [ -z "$mtd" ] && return
+
+ dd if=$mtd bs=4 count=1 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
+}
+
+wndr3700_board_detect() {
+ local machine="$1"
+ local magic
+ local name
+
+ name="wndr3700"
+
+ magic="$(ar71xx_get_mtd_part_magic firmware)"
+ case $magic in
+ "33373030")
+ machine="NETGEAR WNDR3700"
+ ;;
+ "33373031")
+ local mt
+
+ mt=$(ar71xx_get_mem_total)
+ if [ "$mt" -lt "65536" ]; then
+ machine="NETGEAR WNDR3700v2"
+ else
+ machine="NETGEAR WNDR3800"
+ fi
+ ;;
+ esac
+
+ AR71XX_BOARD_NAME="$name"
+ AR71XX_MODEL="$machine"
+}
+
ar71xx_board_detect() {
local machine
local name
@@ -169,14 +211,8 @@ ar71xx_board_detect() {
*WP543)
name="wp543"
;;
- *WNDR3700)
- name="wndr3700"
- ;;
- *WNDR3700v2)
- name="wndr3700v2"
- ;;
- *WNDR3800)
- name="wndr3800"
+ *"WNDR3700/WNDR3800")
+ wndr3700_board_detect "$machine"
;;
*WNR2000)
name="wnr2000"
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index cc327e6a1c..1de9077158 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -127,15 +127,11 @@ platform_check_image() {
return 0
;;
wndr3700)
- [ "$magic_long" != "33373030" ] && {
- echo "Invalid image type."
- return 1
- }
- return 0
- ;;
- wndr3700v2|wndr3800)
- [ "$magic_long" != "33373031" ] && {
- echo "Invalid image type."
+ local hw_magic
+
+ hw_magic="$(ar71xx_get_mtd_part_magic firmware)"
+ [ "$magic_long" != "$hw_magic" ] && {
+ echo "Invalid image, hardware ID mismatch, hw:$hw_magic image:$magic_long."
return 1
}
return 0
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c
index 358f1a9f38..568dac917d 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wndr3700.c
@@ -49,113 +49,6 @@
#define WNDR3700_CALDATA0_OFFSET 0x1000
#define WNDR3700_CALDATA1_OFFSET 0x5000
-#ifdef CONFIG_MTD_PARTITIONS
-static struct mtd_partition wndr3700_partitions[] = {
- {
- .name = "uboot",
- .offset = 0,
- .size = 0x050000,
- .mask_flags = MTD_WRITEABLE,
- }, {
- .name = "env",
- .offset = 0x050000,
- .size = 0x020000,
- .mask_flags = MTD_WRITEABLE,
- }, {
- .name = "rootfs",
- .offset = 0x070000,
- .size = 0x720000,
- }, {
- .name = "config",
- .offset = 0x790000,
- .size = 0x010000,
- .mask_flags = MTD_WRITEABLE,
- }, {
- .name = "config_bak",
- .offset = 0x7a0000,
- .size = 0x010000,
- .mask_flags = MTD_WRITEABLE,
- }, {
- .name = "pot",
- .offset = 0x7b0000,
- .size = 0x010000,
- .mask_flags = MTD_WRITEABLE,
- }, {
- .name = "traffic_meter",
- .offset = 0x7c0000,
- .size = 0x010000,
- .mask_flags = MTD_WRITEABLE,
- }, {
- .name = "language",
- .offset = 0x7d0000,
- .size = 0x020000,
- .mask_flags = MTD_WRITEABLE,
- }, {
- .name = "caldata",
- .offset = 0x7f0000,
- .size = 0x010000,
- .mask_flags = MTD_WRITEABLE,
- }
-};
-
-static struct mtd_partition wndr3700v2_partitions[] = {
- {
- .name = "uboot",
- .offset = 0,
- .size = 0x050000,
- .mask_flags = MTD_WRITEABLE,
- }, {
- .name = "env",
- .offset = 0x050000,
- .size = 0x020000,
- .mask_flags = MTD_WRITEABLE,
- }, {
- .name = "rootfs",
- .offset = 0x070000,
- .size = 0xe40000,
- }, {
- .name = "config",
- .offset = 0xeb0000,
- .size = 0x010000,
- .mask_flags = MTD_WRITEABLE,
- }, {
- .name = "config_bak",
- .offset = 0xec0000,
- .size = 0x010000,
- .mask_flags = MTD_WRITEABLE,
- }, {
- .name = "pot",
- .offset = 0xed0000,
- .size = 0x010000,
- .mask_flags = MTD_WRITEABLE,
- }, {
- .name = "traffic_meter",
- .offset = 0xee0000,
- .size = 0x010000,
- .mask_flags = MTD_WRITEABLE,
- }, {
- .name = "language",
- .offset = 0xef0000,
- .size = 0x100000,
- .mask_flags = MTD_WRITEABLE,
- }, {
- .name = "caldata",
- .offset = 0xff0000,
- .size = 0x010000,
- .mask_flags = MTD_WRITEABLE,
- }
-};
-#define wndr3700_num_partitions ARRAY_SIZE(wndr3700_partitions)
-#define wndr3700v2_num_partitions ARRAY_SIZE(wndr3700v2_partitions)
-#else
-#define wndr3700_partitions NULL
-#define wndr3700_num_partitions 0
-#define wndr3700v2_partitions NULL
-#define wndr3700v2_num_partitions 0
-#endif /* CONFIG_MTD_PARTITIONS */
-
-static struct flash_platform_data wndr3700_flash_data;
-
static struct gpio_led wndr3700_leds_gpio[] __initdata = {
{
.name = "wndr3700:green:power",
@@ -218,7 +111,7 @@ static struct platform_device wndr3700_rtl8366s_device = {
}
};
-static void __init wndr3700_common_setup(void)
+static void __init wndr3700_setup(void)
{
u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
@@ -242,7 +135,7 @@ static void __init wndr3700_common_setup(void)
ar71xx_add_device_usb();
- ar71xx_add_device_m25p80(&wndr3700_flash_data);
+ ar71xx_add_device_m25p80(NULL);
ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wndr3700_leds_gpio),
wndr3700_leds_gpio);
@@ -269,24 +162,5 @@ static void __init wndr3700_common_setup(void)
art + WNDR3700_WMAC1_MAC_OFFSET);
}
-static void __init wndr3700_setup(void)
-{
- wndr3700_flash_data.parts = wndr3700_partitions,
- wndr3700_flash_data.nr_parts = wndr3700_num_partitions,
- wndr3700_common_setup();
-}
-
-MIPS_MACHINE(AR71XX_MACH_WNDR3700, "WNDR3700", "NETGEAR WNDR3700",
+MIPS_MACHINE(AR71XX_MACH_WNDR3700, "WNDR3700", "NETGEAR WNDR3700/WNDR3800",
wndr3700_setup);
-
-static void __init wndr3700v2_setup(void)
-{
- wndr3700_flash_data.parts = wndr3700v2_partitions,
- wndr3700_flash_data.nr_parts = wndr3700v2_num_partitions,
- wndr3700_common_setup();
-}
-
-MIPS_MACHINE(AR71XX_MACH_WNDR3700V2, "WNDR3700v2", "NETGEAR WNDR3700v2",
- wndr3700v2_setup);
-MIPS_MACHINE(AR71XX_MACH_WNDR3800, "WNDR3800", "NETGEAR WNDR3800",
- wndr3700v2_setup);
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h b/target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h
index 6b2c160c96..d755a7ae5f 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/machtype.h
@@ -69,9 +69,7 @@ enum ar71xx_mach_type {
AR71XX_MACH_WHR_G301N, /* Buffalo WHR-G301N */
AR71XX_MACH_WHR_HP_G300N, /* Buffalo WHR-HP-G300N */
AR71XX_MACH_WHR_HP_GN, /* Buffalo WHR-HP-GN */
- AR71XX_MACH_WNDR3700, /* NETGEAR WNDR3700 */
- AR71XX_MACH_WNDR3700V2, /* NETGEAR WNDR3700v2 */
- AR71XX_MACH_WNDR3800, /* NETGEAR WNDR3800 */
+ AR71XX_MACH_WNDR3700, /* NETGEAR WNDR3700/WNDR3800 */
AR71XX_MACH_WNR2000, /* NETGEAR WNR2000 */
AR71XX_MACH_WP543, /* Compex WP543 */
AR71XX_MACH_WRT160NL, /* Linksys WRT160NL */
diff --git a/target/linux/ar71xx/generic/profiles/netgear.mk b/target/linux/ar71xx/generic/profiles/netgear.mk
index 438d03bba3..78dba9762a 100644
--- a/target/linux/ar71xx/generic/profiles/netgear.mk
+++ b/target/linux/ar71xx/generic/profiles/netgear.mk
@@ -6,12 +6,12 @@
#
define Profile/WNDR3700
- NAME:=NETGEAR WNDR3700
+ NAME:=NETGEAR WNDR3700/3800
PACKAGES:=kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-ledtrig-usbdev
endef
define Profile/WNDR3700/Description
- Package set optimized for the NETGEAR WNDR3700
+ Package set optimized for the NETGEAR WNDR3700/3800
endef
$(eval $(call Profile,WNDR3700))
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index 32c1b24c17..2394e99380 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -759,13 +759,11 @@ endef
wndr3700_cmdline=board=WNDR3700 console=ttyS0,115200
wndr3700_mtdlayout=mtdparts=spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,1024k(kernel),6656k(rootfs),64k(art)ro,7680k@0x70000(firmware)
-wndr3700v2_cmdline=board=WNDR3700v2 console=ttyS0,115200
wndr3700v2_mtdlayout=mtdparts=spi0.0:320k(u-boot)ro,128k(u-boot-env)ro,1024k(kernel),14848k(rootfs),64k(art)ro,15872k@0x70000(firmware)
-wndr3800_cmdline=board=WNDR3800 console=ttyS0,115200
define Image/Build/Profile/WNDR3700
$(call Image/Build/Template/$(fs_64k)/$(1),Netgear,wndr3700,$(wndr3700_cmdline),$(wndr3700_mtdlayout),3700,WNDR3700,"" NA,)
- $(call Image/Build/Template/$(fs_64k)/$(1),Netgear,wndr3700v2,$(wndr3700v2_cmdline),$(wndr3700v2_mtdlayout),3701,WNDR3700v2,"",-H 29763654+16+64)
- $(call Image/Build/Template/$(fs_64k)/$(1),Netgear,wndr3800,$(wndr3800_cmdline),$(wndr3700v2_mtdlayout),3701,WNDR3800,"",-H 29763654+16+128)
+ $(call Image/Build/Template/$(fs_64k)/$(1),Netgear,wndr3700v2,$(wndr3700_cmdline),$(wndr3700v2_mtdlayout),3701,WNDR3700,"",-H 29763654+16+64)
+ $(call Image/Build/Template/$(fs_64k)/$(1),Netgear,wndr3800,$(wndr3700_cmdline),$(wndr3700v2_mtdlayout),3701,WNDR3700,"",-H 29763654+16+128)
endef
wr400n_cmdline=board=WRT400N console=ttyS0,115200