aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2018-04-23 13:33:09 +0200
committerRafał Miłecki <rafal@milecki.pl>2018-04-23 13:33:09 +0200
commitb1f5dd34ed84b295a67934a64d2ab309db65b65e (patch)
tree69d4eb14420dd06861b8b5fe91d8dc9570d49164
parent751746c736bbda828ff1add002a0419a3b883e63 (diff)
downloadupstream-b1f5dd34ed84b295a67934a64d2ab309db65b65e.tar.gz
upstream-b1f5dd34ed84b295a67934a64d2ab309db65b65e.tar.bz2
upstream-b1f5dd34ed84b295a67934a64d2ab309db65b65e.zip
brcm47xx: backport upstream patches for Netgear WNR1000 V3
This includes fix for reading NVRAM content. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-rw-r--r--target/linux/brcm47xx/patches-4.14/032-MIPS-BCM47XX-Add-support-for-Netgear-WNR1000-V3.patch96
-rw-r--r--target/linux/brcm47xx/patches-4.14/033-firmware-bcm47xx_nvram-support-small-0x6000-B-NVRAM-.patch24
-rw-r--r--target/linux/brcm47xx/patches-4.14/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch48
-rw-r--r--target/linux/brcm47xx/patches-4.14/820-wgt634u-nvram-fix.patch2
-rw-r--r--target/linux/brcm47xx/patches-4.14/999-wl_exports.patch2
-rw-r--r--target/linux/brcm47xx/patches-4.4/033-MIPS-BCM47XX-Add-support-for-Netgear-WNR1000-V3.patch96
-rw-r--r--target/linux/brcm47xx/patches-4.4/034-firmware-bcm47xx_nvram-support-small-0x6000-B-NVRAM-.patch24
-rw-r--r--target/linux/brcm47xx/patches-4.4/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch48
-rw-r--r--target/linux/brcm47xx/patches-4.4/400-mtd-bcm47xxpart-get-nvram.patch2
-rw-r--r--target/linux/brcm47xx/patches-4.4/820-wgt634u-nvram-fix.patch2
-rw-r--r--target/linux/brcm47xx/patches-4.4/999-wl_exports.patch2
-rw-r--r--target/linux/brcm47xx/patches-4.9/033-MIPS-BCM47XX-Add-support-for-Netgear-WNR1000-V3.patch96
-rw-r--r--target/linux/brcm47xx/patches-4.9/034-firmware-bcm47xx_nvram-support-small-0x6000-B-NVRAM-.patch24
-rw-r--r--target/linux/brcm47xx/patches-4.9/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch48
-rw-r--r--target/linux/brcm47xx/patches-4.9/400-mtd-bcm47xxpart-get-nvram.patch2
-rw-r--r--target/linux/brcm47xx/patches-4.9/820-wgt634u-nvram-fix.patch2
-rw-r--r--target/linux/brcm47xx/patches-4.9/999-wl_exports.patch2
17 files changed, 383 insertions, 137 deletions
diff --git a/target/linux/brcm47xx/patches-4.14/032-MIPS-BCM47XX-Add-support-for-Netgear-WNR1000-V3.patch b/target/linux/brcm47xx/patches-4.14/032-MIPS-BCM47XX-Add-support-for-Netgear-WNR1000-V3.patch
new file mode 100644
index 0000000000..2f85e86553
--- /dev/null
+++ b/target/linux/brcm47xx/patches-4.14/032-MIPS-BCM47XX-Add-support-for-Netgear-WNR1000-V3.patch
@@ -0,0 +1,96 @@
+From 88b882ba0b0b7439d16d2c9df7f111cdf793443b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Sun, 8 Apr 2018 22:39:15 +0200
+Subject: [PATCH] MIPS: BCM47XX: Add support for Netgear WNR1000 V3
+
+This adds support for detecting this model board and registers some LEDs
+and buttons.
+
+There are two uncommon things regarding this device:
+1) It can use two different "board_id" ID values.
+ Unit I have uses "U12H139T00_NETGEAR" value. This magic is also used
+ in firmware file header. There are two reports (one from an OpenWrt
+ user) of a different "U12H139T50_NETGEAR" magic though.
+2) Power LEDs share GPIOs with buttons.
+ Amber one seems to share GPIO 2 with WPS button and green one seems
+ to share GPIO 3 with reset button. It remains unknown how to support
+ them and handle buttons at the same time. For that reason they aren't
+ added to the list of supported LEDs.
+---
+ arch/mips/bcm47xx/board.c | 2 ++
+ arch/mips/bcm47xx/buttons.c | 9 +++++++++
+ arch/mips/bcm47xx/leds.c | 9 +++++++++
+ arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h | 1 +
+ 4 files changed, 21 insertions(+)
+
+--- a/arch/mips/bcm47xx/board.c
++++ b/arch/mips/bcm47xx/board.c
+@@ -172,6 +172,8 @@ struct bcm47xx_board_type_list1 bcm47xx_
+ {{BCM47XX_BOARD_NETGEAR_WNDR4000, "Netgear WNDR4000"}, "U12H181T00_NETGEAR"},
+ {{BCM47XX_BOARD_NETGEAR_WNDR4500V1, "Netgear WNDR4500 V1"}, "U12H189T00_NETGEAR"},
+ {{BCM47XX_BOARD_NETGEAR_WNDR4500V2, "Netgear WNDR4500 V2"}, "U12H224T00_NETGEAR"},
++ {{BCM47XX_BOARD_NETGEAR_WNR1000_V3, "Netgear WNR1000 V3"}, "U12H139T00_NETGEAR"},
++ {{BCM47XX_BOARD_NETGEAR_WNR1000_V3, "Netgear WNR1000 V3"}, "U12H139T50_NETGEAR"},
+ {{BCM47XX_BOARD_NETGEAR_WNR2000, "Netgear WNR2000"}, "U12H114T00_NETGEAR"},
+ {{BCM47XX_BOARD_NETGEAR_WNR3500L, "Netgear WNR3500L"}, "U12H136T99_NETGEAR"},
+ {{BCM47XX_BOARD_NETGEAR_WNR3500U, "Netgear WNR3500U"}, "U12H136T00_NETGEAR"},
+--- a/arch/mips/bcm47xx/buttons.c
++++ b/arch/mips/bcm47xx/buttons.c
+@@ -412,6 +412,12 @@ bcm47xx_buttons_netgear_wndr4500v1[] __i
+ };
+
+ static const struct gpio_keys_button
++bcm47xx_buttons_netgear_wnr1000_v3[] __initconst = {
++ BCM47XX_GPIO_KEY(2, KEY_WPS_BUTTON),
++ BCM47XX_GPIO_KEY(3, KEY_RESTART),
++};
++
++static const struct gpio_keys_button
+ bcm47xx_buttons_netgear_wnr3500lv1[] __initconst = {
+ BCM47XX_GPIO_KEY(4, KEY_RESTART),
+ BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON),
+@@ -670,6 +676,9 @@ int __init bcm47xx_buttons_register(void
+ case BCM47XX_BOARD_NETGEAR_WNDR4500V1:
+ err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr4500v1);
+ break;
++ case BCM47XX_BOARD_NETGEAR_WNR1000_V3:
++ err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr1000_v3);
++ break;
+ case BCM47XX_BOARD_NETGEAR_WNR3500L:
+ err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr3500lv1);
+ break;
+--- a/arch/mips/bcm47xx/leds.c
++++ b/arch/mips/bcm47xx/leds.c
+@@ -498,6 +498,12 @@ bcm47xx_leds_netgear_wndr4500v1[] __init
+ };
+
+ static const struct gpio_led
++bcm47xx_leds_netgear_wnr1000_v3[] __initconst = {
++ BCM47XX_GPIO_LED(0, "blue", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF),
++ BCM47XX_GPIO_LED(1, "green", "wps", 0, LEDS_GPIO_DEFSTATE_OFF),
++};
++
++static const struct gpio_led
+ bcm47xx_leds_netgear_wnr3500lv1[] __initconst = {
+ BCM47XX_GPIO_LED(0, "blue", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
+ BCM47XX_GPIO_LED(1, "green", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
+@@ -758,6 +764,9 @@ void __init bcm47xx_leds_register(void)
+ case BCM47XX_BOARD_NETGEAR_WNDR4500V1:
+ bcm47xx_set_pdata(bcm47xx_leds_netgear_wndr4500v1);
+ break;
++ case BCM47XX_BOARD_NETGEAR_WNR1000_V3:
++ bcm47xx_set_pdata(bcm47xx_leds_netgear_wnr1000_v3);
++ break;
+ case BCM47XX_BOARD_NETGEAR_WNR3500L:
+ bcm47xx_set_pdata(bcm47xx_leds_netgear_wnr3500lv1);
+ break;
+--- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
++++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
+@@ -110,6 +110,7 @@ enum bcm47xx_board {
+ BCM47XX_BOARD_NETGEAR_WNDR4000,
+ BCM47XX_BOARD_NETGEAR_WNDR4500V1,
+ BCM47XX_BOARD_NETGEAR_WNDR4500V2,
++ BCM47XX_BOARD_NETGEAR_WNR1000_V3,
+ BCM47XX_BOARD_NETGEAR_WNR2000,
+ BCM47XX_BOARD_NETGEAR_WNR3500L,
+ BCM47XX_BOARD_NETGEAR_WNR3500U,
diff --git a/target/linux/brcm47xx/patches-4.14/033-firmware-bcm47xx_nvram-support-small-0x6000-B-NVRAM-.patch b/target/linux/brcm47xx/patches-4.14/033-firmware-bcm47xx_nvram-support-small-0x6000-B-NVRAM-.patch
new file mode 100644
index 0000000000..7c860bb7ed
--- /dev/null
+++ b/target/linux/brcm47xx/patches-4.14/033-firmware-bcm47xx_nvram-support-small-0x6000-B-NVRAM-.patch
@@ -0,0 +1,24 @@
+From 663beaeacf2552ed07405e69e96a18775e069eab Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Sun, 8 Apr 2018 22:51:08 +0200
+Subject: [PATCH] firmware: bcm47xx_nvram: support small (0x6000 B) NVRAM
+ partitions
+
+Some old devices with 4 MiB flashes were using 0x1000 block size and
+could use smaller (0x6000 bytes) flash partition for storing NVRAM
+content. This adds support for reading NVRAM on Netgear WNR1000 V3.
+---
+ drivers/firmware/broadcom/bcm47xx_nvram.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/firmware/broadcom/bcm47xx_nvram.c
++++ b/drivers/firmware/broadcom/bcm47xx_nvram.c
+@@ -36,7 +36,7 @@ struct nvram_header {
+
+ static char nvram_buf[NVRAM_SPACE];
+ static size_t nvram_len;
+-static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000};
++static const u32 nvram_sizes[] = {0x6000, 0x8000, 0xF000, 0x10000};
+
+ static u32 find_nvram_size(void __iomem *end)
+ {
diff --git a/target/linux/brcm47xx/patches-4.14/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch b/target/linux/brcm47xx/patches-4.14/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch
index f6b8d66bbc..74060e2181 100644
--- a/target/linux/brcm47xx/patches-4.14/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch
+++ b/target/linux/brcm47xx/patches-4.14/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch
@@ -21,14 +21,6 @@
{{BCM47XX_BOARD_NETGEAR_WNDR3300, "Netgear WNDR3300"}, "U12H093T00_NETGEAR"},
{{BCM47XX_BOARD_NETGEAR_WNDR3400V1, "Netgear WNDR3400 V1"}, "U12H155T00_NETGEAR"},
{{BCM47XX_BOARD_NETGEAR_WNDR3400V2, "Netgear WNDR3400 V2"}, "U12H187T00_NETGEAR"},
-@@ -172,6 +176,7 @@ struct bcm47xx_board_type_list1 bcm47xx_
- {{BCM47XX_BOARD_NETGEAR_WNDR4000, "Netgear WNDR4000"}, "U12H181T00_NETGEAR"},
- {{BCM47XX_BOARD_NETGEAR_WNDR4500V1, "Netgear WNDR4500 V1"}, "U12H189T00_NETGEAR"},
- {{BCM47XX_BOARD_NETGEAR_WNDR4500V2, "Netgear WNDR4500 V2"}, "U12H224T00_NETGEAR"},
-+ {{BCM47XX_BOARD_NETGEAR_WNR1000_V3, "Netgear WNR1000 V3"}, "U12H139T50_NETGEAR"},
- {{BCM47XX_BOARD_NETGEAR_WNR2000, "Netgear WNR2000"}, "U12H114T00_NETGEAR"},
- {{BCM47XX_BOARD_NETGEAR_WNR3500L, "Netgear WNR3500L"}, "U12H136T99_NETGEAR"},
- {{BCM47XX_BOARD_NETGEAR_WNR3500U, "Netgear WNR3500U"}, "U12H136T00_NETGEAR"},
--- a/arch/mips/bcm47xx/buttons.c
+++ b/arch/mips/bcm47xx/buttons.c
@@ -27,6 +27,12 @@
@@ -81,19 +73,7 @@
bcm47xx_buttons_netgear_wndr3400v1[] __initconst = {
BCM47XX_GPIO_KEY(4, KEY_RESTART),
BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON),
-@@ -412,6 +441,11 @@ bcm47xx_buttons_netgear_wndr4500v1[] __i
- };
-
- static const struct gpio_keys_button
-+bcm47xx_buttons_netgear_wnr1000_v3[] __initconst = {
-+ BCM47XX_GPIO_KEY(3, KEY_RESTART),
-+};
-+
-+static const struct gpio_keys_button
- bcm47xx_buttons_netgear_wnr3500lv1[] __initconst = {
- BCM47XX_GPIO_KEY(4, KEY_RESTART),
- BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON),
-@@ -465,6 +499,9 @@ int __init bcm47xx_buttons_register(void
+@@ -471,6 +500,9 @@ int __init bcm47xx_buttons_register(void
int err;
switch (board) {
@@ -103,7 +83,7 @@
case BCM47XX_BOARD_ASUS_RTN12:
err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn12);
break;
-@@ -595,6 +632,12 @@ int __init bcm47xx_buttons_register(void
+@@ -601,6 +633,12 @@ int __init bcm47xx_buttons_register(void
case BCM47XX_BOARD_LINKSYS_WRT310NV1:
err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt310nv1);
break;
@@ -116,7 +96,7 @@
case BCM47XX_BOARD_LINKSYS_WRT54G3GV2:
err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt54g3gv2);
break;
-@@ -658,6 +701,12 @@ int __init bcm47xx_buttons_register(void
+@@ -664,6 +702,12 @@ int __init bcm47xx_buttons_register(void
err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_wr850gv2v3);
break;
@@ -129,16 +109,6 @@
case BCM47XX_BOARD_NETGEAR_WNDR3400V1:
err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3400v1);
break;
-@@ -670,6 +719,9 @@ int __init bcm47xx_buttons_register(void
- case BCM47XX_BOARD_NETGEAR_WNDR4500V1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr4500v1);
- break;
-+ case BCM47XX_BOARD_NETGEAR_WNR1000_V3:
-+ err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr1000_v3);
-+ break;
- case BCM47XX_BOARD_NETGEAR_WNR3500L:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr3500lv1);
- break;
--- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
+++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
@@ -72,6 +72,7 @@ enum bcm47xx_board {
@@ -162,14 +132,6 @@
BCM47XX_BOARD_NETGEAR_WNDR3300,
BCM47XX_BOARD_NETGEAR_WNDR3400V1,
BCM47XX_BOARD_NETGEAR_WNDR3400V2,
-@@ -110,6 +114,7 @@ enum bcm47xx_board {
- BCM47XX_BOARD_NETGEAR_WNDR4000,
- BCM47XX_BOARD_NETGEAR_WNDR4500V1,
- BCM47XX_BOARD_NETGEAR_WNDR4500V2,
-+ BCM47XX_BOARD_NETGEAR_WNR1000_V3,
- BCM47XX_BOARD_NETGEAR_WNR2000,
- BCM47XX_BOARD_NETGEAR_WNR3500L,
- BCM47XX_BOARD_NETGEAR_WNR3500U,
--- a/arch/mips/bcm47xx/leds.c
+++ b/arch/mips/bcm47xx/leds.c
@@ -30,6 +30,14 @@
@@ -201,7 +163,7 @@
bcm47xx_leds_linksys_wrt54g_generic[] __initconst = {
BCM47XX_GPIO_LED(0, "unk", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF),
BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
-@@ -550,6 +565,9 @@ void __init bcm47xx_leds_register(void)
+@@ -556,6 +571,9 @@ void __init bcm47xx_leds_register(void)
enum bcm47xx_board board = bcm47xx_board_get();
switch (board) {
@@ -211,7 +173,7 @@
case BCM47XX_BOARD_ASUS_RTN12:
bcm47xx_set_pdata(bcm47xx_leds_asus_rtn12);
break;
-@@ -683,6 +701,9 @@ void __init bcm47xx_leds_register(void)
+@@ -689,6 +707,9 @@ void __init bcm47xx_leds_register(void)
case BCM47XX_BOARD_LINKSYS_WRT310NV1:
bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt310nv1);
break;
diff --git a/target/linux/brcm47xx/patches-4.14/820-wgt634u-nvram-fix.patch b/target/linux/brcm47xx/patches-4.14/820-wgt634u-nvram-fix.patch
index 4b726bb427..aaab39ae41 100644
--- a/target/linux/brcm47xx/patches-4.14/820-wgt634u-nvram-fix.patch
+++ b/target/linux/brcm47xx/patches-4.14/820-wgt634u-nvram-fix.patch
@@ -245,7 +245,7 @@ out the configuration than the in kernel cfe config reader.
@@ -37,6 +37,8 @@ struct nvram_header {
static char nvram_buf[NVRAM_SPACE];
static size_t nvram_len;
- static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000};
+ static const u32 nvram_sizes[] = {0x6000, 0x8000, 0xF000, 0x10000};
+static int cfe_env;
+extern char *cfe_env_get(char *nv_buf, const char *name);
diff --git a/target/linux/brcm47xx/patches-4.14/999-wl_exports.patch b/target/linux/brcm47xx/patches-4.14/999-wl_exports.patch
index 60ea1ea40c..2ecf651472 100644
--- a/target/linux/brcm47xx/patches-4.14/999-wl_exports.patch
+++ b/target/linux/brcm47xx/patches-4.14/999-wl_exports.patch
@@ -8,7 +8,7 @@
+char nvram_buf[NVRAM_SPACE];
+EXPORT_SYMBOL(nvram_buf);
static size_t nvram_len;
- static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000};
+ static const u32 nvram_sizes[] = {0x6000, 0x8000, 0xF000, 0x10000};
static int cfe_env;
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
diff --git a/target/linux/brcm47xx/patches-4.4/033-MIPS-BCM47XX-Add-support-for-Netgear-WNR1000-V3.patch b/target/linux/brcm47xx/patches-4.4/033-MIPS-BCM47XX-Add-support-for-Netgear-WNR1000-V3.patch
new file mode 100644
index 0000000000..e4c47605d9
--- /dev/null
+++ b/target/linux/brcm47xx/patches-4.4/033-MIPS-BCM47XX-Add-support-for-Netgear-WNR1000-V3.patch
@@ -0,0 +1,96 @@
+From 88b882ba0b0b7439d16d2c9df7f111cdf793443b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Sun, 8 Apr 2018 22:39:15 +0200
+Subject: [PATCH] MIPS: BCM47XX: Add support for Netgear WNR1000 V3
+
+This adds support for detecting this model board and registers some LEDs
+and buttons.
+
+There are two uncommon things regarding this device:
+1) It can use two different "board_id" ID values.
+ Unit I have uses "U12H139T00_NETGEAR" value. This magic is also used
+ in firmware file header. There are two reports (one from an OpenWrt
+ user) of a different "U12H139T50_NETGEAR" magic though.
+2) Power LEDs share GPIOs with buttons.
+ Amber one seems to share GPIO 2 with WPS button and green one seems
+ to share GPIO 3 with reset button. It remains unknown how to support
+ them and handle buttons at the same time. For that reason they aren't
+ added to the list of supported LEDs.
+---
+ arch/mips/bcm47xx/board.c | 2 ++
+ arch/mips/bcm47xx/buttons.c | 9 +++++++++
+ arch/mips/bcm47xx/leds.c | 9 +++++++++
+ arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h | 1 +
+ 4 files changed, 21 insertions(+)
+
+--- a/arch/mips/bcm47xx/board.c
++++ b/arch/mips/bcm47xx/board.c
+@@ -171,6 +171,8 @@ struct bcm47xx_board_type_list1 bcm47xx_
+ {{BCM47XX_BOARD_NETGEAR_WNDR4000, "Netgear WNDR4000"}, "U12H181T00_NETGEAR"},
+ {{BCM47XX_BOARD_NETGEAR_WNDR4500V1, "Netgear WNDR4500 V1"}, "U12H189T00_NETGEAR"},
+ {{BCM47XX_BOARD_NETGEAR_WNDR4500V2, "Netgear WNDR4500 V2"}, "U12H224T00_NETGEAR"},
++ {{BCM47XX_BOARD_NETGEAR_WNR1000_V3, "Netgear WNR1000 V3"}, "U12H139T00_NETGEAR"},
++ {{BCM47XX_BOARD_NETGEAR_WNR1000_V3, "Netgear WNR1000 V3"}, "U12H139T50_NETGEAR"},
+ {{BCM47XX_BOARD_NETGEAR_WNR2000, "Netgear WNR2000"}, "U12H114T00_NETGEAR"},
+ {{BCM47XX_BOARD_NETGEAR_WNR3500L, "Netgear WNR3500L"}, "U12H136T99_NETGEAR"},
+ {{BCM47XX_BOARD_NETGEAR_WNR3500U, "Netgear WNR3500U"}, "U12H136T00_NETGEAR"},
+--- a/arch/mips/bcm47xx/buttons.c
++++ b/arch/mips/bcm47xx/buttons.c
+@@ -411,6 +411,12 @@ bcm47xx_buttons_netgear_wndr4500v1[] __i
+ };
+
+ static const struct gpio_keys_button
++bcm47xx_buttons_netgear_wnr1000_v3[] __initconst = {
++ BCM47XX_GPIO_KEY(2, KEY_WPS_BUTTON),
++ BCM47XX_GPIO_KEY(3, KEY_RESTART),
++};
++
++static const struct gpio_keys_button
+ bcm47xx_buttons_netgear_wnr3500lv1[] __initconst = {
+ BCM47XX_GPIO_KEY(4, KEY_RESTART),
+ BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON),
+@@ -669,6 +675,9 @@ int __init bcm47xx_buttons_register(void
+ case BCM47XX_BOARD_NETGEAR_WNDR4500V1:
+ err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr4500v1);
+ break;
++ case BCM47XX_BOARD_NETGEAR_WNR1000_V3:
++ err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr1000_v3);
++ break;
+ case BCM47XX_BOARD_NETGEAR_WNR3500L:
+ err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr3500lv1);
+ break;
+--- a/arch/mips/bcm47xx/leds.c
++++ b/arch/mips/bcm47xx/leds.c
+@@ -497,6 +497,12 @@ bcm47xx_leds_netgear_wndr4500v1[] __init
+ };
+
+ static const struct gpio_led
++bcm47xx_leds_netgear_wnr1000_v3[] __initconst = {
++ BCM47XX_GPIO_LED(0, "blue", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF),
++ BCM47XX_GPIO_LED(1, "green", "wps", 0, LEDS_GPIO_DEFSTATE_OFF),
++};
++
++static const struct gpio_led
+ bcm47xx_leds_netgear_wnr3500lv1[] __initconst = {
+ BCM47XX_GPIO_LED(0, "blue", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
+ BCM47XX_GPIO_LED(1, "green", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
+@@ -757,6 +763,9 @@ void __init bcm47xx_leds_register(void)
+ case BCM47XX_BOARD_NETGEAR_WNDR4500V1:
+ bcm47xx_set_pdata(bcm47xx_leds_netgear_wndr4500v1);
+ break;
++ case BCM47XX_BOARD_NETGEAR_WNR1000_V3:
++ bcm47xx_set_pdata(bcm47xx_leds_netgear_wnr1000_v3);
++ break;
+ case BCM47XX_BOARD_NETGEAR_WNR3500L:
+ bcm47xx_set_pdata(bcm47xx_leds_netgear_wnr3500lv1);
+ break;
+--- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
++++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
+@@ -109,6 +109,7 @@ enum bcm47xx_board {
+ BCM47XX_BOARD_NETGEAR_WNDR4000,
+ BCM47XX_BOARD_NETGEAR_WNDR4500V1,
+ BCM47XX_BOARD_NETGEAR_WNDR4500V2,
++ BCM47XX_BOARD_NETGEAR_WNR1000_V3,
+ BCM47XX_BOARD_NETGEAR_WNR2000,
+ BCM47XX_BOARD_NETGEAR_WNR3500L,
+ BCM47XX_BOARD_NETGEAR_WNR3500U,
diff --git a/target/linux/brcm47xx/patches-4.4/034-firmware-bcm47xx_nvram-support-small-0x6000-B-NVRAM-.patch b/target/linux/brcm47xx/patches-4.4/034-firmware-bcm47xx_nvram-support-small-0x6000-B-NVRAM-.patch
new file mode 100644
index 0000000000..7c860bb7ed
--- /dev/null
+++ b/target/linux/brcm47xx/patches-4.4/034-firmware-bcm47xx_nvram-support-small-0x6000-B-NVRAM-.patch
@@ -0,0 +1,24 @@
+From 663beaeacf2552ed07405e69e96a18775e069eab Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Sun, 8 Apr 2018 22:51:08 +0200
+Subject: [PATCH] firmware: bcm47xx_nvram: support small (0x6000 B) NVRAM
+ partitions
+
+Some old devices with 4 MiB flashes were using 0x1000 block size and
+could use smaller (0x6000 bytes) flash partition for storing NVRAM
+content. This adds support for reading NVRAM on Netgear WNR1000 V3.
+---
+ drivers/firmware/broadcom/bcm47xx_nvram.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/firmware/broadcom/bcm47xx_nvram.c
++++ b/drivers/firmware/broadcom/bcm47xx_nvram.c
+@@ -36,7 +36,7 @@ struct nvram_header {
+
+ static char nvram_buf[NVRAM_SPACE];
+ static size_t nvram_len;
+-static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000};
++static const u32 nvram_sizes[] = {0x6000, 0x8000, 0xF000, 0x10000};
+
+ static u32 find_nvram_size(void __iomem *end)
+ {
diff --git a/target/linux/brcm47xx/patches-4.4/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch b/target/linux/brcm47xx/patches-4.4/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch
index c5f97ba493..d771081dd0 100644
--- a/target/linux/brcm47xx/patches-4.4/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch
+++ b/target/linux/brcm47xx/patches-4.4/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch
@@ -21,14 +21,6 @@
{{BCM47XX_BOARD_NETGEAR_WNDR3300, "Netgear WNDR3300"}, "U12H093T00_NETGEAR"},
{{BCM47XX_BOARD_NETGEAR_WNDR3400V1, "Netgear WNDR3400 V1"}, "U12H155T00_NETGEAR"},
{{BCM47XX_BOARD_NETGEAR_WNDR3400V2, "Netgear WNDR3400 V2"}, "U12H187T00_NETGEAR"},
-@@ -171,6 +175,7 @@ struct bcm47xx_board_type_list1 bcm47xx_
- {{BCM47XX_BOARD_NETGEAR_WNDR4000, "Netgear WNDR4000"}, "U12H181T00_NETGEAR"},
- {{BCM47XX_BOARD_NETGEAR_WNDR4500V1, "Netgear WNDR4500 V1"}, "U12H189T00_NETGEAR"},
- {{BCM47XX_BOARD_NETGEAR_WNDR4500V2, "Netgear WNDR4500 V2"}, "U12H224T00_NETGEAR"},
-+ {{BCM47XX_BOARD_NETGEAR_WNR1000_V3, "Netgear WNR1000 V3"}, "U12H139T50_NETGEAR"},
- {{BCM47XX_BOARD_NETGEAR_WNR2000, "Netgear WNR2000"}, "U12H114T00_NETGEAR"},
- {{BCM47XX_BOARD_NETGEAR_WNR3500L, "Netgear WNR3500L"}, "U12H136T99_NETGEAR"},
- {{BCM47XX_BOARD_NETGEAR_WNR3500U, "Netgear WNR3500U"}, "U12H136T00_NETGEAR"},
--- a/arch/mips/bcm47xx/buttons.c
+++ b/arch/mips/bcm47xx/buttons.c
@@ -26,6 +26,12 @@
@@ -81,19 +73,7 @@
bcm47xx_buttons_netgear_wndr3400v1[] __initconst = {
BCM47XX_GPIO_KEY(4, KEY_RESTART),
BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON),
-@@ -411,6 +440,11 @@ bcm47xx_buttons_netgear_wndr4500v1[] __i
- };
-
- static const struct gpio_keys_button
-+bcm47xx_buttons_netgear_wnr1000_v3[] __initconst = {
-+ BCM47XX_GPIO_KEY(3, KEY_RESTART),
-+};
-+
-+static const struct gpio_keys_button
- bcm47xx_buttons_netgear_wnr3500lv1[] __initconst = {
- BCM47XX_GPIO_KEY(4, KEY_RESTART),
- BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON),
-@@ -464,6 +498,9 @@ int __init bcm47xx_buttons_register(void
+@@ -470,6 +499,9 @@ int __init bcm47xx_buttons_register(void
int err;
switch (board) {
@@ -103,7 +83,7 @@
case BCM47XX_BOARD_ASUS_RTN12:
err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn12);
break;
-@@ -594,6 +631,12 @@ int __init bcm47xx_buttons_register(void
+@@ -600,6 +632,12 @@ int __init bcm47xx_buttons_register(void
case BCM47XX_BOARD_LINKSYS_WRT310NV1:
err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt310nv1);
break;
@@ -116,7 +96,7 @@
case BCM47XX_BOARD_LINKSYS_WRT54G3GV2:
err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt54g3gv2);
break;
-@@ -657,6 +700,12 @@ int __init bcm47xx_buttons_register(void
+@@ -663,6 +701,12 @@ int __init bcm47xx_buttons_register(void
err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_wr850gv2v3);
break;
@@ -129,16 +109,6 @@
case BCM47XX_BOARD_NETGEAR_WNDR3400V1:
err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3400v1);
break;
-@@ -669,6 +718,9 @@ int __init bcm47xx_buttons_register(void
- case BCM47XX_BOARD_NETGEAR_WNDR4500V1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr4500v1);
- break;
-+ case BCM47XX_BOARD_NETGEAR_WNR1000_V3:
-+ err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr1000_v3);
-+ break;
- case BCM47XX_BOARD_NETGEAR_WNR3500L:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr3500lv1);
- break;
--- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
+++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
@@ -71,6 +71,7 @@ enum bcm47xx_board {
@@ -162,14 +132,6 @@
BCM47XX_BOARD_NETGEAR_WNDR3300,
BCM47XX_BOARD_NETGEAR_WNDR3400V1,
BCM47XX_BOARD_NETGEAR_WNDR3400V2,
-@@ -109,6 +113,7 @@ enum bcm47xx_board {
- BCM47XX_BOARD_NETGEAR_WNDR4000,
- BCM47XX_BOARD_NETGEAR_WNDR4500V1,
- BCM47XX_BOARD_NETGEAR_WNDR4500V2,
-+ BCM47XX_BOARD_NETGEAR_WNR1000_V3,
- BCM47XX_BOARD_NETGEAR_WNR2000,
- BCM47XX_BOARD_NETGEAR_WNR3500L,
- BCM47XX_BOARD_NETGEAR_WNR3500U,
--- a/arch/mips/bcm47xx/leds.c
+++ b/arch/mips/bcm47xx/leds.c
@@ -29,6 +29,14 @@
@@ -201,7 +163,7 @@
bcm47xx_leds_linksys_wrt54g_generic[] __initconst = {
BCM47XX_GPIO_LED(0, "unk", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF),
BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
-@@ -549,6 +564,9 @@ void __init bcm47xx_leds_register(void)
+@@ -555,6 +570,9 @@ void __init bcm47xx_leds_register(void)
enum bcm47xx_board board = bcm47xx_board_get();
switch (board) {
@@ -211,7 +173,7 @@
case BCM47XX_BOARD_ASUS_RTN12:
bcm47xx_set_pdata(bcm47xx_leds_asus_rtn12);
break;
-@@ -682,6 +700,9 @@ void __init bcm47xx_leds_register(void)
+@@ -688,6 +706,9 @@ void __init bcm47xx_leds_register(void)
case BCM47XX_BOARD_LINKSYS_WRT310NV1:
bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt310nv1);
break;
diff --git a/target/linux/brcm47xx/patches-4.4/400-mtd-bcm47xxpart-get-nvram.patch b/target/linux/brcm47xx/patches-4.4/400-mtd-bcm47xxpart-get-nvram.patch
index 64184c079d..2b9290ddec 100644
--- a/target/linux/brcm47xx/patches-4.4/400-mtd-bcm47xxpart-get-nvram.patch
+++ b/target/linux/brcm47xx/patches-4.4/400-mtd-bcm47xxpart-get-nvram.patch
@@ -8,7 +8,7 @@
/*
* Some really old flashes (like AT45DB*) had smaller erasesize-s, but
-@@ -384,12 +385,23 @@ static int bcm47xxpart_parse(struct mtd_
+@@ -398,12 +399,23 @@ static int bcm47xxpart_parse(struct mtd_
if (buf[0] == NVRAM_HEADER) {
bcm47xxpart_add_part(&parts[curr_part++], "nvram",
master->size - blocksize, 0);
diff --git a/target/linux/brcm47xx/patches-4.4/820-wgt634u-nvram-fix.patch b/target/linux/brcm47xx/patches-4.4/820-wgt634u-nvram-fix.patch
index da0f56fd5b..08e7552163 100644
--- a/target/linux/brcm47xx/patches-4.4/820-wgt634u-nvram-fix.patch
+++ b/target/linux/brcm47xx/patches-4.4/820-wgt634u-nvram-fix.patch
@@ -244,7 +244,7 @@ out the configuration than the in kernel cfe config reader.
@@ -37,6 +37,8 @@ struct nvram_header {
static char nvram_buf[NVRAM_SPACE];
static size_t nvram_len;
- static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000};
+ static const u32 nvram_sizes[] = {0x6000, 0x8000, 0xF000, 0x10000};
+static int cfe_env;
+extern char *cfe_env_get(char *nv_buf, const char *name);
diff --git a/target/linux/brcm47xx/patches-4.4/999-wl_exports.patch b/target/linux/brcm47xx/patches-4.4/999-wl_exports.patch
index ea59f4f1db..02e399df73 100644
--- a/target/linux/brcm47xx/patches-4.4/999-wl_exports.patch
+++ b/target/linux/brcm47xx/patches-4.4/999-wl_exports.patch
@@ -8,7 +8,7 @@
+char nvram_buf[NVRAM_SPACE];
+EXPORT_SYMBOL(nvram_buf);
static size_t nvram_len;
- static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000};
+ static const u32 nvram_sizes[] = {0x6000, 0x8000, 0xF000, 0x10000};
static int cfe_env;
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
diff --git a/target/linux/brcm47xx/patches-4.9/033-MIPS-BCM47XX-Add-support-for-Netgear-WNR1000-V3.patch b/target/linux/brcm47xx/patches-4.9/033-MIPS-BCM47XX-Add-support-for-Netgear-WNR1000-V3.patch
new file mode 100644
index 0000000000..e4c47605d9
--- /dev/null
+++ b/target/linux/brcm47xx/patches-4.9/033-MIPS-BCM47XX-Add-support-for-Netgear-WNR1000-V3.patch
@@ -0,0 +1,96 @@
+From 88b882ba0b0b7439d16d2c9df7f111cdf793443b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Sun, 8 Apr 2018 22:39:15 +0200
+Subject: [PATCH] MIPS: BCM47XX: Add support for Netgear WNR1000 V3
+
+This adds support for detecting this model board and registers some LEDs
+and buttons.
+
+There are two uncommon things regarding this device:
+1) It can use two different "board_id" ID values.
+ Unit I have uses "U12H139T00_NETGEAR" value. This magic is also used
+ in firmware file header. There are two reports (one from an OpenWrt
+ user) of a different "U12H139T50_NETGEAR" magic though.
+2) Power LEDs share GPIOs with buttons.
+ Amber one seems to share GPIO 2 with WPS button and green one seems
+ to share GPIO 3 with reset button. It remains unknown how to support
+ them and handle buttons at the same time. For that reason they aren't
+ added to the list of supported LEDs.
+---
+ arch/mips/bcm47xx/board.c | 2 ++
+ arch/mips/bcm47xx/buttons.c | 9 +++++++++
+ arch/mips/bcm47xx/leds.c | 9 +++++++++
+ arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h | 1 +
+ 4 files changed, 21 insertions(+)
+
+--- a/arch/mips/bcm47xx/board.c
++++ b/arch/mips/bcm47xx/board.c
+@@ -171,6 +171,8 @@ struct bcm47xx_board_type_list1 bcm47xx_
+ {{BCM47XX_BOARD_NETGEAR_WNDR4000, "Netgear WNDR4000"}, "U12H181T00_NETGEAR"},
+ {{BCM47XX_BOARD_NETGEAR_WNDR4500V1, "Netgear WNDR4500 V1"}, "U12H189T00_NETGEAR"},
+ {{BCM47XX_BOARD_NETGEAR_WNDR4500V2, "Netgear WNDR4500 V2"}, "U12H224T00_NETGEAR"},
++ {{BCM47XX_BOARD_NETGEAR_WNR1000_V3, "Netgear WNR1000 V3"}, "U12H139T00_NETGEAR"},
++ {{BCM47XX_BOARD_NETGEAR_WNR1000_V3, "Netgear WNR1000 V3"}, "U12H139T50_NETGEAR"},
+ {{BCM47XX_BOARD_NETGEAR_WNR2000, "Netgear WNR2000"}, "U12H114T00_NETGEAR"},
+ {{BCM47XX_BOARD_NETGEAR_WNR3500L, "Netgear WNR3500L"}, "U12H136T99_NETGEAR"},
+ {{BCM47XX_BOARD_NETGEAR_WNR3500U, "Netgear WNR3500U"}, "U12H136T00_NETGEAR"},
+--- a/arch/mips/bcm47xx/buttons.c
++++ b/arch/mips/bcm47xx/buttons.c
+@@ -411,6 +411,12 @@ bcm47xx_buttons_netgear_wndr4500v1[] __i
+ };
+
+ static const struct gpio_keys_button
++bcm47xx_buttons_netgear_wnr1000_v3[] __initconst = {
++ BCM47XX_GPIO_KEY(2, KEY_WPS_BUTTON),
++ BCM47XX_GPIO_KEY(3, KEY_RESTART),
++};
++
++static const struct gpio_keys_button
+ bcm47xx_buttons_netgear_wnr3500lv1[] __initconst = {
+ BCM47XX_GPIO_KEY(4, KEY_RESTART),
+ BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON),
+@@ -669,6 +675,9 @@ int __init bcm47xx_buttons_register(void
+ case BCM47XX_BOARD_NETGEAR_WNDR4500V1:
+ err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr4500v1);
+ break;
++ case BCM47XX_BOARD_NETGEAR_WNR1000_V3:
++ err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr1000_v3);
++ break;
+ case BCM47XX_BOARD_NETGEAR_WNR3500L:
+ err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr3500lv1);
+ break;
+--- a/arch/mips/bcm47xx/leds.c
++++ b/arch/mips/bcm47xx/leds.c
+@@ -497,6 +497,12 @@ bcm47xx_leds_netgear_wndr4500v1[] __init
+ };
+
+ static const struct gpio_led
++bcm47xx_leds_netgear_wnr1000_v3[] __initconst = {
++ BCM47XX_GPIO_LED(0, "blue", "wlan", 0, LEDS_GPIO_DEFSTATE_OFF),
++ BCM47XX_GPIO_LED(1, "green", "wps", 0, LEDS_GPIO_DEFSTATE_OFF),
++};
++
++static const struct gpio_led
+ bcm47xx_leds_netgear_wnr3500lv1[] __initconst = {
+ BCM47XX_GPIO_LED(0, "blue", "wlan", 1, LEDS_GPIO_DEFSTATE_OFF),
+ BCM47XX_GPIO_LED(1, "green", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
+@@ -757,6 +763,9 @@ void __init bcm47xx_leds_register(void)
+ case BCM47XX_BOARD_NETGEAR_WNDR4500V1:
+ bcm47xx_set_pdata(bcm47xx_leds_netgear_wndr4500v1);
+ break;
++ case BCM47XX_BOARD_NETGEAR_WNR1000_V3:
++ bcm47xx_set_pdata(bcm47xx_leds_netgear_wnr1000_v3);
++ break;
+ case BCM47XX_BOARD_NETGEAR_WNR3500L:
+ bcm47xx_set_pdata(bcm47xx_leds_netgear_wnr3500lv1);
+ break;
+--- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
++++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
+@@ -109,6 +109,7 @@ enum bcm47xx_board {
+ BCM47XX_BOARD_NETGEAR_WNDR4000,
+ BCM47XX_BOARD_NETGEAR_WNDR4500V1,
+ BCM47XX_BOARD_NETGEAR_WNDR4500V2,
++ BCM47XX_BOARD_NETGEAR_WNR1000_V3,
+ BCM47XX_BOARD_NETGEAR_WNR2000,
+ BCM47XX_BOARD_NETGEAR_WNR3500L,
+ BCM47XX_BOARD_NETGEAR_WNR3500U,
diff --git a/target/linux/brcm47xx/patches-4.9/034-firmware-bcm47xx_nvram-support-small-0x6000-B-NVRAM-.patch b/target/linux/brcm47xx/patches-4.9/034-firmware-bcm47xx_nvram-support-small-0x6000-B-NVRAM-.patch
new file mode 100644
index 0000000000..7c860bb7ed
--- /dev/null
+++ b/target/linux/brcm47xx/patches-4.9/034-firmware-bcm47xx_nvram-support-small-0x6000-B-NVRAM-.patch
@@ -0,0 +1,24 @@
+From 663beaeacf2552ed07405e69e96a18775e069eab Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Sun, 8 Apr 2018 22:51:08 +0200
+Subject: [PATCH] firmware: bcm47xx_nvram: support small (0x6000 B) NVRAM
+ partitions
+
+Some old devices with 4 MiB flashes were using 0x1000 block size and
+could use smaller (0x6000 bytes) flash partition for storing NVRAM
+content. This adds support for reading NVRAM on Netgear WNR1000 V3.
+---
+ drivers/firmware/broadcom/bcm47xx_nvram.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/firmware/broadcom/bcm47xx_nvram.c
++++ b/drivers/firmware/broadcom/bcm47xx_nvram.c
+@@ -36,7 +36,7 @@ struct nvram_header {
+
+ static char nvram_buf[NVRAM_SPACE];
+ static size_t nvram_len;
+-static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000};
++static const u32 nvram_sizes[] = {0x6000, 0x8000, 0xF000, 0x10000};
+
+ static u32 find_nvram_size(void __iomem *end)
+ {
diff --git a/target/linux/brcm47xx/patches-4.9/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch b/target/linux/brcm47xx/patches-4.9/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch
index c5f97ba493..d771081dd0 100644
--- a/target/linux/brcm47xx/patches-4.9/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch
+++ b/target/linux/brcm47xx/patches-4.9/320-MIPS-BCM47XX-Devices-database-update-for-4.x.patch
@@ -21,14 +21,6 @@
{{BCM47XX_BOARD_NETGEAR_WNDR3300, "Netgear WNDR3300"}, "U12H093T00_NETGEAR"},
{{BCM47XX_BOARD_NETGEAR_WNDR3400V1, "Netgear WNDR3400 V1"}, "U12H155T00_NETGEAR"},
{{BCM47XX_BOARD_NETGEAR_WNDR3400V2, "Netgear WNDR3400 V2"}, "U12H187T00_NETGEAR"},
-@@ -171,6 +175,7 @@ struct bcm47xx_board_type_list1 bcm47xx_
- {{BCM47XX_BOARD_NETGEAR_WNDR4000, "Netgear WNDR4000"}, "U12H181T00_NETGEAR"},
- {{BCM47XX_BOARD_NETGEAR_WNDR4500V1, "Netgear WNDR4500 V1"}, "U12H189T00_NETGEAR"},
- {{BCM47XX_BOARD_NETGEAR_WNDR4500V2, "Netgear WNDR4500 V2"}, "U12H224T00_NETGEAR"},
-+ {{BCM47XX_BOARD_NETGEAR_WNR1000_V3, "Netgear WNR1000 V3"}, "U12H139T50_NETGEAR"},
- {{BCM47XX_BOARD_NETGEAR_WNR2000, "Netgear WNR2000"}, "U12H114T00_NETGEAR"},
- {{BCM47XX_BOARD_NETGEAR_WNR3500L, "Netgear WNR3500L"}, "U12H136T99_NETGEAR"},
- {{BCM47XX_BOARD_NETGEAR_WNR3500U, "Netgear WNR3500U"}, "U12H136T00_NETGEAR"},
--- a/arch/mips/bcm47xx/buttons.c
+++ b/arch/mips/bcm47xx/buttons.c
@@ -26,6 +26,12 @@
@@ -81,19 +73,7 @@
bcm47xx_buttons_netgear_wndr3400v1[] __initconst = {
BCM47XX_GPIO_KEY(4, KEY_RESTART),
BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON),
-@@ -411,6 +440,11 @@ bcm47xx_buttons_netgear_wndr4500v1[] __i
- };
-
- static const struct gpio_keys_button
-+bcm47xx_buttons_netgear_wnr1000_v3[] __initconst = {
-+ BCM47XX_GPIO_KEY(3, KEY_RESTART),
-+};
-+
-+static const struct gpio_keys_button
- bcm47xx_buttons_netgear_wnr3500lv1[] __initconst = {
- BCM47XX_GPIO_KEY(4, KEY_RESTART),
- BCM47XX_GPIO_KEY(6, KEY_WPS_BUTTON),
-@@ -464,6 +498,9 @@ int __init bcm47xx_buttons_register(void
+@@ -470,6 +499,9 @@ int __init bcm47xx_buttons_register(void
int err;
switch (board) {
@@ -103,7 +83,7 @@
case BCM47XX_BOARD_ASUS_RTN12:
err = bcm47xx_copy_bdata(bcm47xx_buttons_asus_rtn12);
break;
-@@ -594,6 +631,12 @@ int __init bcm47xx_buttons_register(void
+@@ -600,6 +632,12 @@ int __init bcm47xx_buttons_register(void
case BCM47XX_BOARD_LINKSYS_WRT310NV1:
err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt310nv1);
break;
@@ -116,7 +96,7 @@
case BCM47XX_BOARD_LINKSYS_WRT54G3GV2:
err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt54g3gv2);
break;
-@@ -657,6 +700,12 @@ int __init bcm47xx_buttons_register(void
+@@ -663,6 +701,12 @@ int __init bcm47xx_buttons_register(void
err = bcm47xx_copy_bdata(bcm47xx_buttons_motorola_wr850gv2v3);
break;
@@ -129,16 +109,6 @@
case BCM47XX_BOARD_NETGEAR_WNDR3400V1:
err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3400v1);
break;
-@@ -669,6 +718,9 @@ int __init bcm47xx_buttons_register(void
- case BCM47XX_BOARD_NETGEAR_WNDR4500V1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr4500v1);
- break;
-+ case BCM47XX_BOARD_NETGEAR_WNR1000_V3:
-+ err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr1000_v3);
-+ break;
- case BCM47XX_BOARD_NETGEAR_WNR3500L:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wnr3500lv1);
- break;
--- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
+++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
@@ -71,6 +71,7 @@ enum bcm47xx_board {
@@ -162,14 +132,6 @@
BCM47XX_BOARD_NETGEAR_WNDR3300,
BCM47XX_BOARD_NETGEAR_WNDR3400V1,
BCM47XX_BOARD_NETGEAR_WNDR3400V2,
-@@ -109,6 +113,7 @@ enum bcm47xx_board {
- BCM47XX_BOARD_NETGEAR_WNDR4000,
- BCM47XX_BOARD_NETGEAR_WNDR4500V1,
- BCM47XX_BOARD_NETGEAR_WNDR4500V2,
-+ BCM47XX_BOARD_NETGEAR_WNR1000_V3,
- BCM47XX_BOARD_NETGEAR_WNR2000,
- BCM47XX_BOARD_NETGEAR_WNR3500L,
- BCM47XX_BOARD_NETGEAR_WNR3500U,
--- a/arch/mips/bcm47xx/leds.c
+++ b/arch/mips/bcm47xx/leds.c
@@ -29,6 +29,14 @@
@@ -201,7 +163,7 @@
bcm47xx_leds_linksys_wrt54g_generic[] __initconst = {
BCM47XX_GPIO_LED(0, "unk", "dmz", 1, LEDS_GPIO_DEFSTATE_OFF),
BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
-@@ -549,6 +564,9 @@ void __init bcm47xx_leds_register(void)
+@@ -555,6 +570,9 @@ void __init bcm47xx_leds_register(void)
enum bcm47xx_board board = bcm47xx_board_get();
switch (board) {
@@ -211,7 +173,7 @@
case BCM47XX_BOARD_ASUS_RTN12:
bcm47xx_set_pdata(bcm47xx_leds_asus_rtn12);
break;
-@@ -682,6 +700,9 @@ void __init bcm47xx_leds_register(void)
+@@ -688,6 +706,9 @@ void __init bcm47xx_leds_register(void)
case BCM47XX_BOARD_LINKSYS_WRT310NV1:
bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt310nv1);
break;
diff --git a/target/linux/brcm47xx/patches-4.9/400-mtd-bcm47xxpart-get-nvram.patch b/target/linux/brcm47xx/patches-4.9/400-mtd-bcm47xxpart-get-nvram.patch
index 7e4ae20704..df9d434c9f 100644
--- a/target/linux/brcm47xx/patches-4.9/400-mtd-bcm47xxpart-get-nvram.patch
+++ b/target/linux/brcm47xx/patches-4.9/400-mtd-bcm47xxpart-get-nvram.patch
@@ -8,7 +8,7 @@
/*
* Some really old flashes (like AT45DB*) had smaller erasesize-s, but
-@@ -269,12 +270,23 @@ static int bcm47xxpart_parse(struct mtd_
+@@ -283,12 +284,23 @@ static int bcm47xxpart_parse(struct mtd_
if (buf[0] == NVRAM_HEADER) {
bcm47xxpart_add_part(&parts[curr_part++], "nvram",
master->size - blocksize, 0);
diff --git a/target/linux/brcm47xx/patches-4.9/820-wgt634u-nvram-fix.patch b/target/linux/brcm47xx/patches-4.9/820-wgt634u-nvram-fix.patch
index 867c6777cb..5c32211571 100644
--- a/target/linux/brcm47xx/patches-4.9/820-wgt634u-nvram-fix.patch
+++ b/target/linux/brcm47xx/patches-4.9/820-wgt634u-nvram-fix.patch
@@ -245,7 +245,7 @@ out the configuration than the in kernel cfe config reader.
@@ -37,6 +37,8 @@ struct nvram_header {
static char nvram_buf[NVRAM_SPACE];
static size_t nvram_len;
- static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000};
+ static const u32 nvram_sizes[] = {0x6000, 0x8000, 0xF000, 0x10000};
+static int cfe_env;
+extern char *cfe_env_get(char *nv_buf, const char *name);
diff --git a/target/linux/brcm47xx/patches-4.9/999-wl_exports.patch b/target/linux/brcm47xx/patches-4.9/999-wl_exports.patch
index ccad06da05..957e5885a9 100644
--- a/target/linux/brcm47xx/patches-4.9/999-wl_exports.patch
+++ b/target/linux/brcm47xx/patches-4.9/999-wl_exports.patch
@@ -8,7 +8,7 @@
+char nvram_buf[NVRAM_SPACE];
+EXPORT_SYMBOL(nvram_buf);
static size_t nvram_len;
- static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000};
+ static const u32 nvram_sizes[] = {0x6000, 0x8000, 0xF000, 0x10000};
static int cfe_env;
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c