aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
Diffstat (limited to 'target')
-rw-r--r--target/linux/brcm47xx/patches-3.18/031-02-MIPS-BCM47XX-Fix-detecting-Microsoft-MN-700-Asus-WL5.patch38
-rw-r--r--target/linux/brcm47xx/patches-3.18/031-03-MIPS-BCM47XX-Use-helpers-for-reading-NVRAM-content.patch56
-rw-r--r--target/linux/brcm47xx/patches-3.18/031-04-MIPS-BCM47XX-Use-strnchr-to-avoid-reading-out-of-the.patch45
-rw-r--r--target/linux/brcm47xx/patches-3.18/031-05-MIPS-BCM47xx-Move-NVRAM-header-to-the-include-linux.patch249
-rw-r--r--target/linux/brcm47xx/patches-3.18/031-06-MIPS-BCM47XX-Fix-coding-style-to-match-kernel-standa.patch277
-rw-r--r--target/linux/brcm47xx/patches-3.18/031-07-MIPS-BCM47XX-Include-io.h-directly-and-fix-brace-ind.patch43
-rw-r--r--target/linux/brcm47xx/patches-3.18/031-08-MIPS-BCM47XX-Increase-NVRAM-buffer-size-to-64-KiB.patch37
-rw-r--r--target/linux/brcm47xx/patches-3.18/031-09-MIPS-BCM47XX-Don-t-try-guessing-NVRAM-size-on-MTD-pa.patch79
-rw-r--r--target/linux/brcm47xx/patches-3.18/031-10-MIPS-BCM47xx-Keep-ID-entries-for-non-standard-device.patch101
-rw-r--r--target/linux/brcm47xx/patches-3.18/031-11-MIPS-BCM47xx-Devices-database-update-for-4.1-or-4.2.patch158
-rw-r--r--target/linux/brcm47xx/patches-3.18/031-12-MIPS-BCM47xx-Add-generic-function-filling-SPROM-entr.patch85
-rw-r--r--target/linux/brcm47xx/patches-3.18/031-13-MIPS-BCM47xx-Move-filling-most-of-SPROM-to-the-gener.patch717
-rw-r--r--target/linux/brcm47xx/patches-3.18/320-MIPS-BCM47XX-Devices-database-update-for-3.x.patch67
-rw-r--r--target/linux/brcm47xx/patches-3.18/820-wgt634u-nvram-fix.patch6
-rw-r--r--target/linux/brcm47xx/patches-3.18/830-huawei_e970_support.patch4
-rw-r--r--target/linux/brcm47xx/patches-3.18/980-wnr834b_no_cardbus_invariant.patch2
-rw-r--r--target/linux/brcm47xx/patches-3.18/999-wl_exports.patch2
17 files changed, 1892 insertions, 74 deletions
diff --git a/target/linux/brcm47xx/patches-3.18/031-02-MIPS-BCM47XX-Fix-detecting-Microsoft-MN-700-Asus-WL5.patch b/target/linux/brcm47xx/patches-3.18/031-02-MIPS-BCM47XX-Fix-detecting-Microsoft-MN-700-Asus-WL5.patch
new file mode 100644
index 0000000000..25125af197
--- /dev/null
+++ b/target/linux/brcm47xx/patches-3.18/031-02-MIPS-BCM47XX-Fix-detecting-Microsoft-MN-700-Asus-WL5.patch
@@ -0,0 +1,38 @@
+From e0c3678ae640db049f738f30b5f23cde740799ac Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
+Date: Wed, 1 Apr 2015 16:01:02 +0200
+Subject: [PATCH] MIPS: BCM47XX: Fix detecting Microsoft MN-700 & Asus WL500G
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Since the day of adding this code it was broken. We were iterating over
+a wrong array and checking for wrong NVRAM entry.
+
+Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
+Cc: linux-mips@linux-mips.org
+Cc: Hauke Mehrtens <hauke@hauke-m.de>
+Patchwork: https://patchwork.linux-mips.org/patch/9654/
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+---
+ arch/mips/bcm47xx/board.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/mips/bcm47xx/board.c b/arch/mips/bcm47xx/board.c
+index b3ae068..3fd369d 100644
+--- a/arch/mips/bcm47xx/board.c
++++ b/arch/mips/bcm47xx/board.c
+@@ -247,8 +247,8 @@ static __init const struct bcm47xx_board_type *bcm47xx_board_get_nvram(void)
+ }
+
+ if (bcm47xx_nvram_getenv("hardware_version", buf1, sizeof(buf1)) >= 0 &&
+- bcm47xx_nvram_getenv("boardtype", buf2, sizeof(buf2)) >= 0) {
+- for (e2 = bcm47xx_board_list_boot_hw; e2->value1; e2++) {
++ bcm47xx_nvram_getenv("boardnum", buf2, sizeof(buf2)) >= 0) {
++ for (e2 = bcm47xx_board_list_hw_version_num; e2->value1; e2++) {
+ if (!strstarts(buf1, e2->value1) &&
+ !strcmp(buf2, e2->value2))
+ return &e2->board;
+--
+1.8.4.5
+
diff --git a/target/linux/brcm47xx/patches-3.18/031-03-MIPS-BCM47XX-Use-helpers-for-reading-NVRAM-content.patch b/target/linux/brcm47xx/patches-3.18/031-03-MIPS-BCM47XX-Use-helpers-for-reading-NVRAM-content.patch
new file mode 100644
index 0000000000..a028d9d67e
--- /dev/null
+++ b/target/linux/brcm47xx/patches-3.18/031-03-MIPS-BCM47XX-Use-helpers-for-reading-NVRAM-content.patch
@@ -0,0 +1,56 @@
+From 23d2bc42aceb829eaf90c694941e4523c22865e8 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
+Date: Wed, 10 Dec 2014 11:49:53 +0100
+Subject: [PATCH] MIPS: BCM47XX: Use helpers for reading NVRAM content
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Also drop some unneeded memset-s.
+
+Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
+Cc: Hauke Mehrtens <hauke@hauke-m.de>
+Cc: Paul Walmsley <paul@pwsan.com>
+Cc: linux-mips@linux-mips.org
+Patchwork: https://patchwork.linux-mips.org/patch/8661/
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+---
+ arch/mips/bcm47xx/nvram.c | 7 ++-----
+ 1 file changed, 2 insertions(+), 5 deletions(-)
+
+diff --git a/arch/mips/bcm47xx/nvram.c b/arch/mips/bcm47xx/nvram.c
+index c5c381c..5e4ae04 100644
+--- a/arch/mips/bcm47xx/nvram.c
++++ b/arch/mips/bcm47xx/nvram.c
+@@ -91,7 +91,6 @@ static int nvram_find_and_copy(void __iomem *iobase, u32 lim)
+ return -ENXIO;
+
+ found:
+-
+ if (header->len > size)
+ pr_err("The nvram size accoridng to the header seems to be bigger than the partition on flash\n");
+ if (header->len > NVRAM_SPACE)
+@@ -101,10 +100,9 @@ found:
+ src = (u32 *) header;
+ dst = (u32 *) nvram_buf;
+ for (i = 0; i < sizeof(struct nvram_header); i += 4)
+- *dst++ = *src++;
++ *dst++ = __raw_readl(src++);
+ for (; i < header->len && i < NVRAM_SPACE && i < size; i += 4)
+- *dst++ = le32_to_cpu(*src++);
+- memset(dst, 0x0, NVRAM_SPACE - i);
++ *dst++ = readl(src++);
+
+ return 0;
+ }
+@@ -165,7 +163,6 @@ static int nvram_init(void)
+ err = mtd_read(mtd, from, len, &bytes_read, dst);
+ if (err)
+ return err;
+- memset(dst + bytes_read, 0x0, NVRAM_SPACE - bytes_read);
+
+ return 0;
+ }
+--
+1.8.4.5
+
diff --git a/target/linux/brcm47xx/patches-3.18/031-04-MIPS-BCM47XX-Use-strnchr-to-avoid-reading-out-of-the.patch b/target/linux/brcm47xx/patches-3.18/031-04-MIPS-BCM47XX-Use-strnchr-to-avoid-reading-out-of-the.patch
new file mode 100644
index 0000000000..7b16835ae9
--- /dev/null
+++ b/target/linux/brcm47xx/patches-3.18/031-04-MIPS-BCM47XX-Use-strnchr-to-avoid-reading-out-of-the.patch
@@ -0,0 +1,45 @@
+From 80aaaa8b93d860f828e2cf883f307894640765f0 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
+Date: Wed, 10 Dec 2014 11:49:54 +0100
+Subject: [PATCH] MIPS: BCM47XX: Use strnchr to avoid reading out of the buffer
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
+Cc: Hauke Mehrtens <hauke@hauke-m.de>
+Cc: Paul Walmsley <paul@pwsan.com>
+Cc: linux-mips@linux-mips.org
+Patchwork: https://patchwork.linux-mips.org/patch/8662/
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+---
+ arch/mips/bcm47xx/nvram.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/arch/mips/bcm47xx/nvram.c b/arch/mips/bcm47xx/nvram.c
+index 5e4ae04..d805d8a 100644
+--- a/arch/mips/bcm47xx/nvram.c
++++ b/arch/mips/bcm47xx/nvram.c
+@@ -175,7 +175,7 @@ static int nvram_init(void)
+ int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len)
+ {
+ char *var, *value, *end, *eq;
+- int err;
++ int data_left, err;
+
+ if (!name)
+ return -EINVAL;
+@@ -191,7 +191,9 @@ int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len)
+ end = nvram_buf + sizeof(nvram_buf) - 2;
+ end[0] = end[1] = '\0';
+ for (; *var; var = value + strlen(value) + 1) {
+- eq = strchr(var, '=');
++ data_left = end - var;
++
++ eq = strnchr(var, data_left, '=');
+ if (!eq)
+ break;
+ value = eq + 1;
+--
+1.8.4.5
+
diff --git a/target/linux/brcm47xx/patches-3.18/031-05-MIPS-BCM47xx-Move-NVRAM-header-to-the-include-linux.patch b/target/linux/brcm47xx/patches-3.18/031-05-MIPS-BCM47xx-Move-NVRAM-header-to-the-include-linux.patch
new file mode 100644
index 0000000000..d073a06d32
--- /dev/null
+++ b/target/linux/brcm47xx/patches-3.18/031-05-MIPS-BCM47xx-Move-NVRAM-header-to-the-include-linux.patch
@@ -0,0 +1,249 @@
+From 138173d4e826587da66c7d321da1a91283222536 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
+Date: Mon, 1 Dec 2014 07:58:18 +0100
+Subject: [PATCH] MIPS: BCM47xx: Move NVRAM header to the include/linux/.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+There are two reasons for having this header in the common place:
+1) Simplifying drivers that read NVRAM entries. We will be able to
+ safely call bcm47xx_nvram_* functions without #ifdef-s.
+2) Getting NVRAM driver out of MIPS arch code. This is needed to support
+ BCM5301X arch which also requires this NVRAM driver. Patch for that
+ will follow once we get is reviewed.
+
+Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
+Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
+Cc: linux-mips@linux-mips.org
+Cc: Arnd Bergmann <arnd@arndb.de>
+Cc: Paul Walmsley <paul@pwsan.com>
+Cc: linux-soc@vger.kernel.org
+Patchwork: https://patchwork.linux-mips.org/patch/8619/
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+---
+ arch/mips/bcm47xx/board.c | 2 +-
+ arch/mips/bcm47xx/nvram.c | 2 +-
+ arch/mips/bcm47xx/setup.c | 1 -
+ arch/mips/bcm47xx/sprom.c | 1 -
+ arch/mips/bcm47xx/time.c | 1 -
+ arch/mips/include/asm/mach-bcm47xx/bcm47xx.h | 1 +
+ arch/mips/include/asm/mach-bcm47xx/bcm47xx_nvram.h | 21 -------------
+ drivers/bcma/driver_mips.c | 2 +-
+ drivers/net/ethernet/broadcom/b44.c | 2 +-
+ drivers/net/ethernet/broadcom/bgmac.c | 2 +-
+ drivers/ssb/driver_chipcommon_pmu.c | 2 +-
+ drivers/ssb/driver_mipscore.c | 2 +-
+ include/linux/bcm47xx_nvram.h | 34 ++++++++++++++++++++++
+ 13 files changed, 42 insertions(+), 31 deletions(-)
+ delete mode 100644 arch/mips/include/asm/mach-bcm47xx/bcm47xx_nvram.h
+ create mode 100644 include/linux/bcm47xx_nvram.h
+
+diff --git a/arch/mips/bcm47xx/board.c b/arch/mips/bcm47xx/board.c
+index b3ae068..6e85130 100644
+--- a/arch/mips/bcm47xx/board.c
++++ b/arch/mips/bcm47xx/board.c
+@@ -1,8 +1,8 @@
+ #include <linux/errno.h>
+ #include <linux/export.h>
+ #include <linux/string.h>
++#include <bcm47xx.h>
+ #include <bcm47xx_board.h>
+-#include <bcm47xx_nvram.h>
+
+ struct bcm47xx_board_type {
+ const enum bcm47xx_board board;
+diff --git a/arch/mips/bcm47xx/nvram.c b/arch/mips/bcm47xx/nvram.c
+index d805d8a..7c77a88 100644
+--- a/arch/mips/bcm47xx/nvram.c
++++ b/arch/mips/bcm47xx/nvram.c
+@@ -16,7 +16,7 @@
+ #include <linux/kernel.h>
+ #include <linux/string.h>
+ #include <linux/mtd/mtd.h>
+-#include <bcm47xx_nvram.h>
++#include <linux/bcm47xx_nvram.h>
+
+ #define NVRAM_MAGIC 0x48534C46 /* 'FLSH' */
+ #define NVRAM_SPACE 0x8000
+diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
+index e43b504..b26c9c2 100644
+--- a/arch/mips/bcm47xx/setup.c
++++ b/arch/mips/bcm47xx/setup.c
+@@ -42,7 +42,6 @@
+ #include <asm/reboot.h>
+ #include <asm/time.h>
+ #include <bcm47xx.h>
+-#include <bcm47xx_nvram.h>
+ #include <bcm47xx_board.h>
+
+ union bcm47xx_bus bcm47xx_bus;
+diff --git a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c
+index eff9205..c114b02 100644
+--- a/arch/mips/bcm47xx/sprom.c
++++ b/arch/mips/bcm47xx/sprom.c
+@@ -27,7 +27,6 @@
+ */
+
+ #include <bcm47xx.h>
+-#include <bcm47xx_nvram.h>
+ #include <linux/if_ether.h>
+ #include <linux/etherdevice.h>
+
+diff --git a/arch/mips/bcm47xx/time.c b/arch/mips/bcm47xx/time.c
+index 2c85d92..5b46510 100644
+--- a/arch/mips/bcm47xx/time.c
++++ b/arch/mips/bcm47xx/time.c
+@@ -27,7 +27,6 @@
+ #include <linux/ssb/ssb.h>
+ #include <asm/time.h>
+ #include <bcm47xx.h>
+-#include <bcm47xx_nvram.h>
+ #include <bcm47xx_board.h>
+
+ void __init plat_time_init(void)
+diff --git a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
+index 7527c1d..8ed77f6 100644
+--- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
++++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
+@@ -22,6 +22,7 @@
+ #include <linux/ssb/ssb.h>
+ #include <linux/bcma/bcma.h>
+ #include <linux/bcma/bcma_soc.h>
++#include <linux/bcm47xx_nvram.h>
+
+ enum bcm47xx_bus_type {
+ #ifdef CONFIG_BCM47XX_SSB
+--- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_nvram.h
++++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_nvram.h
+@@ -1,21 +1 @@
+-/*
+- * Copyright (C) 2005, Broadcom Corporation
+- * Copyright (C) 2006, Felix Fietkau <nbd@openwrt.org>
+- *
+- * This program is free software; you can redistribute it and/or modify it
+- * under the terms of the GNU General Public License as published by the
+- * Free Software Foundation; either version 2 of the License, or (at your
+- * option) any later version.
+- */
+-
+-#ifndef __BCM47XX_NVRAM_H
+-#define __BCM47XX_NVRAM_H
+-
+-#include <linux/types.h>
+-#include <linux/kernel.h>
+-
+-int bcm47xx_nvram_init_from_mem(u32 base, u32 lim);
+-int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len);
+-int bcm47xx_nvram_gpio_pin(const char *name);
+-
+-#endif /* __BCM47XX_NVRAM_H */
++#include <linux/bcm47xx_nvram.h>
+diff --git a/drivers/bcma/driver_mips.c b/drivers/bcma/driver_mips.c
+index 04faf6d..24424f3 100644
+--- a/drivers/bcma/driver_mips.c
++++ b/drivers/bcma/driver_mips.c
+@@ -21,7 +21,7 @@
+ #include <linux/serial_reg.h>
+ #include <linux/time.h>
+ #ifdef CONFIG_BCM47XX
+-#include <bcm47xx_nvram.h>
++#include <linux/bcm47xx_nvram.h>
+ #endif
+
+ enum bcma_boot_dev {
+diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
+index bd5916a..77363d6 100644
+--- a/drivers/net/ethernet/broadcom/b44.c
++++ b/drivers/net/ethernet/broadcom/b44.c
+@@ -400,7 +400,7 @@ static void b44_set_flow_ctrl(struct b44 *bp, u32 local, u32 remote)
+ }
+
+ #ifdef CONFIG_BCM47XX
+-#include <bcm47xx_nvram.h>
++#include <linux/bcm47xx_nvram.h>
+ static void b44_wap54g10_workaround(struct b44 *bp)
+ {
+ char buf[20];
+diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
+index 0469f72..be059df 100644
+--- a/drivers/net/ethernet/broadcom/bgmac.c
++++ b/drivers/net/ethernet/broadcom/bgmac.c
+@@ -18,7 +18,7 @@
+ #include <linux/interrupt.h>
+ #include <linux/dma-mapping.h>
+ #include <linux/platform_data/b53.h>
+-#include <bcm47xx_nvram.h>
++#include <linux/bcm47xx_nvram.h>
+
+ static const struct bcma_device_id bgmac_bcma_tbl[] = {
+ BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_4706_MAC_GBIT, BCMA_ANY_REV, BCMA_ANY_CLASS),
+diff --git a/drivers/ssb/driver_chipcommon_pmu.c b/drivers/ssb/driver_chipcommon_pmu.c
+index 1173a09..0942841 100644
+--- a/drivers/ssb/driver_chipcommon_pmu.c
++++ b/drivers/ssb/driver_chipcommon_pmu.c
+@@ -14,7 +14,7 @@
+ #include <linux/delay.h>
+ #include <linux/export.h>
+ #ifdef CONFIG_BCM47XX
+-#include <bcm47xx_nvram.h>
++#include <linux/bcm47xx_nvram.h>
+ #endif
+
+ #include "ssb_private.h"
+diff --git a/drivers/ssb/driver_mipscore.c b/drivers/ssb/driver_mipscore.c
+index 7b986f9..f87efef 100644
+--- a/drivers/ssb/driver_mipscore.c
++++ b/drivers/ssb/driver_mipscore.c
+@@ -16,7 +16,7 @@
+ #include <linux/serial_reg.h>
+ #include <linux/time.h>
+ #ifdef CONFIG_BCM47XX
+-#include <bcm47xx_nvram.h>
++#include <linux/bcm47xx_nvram.h>
+ #endif
+
+ #include "ssb_private.h"
+diff --git a/include/linux/bcm47xx_nvram.h b/include/linux/bcm47xx_nvram.h
+new file mode 100644
+index 0000000..b12b07e
+--- /dev/null
++++ b/include/linux/bcm47xx_nvram.h
+@@ -0,0 +1,34 @@
++/*
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License as published by the
++ * Free Software Foundation; either version 2 of the License, or (at your
++ * option) any later version.
++ */
++
++#ifndef __BCM47XX_NVRAM_H
++#define __BCM47XX_NVRAM_H
++
++#include <linux/types.h>
++#include <linux/kernel.h>
++
++#ifdef CONFIG_BCM47XX
++int bcm47xx_nvram_init_from_mem(u32 base, u32 lim);
++int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len);
++int bcm47xx_nvram_gpio_pin(const char *name);
++#else
++static inline int bcm47xx_nvram_init_from_mem(u32 base, u32 lim)
++{
++ return -ENOTSUPP;
++};
++static inline int bcm47xx_nvram_getenv(const char *name, char *val,
++ size_t val_len)
++{
++ return -ENOTSUPP;
++};
++static inline int bcm47xx_nvram_gpio_pin(const char *name)
++{
++ return -ENOTSUPP;
++};
++#endif
++
++#endif /* __BCM47XX_NVRAM_H */
+--
+1.8.4.5
+
diff --git a/target/linux/brcm47xx/patches-3.18/031-06-MIPS-BCM47XX-Fix-coding-style-to-match-kernel-standa.patch b/target/linux/brcm47xx/patches-3.18/031-06-MIPS-BCM47XX-Fix-coding-style-to-match-kernel-standa.patch
new file mode 100644
index 0000000000..0e93447e30
--- /dev/null
+++ b/target/linux/brcm47xx/patches-3.18/031-06-MIPS-BCM47XX-Fix-coding-style-to-match-kernel-standa.patch
@@ -0,0 +1,277 @@
+From d548ca6b0784a99f0fcae397f115823ccd0361a5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
+Date: Wed, 10 Dec 2014 17:38:26 +0100
+Subject: [PATCH] MIPS: BCM47XX: Fix coding style to match kernel standards
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+[ralf@linux-mips.org: Fixed conflicts.]
+
+Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
+Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
+Cc: linux-mips@linux-mips.org
+Cc: Paul Walmsley <paul@pwsan.com>
+Patchwork: https://patchwork.linux-mips.org/patch/8665/
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+---
+ arch/mips/bcm47xx/bcm47xx_private.h | 4 ++++
+ arch/mips/bcm47xx/board.c | 3 +--
+ arch/mips/bcm47xx/nvram.c | 25 ++++++++++++++-----------
+ arch/mips/bcm47xx/prom.c | 3 +--
+ arch/mips/bcm47xx/serial.c | 8 ++++----
+ arch/mips/bcm47xx/setup.c | 12 ++++++------
+ arch/mips/bcm47xx/sprom.c | 8 ++++----
+ arch/mips/bcm47xx/time.c | 1 -
+ 8 files changed, 34 insertions(+), 30 deletions(-)
+
+diff --git a/arch/mips/bcm47xx/bcm47xx_private.h b/arch/mips/bcm47xx/bcm47xx_private.h
+index ea909a5..41796be 100644
+--- a/arch/mips/bcm47xx/bcm47xx_private.h
++++ b/arch/mips/bcm47xx/bcm47xx_private.h
+@@ -1,6 +1,10 @@
+ #ifndef LINUX_BCM47XX_PRIVATE_H_
+ #define LINUX_BCM47XX_PRIVATE_H_
+
++#ifndef pr_fmt
++#define pr_fmt(fmt) "bcm47xx: " fmt
++#endif
++
+ #include <linux/kernel.h>
+
+ /* prom.c */
+diff --git a/arch/mips/bcm47xx/board.c b/arch/mips/bcm47xx/board.c
+index 6e85130..d4a5a51 100644
+--- a/arch/mips/bcm47xx/board.c
++++ b/arch/mips/bcm47xx/board.c
+@@ -330,9 +330,8 @@ void __init bcm47xx_board_detect(void)
+ err = bcm47xx_nvram_getenv("boardtype", buf, sizeof(buf));
+
+ /* init of nvram failed, probably too early now */
+- if (err == -ENXIO) {
++ if (err == -ENXIO)
+ return;
+- }
+
+ board_detected = bcm47xx_board_get_nvram();
+ bcm47xx_board.board = board_detected->board;
+diff --git a/arch/mips/bcm47xx/nvram.c b/arch/mips/bcm47xx/nvram.c
+index 7c77a88..6a97732 100644
+--- a/arch/mips/bcm47xx/nvram.c
++++ b/arch/mips/bcm47xx/nvram.c
+@@ -18,8 +18,10 @@
+ #include <linux/mtd/mtd.h>
+ #include <linux/bcm47xx_nvram.h>
+
+-#define NVRAM_MAGIC 0x48534C46 /* 'FLSH' */
+-#define NVRAM_SPACE 0x8000
++#define NVRAM_MAGIC 0x48534C46 /* 'FLSH' */
++#define NVRAM_SPACE 0x8000
++#define NVRAM_MAX_GPIO_ENTRIES 32
++#define NVRAM_MAX_GPIO_VALUE_LEN 30
+
+ #define FLASH_MIN 0x00020000 /* Minimum flash size */
+
+@@ -97,8 +99,8 @@ found:
+ pr_err("nvram on flash (%i bytes) is bigger than the reserved space in memory, will just copy the first %i bytes\n",
+ header->len, NVRAM_SPACE);
+
+- src = (u32 *) header;
+- dst = (u32 *) nvram_buf;
++ src = (u32 *)header;
++ dst = (u32 *)nvram_buf;
+ for (i = 0; i < sizeof(struct nvram_header); i += 4)
+ *dst++ = __raw_readl(src++);
+ for (; i < header->len && i < NVRAM_SPACE && i < size; i += 4)
+@@ -189,7 +191,8 @@ int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len)
+ /* Look for name=value and return value */
+ var = &nvram_buf[sizeof(struct nvram_header)];
+ end = nvram_buf + sizeof(nvram_buf) - 2;
+- end[0] = end[1] = '\0';
++ end[0] = '\0';
++ end[1] = '\0';
+ for (; *var; var = value + strlen(value) + 1) {
+ data_left = end - var;
+
+@@ -197,11 +200,10 @@ int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len)
+ if (!eq)
+ break;
+ value = eq + 1;
+- if ((eq - var) == strlen(name) &&
+- strncmp(var, name, (eq - var)) == 0) {
++ if (eq - var == strlen(name) &&
++ strncmp(var, name, eq - var) == 0)
+ return snprintf(val, val_len, "%s", value);
+ }
+- }
+ return -ENOENT;
+ }
+ EXPORT_SYMBOL(bcm47xx_nvram_getenv);
+@@ -209,10 +211,11 @@ EXPORT_SYMBOL(bcm47xx_nvram_getenv);
+ int bcm47xx_nvram_gpio_pin(const char *name)
+ {
+ int i, err;
+- char nvram_var[10];
+- char buf[30];
++ char nvram_var[] = "gpioXX";
++ char buf[NVRAM_MAX_GPIO_VALUE_LEN];
+
+- for (i = 0; i < 32; i++) {
++ /* TODO: Optimize it to don't call getenv so many times */
++ for (i = 0; i < NVRAM_MAX_GPIO_ENTRIES; i++) {
+ err = snprintf(nvram_var, sizeof(nvram_var), "gpio%i", i);
+ if (err <= 0)
+ continue;
+diff --git a/arch/mips/bcm47xx/prom.c b/arch/mips/bcm47xx/prom.c
+index 1b170bf..ab698ba 100644
+--- a/arch/mips/bcm47xx/prom.c
++++ b/arch/mips/bcm47xx/prom.c
+@@ -35,7 +35,6 @@
+ #include <bcm47xx.h>
+ #include <bcm47xx_board.h>
+
+-
+ static char bcm47xx_system_type[20] = "Broadcom BCM47XX";
+
+ const char *get_system_type(void)
+@@ -83,7 +82,7 @@ static __init void prom_init_mem(void)
+ /* Loop condition may be not enough, off may be over 1 MiB */
+ if (off + mem >= max) {
+ mem = max;
+- printk(KERN_DEBUG "assume 128MB RAM\n");
++ pr_debug("Assume 128MB RAM\n");
+ break;
+ }
+ if (!memcmp(prom_init, prom_init + mem, 32))
+diff --git a/arch/mips/bcm47xx/serial.c b/arch/mips/bcm47xx/serial.c
+index 2f5bbd6..df761d3 100644
+--- a/arch/mips/bcm47xx/serial.c
++++ b/arch/mips/bcm47xx/serial.c
+@@ -36,8 +36,8 @@ static int __init uart8250_init_ssb(void)
+ struct plat_serial8250_port *p = &(uart8250_data[i]);
+ struct ssb_serial_port *ssb_port = &(mcore->serial_ports[i]);
+
+- p->mapbase = (unsigned int) ssb_port->regs;
+- p->membase = (void *) ssb_port->regs;
++ p->mapbase = (unsigned int)ssb_port->regs;
++ p->membase = (void *)ssb_port->regs;
+ p->irq = ssb_port->irq + 2;
+ p->uartclk = ssb_port->baud_base;
+ p->regshift = ssb_port->reg_shift;
+@@ -62,8 +62,8 @@ static int __init uart8250_init_bcma(void)
+ struct bcma_serial_port *bcma_port;
+ bcma_port = &(cc->serial_ports[i]);
+
+- p->mapbase = (unsigned int) bcma_port->regs;
+- p->membase = (void *) bcma_port->regs;
++ p->mapbase = (unsigned int)bcma_port->regs;
++ p->membase = (void *)bcma_port->regs;
+ p->irq = bcma_port->irq;
+ p->uartclk = bcma_port->baud_base;
+ p->regshift = bcma_port->reg_shift;
+diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
+index b26c9c2..82ff9fd 100644
+--- a/arch/mips/bcm47xx/setup.c
++++ b/arch/mips/bcm47xx/setup.c
+@@ -52,7 +52,7 @@ EXPORT_SYMBOL(bcm47xx_bus_type);
+
+ static void bcm47xx_machine_restart(char *command)
+ {
+- printk(KERN_ALERT "Please stand by while rebooting the system...\n");
++ pr_alert("Please stand by while rebooting the system...\n");
+ local_irq_disable();
+ /* Set the watchdog timer to reset immediately */
+ switch (bcm47xx_bus_type) {
+@@ -107,7 +107,7 @@ static int bcm47xx_get_invariants(struct ssb_bus *bus,
+ char buf[20];
+
+ /* Fill boardinfo structure */
+- memset(&(iv->boardinfo), 0 , sizeof(struct ssb_boardinfo));
++ memset(&iv->boardinfo, 0 , sizeof(struct ssb_boardinfo));
+
+ bcm47xx_fill_ssb_boardinfo(&iv->boardinfo, NULL);
+
+@@ -126,7 +126,7 @@ static void __init bcm47xx_register_ssb(void)
+ char buf[100];
+ struct ssb_mipscore *mcore;
+
+- err = ssb_bus_ssbbus_register(&(bcm47xx_bus.ssb), SSB_ENUM_BASE,
++ err = ssb_bus_ssbbus_register(&bcm47xx_bus.ssb, SSB_ENUM_BASE,
+ bcm47xx_get_invariants);
+ if (err)
+ panic("Failed to initialize SSB bus (err %d)", err);
+@@ -136,7 +136,7 @@ static void __init bcm47xx_register_ssb(void)
+ if (strstr(buf, "console=ttyS1")) {
+ struct ssb_serial_port port;
+
+- printk(KERN_DEBUG "Swapping serial ports!\n");
++ pr_debug("Swapping serial ports!\n");
+ /* swap serial ports */
+ memcpy(&port, &mcore->serial_ports[0], sizeof(port));
+ memcpy(&mcore->serial_ports[0], &mcore->serial_ports[1],
+@@ -168,7 +168,7 @@ void __init plat_mem_setup(void)
+ struct cpuinfo_mips *c = &current_cpu_data;
+
+ if ((c->cputype == CPU_74K) || (c->cputype == CPU_1074K)) {
+- printk(KERN_INFO "bcm47xx: using bcma bus\n");
++ pr_info("Using bcma bus\n");
+ #ifdef CONFIG_BCM47XX_BCMA
+ bcm47xx_bus_type = BCM47XX_BUS_TYPE_BCMA;
+ bcm47xx_sprom_register_fallbacks();
+@@ -179,7 +179,7 @@ void __init plat_mem_setup(void)
+ #endif
+ #endif
+ } else {
+- printk(KERN_INFO "bcm47xx: using ssb bus\n");
++ pr_info("Using ssb bus\n");
+ #ifdef CONFIG_BCM47XX_SSB
+ bcm47xx_bus_type = BCM47XX_BUS_TYPE_SSB;
+ bcm47xx_sprom_register_fallbacks();
+diff --git a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c
+index c114b02..5d32afc 100644
+--- a/arch/mips/bcm47xx/sprom.c
++++ b/arch/mips/bcm47xx/sprom.c
+@@ -780,8 +780,8 @@ void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix,
+ bcm47xx_fill_sprom_path_r4589(sprom, prefix, fallback);
+ break;
+ default:
+- pr_warn("Unsupported SPROM revision %d detected. Will extract"
+- " v1\n", sprom->revision);
++ pr_warn("Unsupported SPROM revision %d detected. Will extract v1\n",
++ sprom->revision);
+ sprom->revision = 1;
+ bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback);
+ bcm47xx_fill_sprom_r12389(sprom, prefix, fallback);
+@@ -828,7 +828,7 @@ static int bcm47xx_get_sprom_ssb(struct ssb_bus *bus, struct ssb_sprom *out)
+ bcm47xx_fill_sprom(out, prefix, false);
+ return 0;
+ } else {
+- pr_warn("bcm47xx: unable to fill SPROM for given bustype.\n");
++ pr_warn("Unable to fill SPROM for given bustype.\n");
+ return -EINVAL;
+ }
+ }
+@@ -893,7 +893,7 @@ static int bcm47xx_get_sprom_bcma(struct bcma_bus *bus, struct ssb_sprom *out)
+ }
+ return 0;
+ default:
+- pr_warn("bcm47xx: unable to fill SPROM for given bustype.\n");
++ pr_warn("Unable to fill SPROM for given bustype.\n");
+ return -EINVAL;
+ }
+ }
+diff --git a/arch/mips/bcm47xx/time.c b/arch/mips/bcm47xx/time.c
+index 5b46510..74224cf 100644
+--- a/arch/mips/bcm47xx/time.c
++++ b/arch/mips/bcm47xx/time.c
+@@ -22,7 +22,6 @@
+ * 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+-
+ #include <linux/init.h>
+ #include <linux/ssb/ssb.h>
+ #include <asm/time.h>
+--
+1.8.4.5
+
diff --git a/target/linux/brcm47xx/patches-3.18/031-07-MIPS-BCM47XX-Include-io.h-directly-and-fix-brace-ind.patch b/target/linux/brcm47xx/patches-3.18/031-07-MIPS-BCM47XX-Include-io.h-directly-and-fix-brace-ind.patch
new file mode 100644
index 0000000000..f7e404f6e3
--- /dev/null
+++ b/target/linux/brcm47xx/patches-3.18/031-07-MIPS-BCM47XX-Include-io.h-directly-and-fix-brace-ind.patch
@@ -0,0 +1,43 @@
+From 50c979109c484c07358a1ac75b99df36d563c132 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
+Date: Wed, 1 Apr 2015 08:23:03 +0200
+Subject: [PATCH] MIPS: BCM47XX: Include io.h directly and fix brace indent
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+We use IO functions like readl & ioremap_nocache, so include linux/io.h
+
+Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
+Cc: linux-mips@linux-mips.org
+Cc: Hauke Mehrtens <hauke@hauke-m.de>
+Patchwork: https://patchwork.linux-mips.org/patch/9650/
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+---
+ arch/mips/bcm47xx/nvram.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/arch/mips/bcm47xx/nvram.c b/arch/mips/bcm47xx/nvram.c
+index 6a97732..2357ea3 100644
+--- a/arch/mips/bcm47xx/nvram.c
++++ b/arch/mips/bcm47xx/nvram.c
+@@ -11,6 +11,7 @@
+ * option) any later version.
+ */
+
++#include <linux/io.h>
+ #include <linux/types.h>
+ #include <linux/module.h>
+ #include <linux/kernel.h>
+@@ -203,7 +204,7 @@ int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len)
+ if (eq - var == strlen(name) &&
+ strncmp(var, name, eq - var) == 0)
+ return snprintf(val, val_len, "%s", value);
+- }
++ }
+ return -ENOENT;
+ }
+ EXPORT_SYMBOL(bcm47xx_nvram_getenv);
+--
+1.8.4.5
+
diff --git a/target/linux/brcm47xx/patches-3.18/031-08-MIPS-BCM47XX-Increase-NVRAM-buffer-size-to-64-KiB.patch b/target/linux/brcm47xx/patches-3.18/031-08-MIPS-BCM47XX-Increase-NVRAM-buffer-size-to-64-KiB.patch
new file mode 100644
index 0000000000..af6ec8e891
--- /dev/null
+++ b/target/linux/brcm47xx/patches-3.18/031-08-MIPS-BCM47XX-Increase-NVRAM-buffer-size-to-64-KiB.patch
@@ -0,0 +1,37 @@
+From 6ab7c29099390b3d23c97f14498fd26a5ef6b22b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
+Date: Wed, 1 Apr 2015 08:23:04 +0200
+Subject: [PATCH] MIPS: BCM47XX: Increase NVRAM buffer size to 64 KiB
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+For years Broadcom devices use 64 KiB NVRAM partition size and some of
+them indeed have it filled in more than 50%. This change allows reading
+whole NVRAM e.g. on Netgear WNDR4500 and Netgear R8000.
+
+Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
+Cc: linux-mips@linux-mips.org
+Cc: Hauke Mehrtens <hauke@hauke-m.de>
+Patchwork: https://patchwork.linux-mips.org/patch/9651/
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+---
+ arch/mips/bcm47xx/nvram.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/mips/bcm47xx/nvram.c b/arch/mips/bcm47xx/nvram.c
+index 2357ea3..2ac7482 100644
+--- a/arch/mips/bcm47xx/nvram.c
++++ b/arch/mips/bcm47xx/nvram.c
+@@ -20,7 +20,7 @@
+ #include <linux/bcm47xx_nvram.h>
+
+ #define NVRAM_MAGIC 0x48534C46 /* 'FLSH' */
+-#define NVRAM_SPACE 0x8000
++#define NVRAM_SPACE 0x10000
+ #define NVRAM_MAX_GPIO_ENTRIES 32
+ #define NVRAM_MAX_GPIO_VALUE_LEN 30
+
+--
+1.8.4.5
+
diff --git a/target/linux/brcm47xx/patches-3.18/031-09-MIPS-BCM47XX-Don-t-try-guessing-NVRAM-size-on-MTD-pa.patch b/target/linux/brcm47xx/patches-3.18/031-09-MIPS-BCM47XX-Don-t-try-guessing-NVRAM-size-on-MTD-pa.patch
new file mode 100644
index 0000000000..50b9f2daca
--- /dev/null
+++ b/target/linux/brcm47xx/patches-3.18/031-09-MIPS-BCM47XX-Don-t-try-guessing-NVRAM-size-on-MTD-pa.patch
@@ -0,0 +1,79 @@
+From 40d12172c8a5c2f3fc39642fc564b053575cd000 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
+Date: Wed, 1 Apr 2015 08:23:05 +0200
+Subject: [PATCH] MIPS: BCM47XX: Don't try guessing NVRAM size on MTD partition
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+When dealing with whole flash content (bcm47xx_nvram_init_from_mem) we
+need to find NVRAM start trying various partition sizes (nvram_sizes).
+This is not needed when using MTD as we have direct partition access.
+
+Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
+Cc: linux-mips@linux-mips.org
+Cc: Hauke Mehrtens <hauke@hauke-m.de>
+Patchwork: https://patchwork.linux-mips.org/patch/9652/
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+---
+ arch/mips/bcm47xx/nvram.c | 36 ++++++++++++++----------------------
+ 1 file changed, 14 insertions(+), 22 deletions(-)
+
+diff --git a/arch/mips/bcm47xx/nvram.c b/arch/mips/bcm47xx/nvram.c
+index 2ac7482..ba632ff 100644
+--- a/arch/mips/bcm47xx/nvram.c
++++ b/arch/mips/bcm47xx/nvram.c
+@@ -139,36 +139,28 @@ static int nvram_init(void)
+ struct mtd_info *mtd;
+ struct nvram_header header;
+ size_t bytes_read;
+- int err, i;
++ int err;
+
+ mtd = get_mtd_device_nm("nvram");
+ if (IS_ERR(mtd))
+ return -ENODEV;
+
+- for (i = 0; i < ARRAY_SIZE(nvram_sizes); i++) {
+- loff_t from = mtd->size - nvram_sizes[i];
+-
+- if (from < 0)
+- continue;
+-
+- err = mtd_read(mtd, from, sizeof(header), &bytes_read,
+- (uint8_t *)&header);
+- if (!err && header.magic == NVRAM_MAGIC) {
+- u8 *dst = (uint8_t *)nvram_buf;
+- size_t len = header.len;
++ err = mtd_read(mtd, 0, sizeof(header), &bytes_read, (uint8_t *)&header);
++ if (!err && header.magic == NVRAM_MAGIC) {
++ u8 *dst = (uint8_t *)nvram_buf;
++ size_t len = header.len;
+
+- if (header.len > NVRAM_SPACE) {
+- pr_err("nvram on flash (%i bytes) is bigger than the reserved space in memory, will just copy the first %i bytes\n",
+- header.len, NVRAM_SPACE);
+- len = NVRAM_SPACE;
+- }
++ if (header.len > NVRAM_SPACE) {
++ pr_err("nvram on flash (%i bytes) is bigger than the reserved space in memory, will just copy the first %i bytes\n",
++ header.len, NVRAM_SPACE);
++ len = NVRAM_SPACE;
++ }
+
+- err = mtd_read(mtd, from, len, &bytes_read, dst);
+- if (err)
+- return err;
++ err = mtd_read(mtd, 0, len, &bytes_read, dst);
++ if (err)
++ return err;
+
+- return 0;
+- }
++ return 0;
+ }
+ #endif
+
+--
+1.8.4.5
+
diff --git a/target/linux/brcm47xx/patches-3.18/031-10-MIPS-BCM47xx-Keep-ID-entries-for-non-standard-device.patch b/target/linux/brcm47xx/patches-3.18/031-10-MIPS-BCM47xx-Keep-ID-entries-for-non-standard-device.patch
new file mode 100644
index 0000000000..1f7233b807
--- /dev/null
+++ b/target/linux/brcm47xx/patches-3.18/031-10-MIPS-BCM47xx-Keep-ID-entries-for-non-standard-device.patch
@@ -0,0 +1,101 @@
+From 7515c6f1da334184c3ece06e6f61461086d8e2b1 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
+Date: Wed, 1 Apr 2015 18:18:01 +0200
+Subject: [PATCH] MIPS: BCM47xx: Keep ID entries for non-standard devices
+ together
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
+Cc: linux-mips@linux-mips.org
+Cc: Hauke Mehrtens <hauke@hauke-m.de>
+Patchwork: https://patchwork.linux-mips.org/patch/9655/
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+---
+ arch/mips/bcm47xx/board.c | 48 ++++++++++++++++++++---------------------------
+ 1 file changed, 20 insertions(+), 28 deletions(-)
+
+diff --git a/arch/mips/bcm47xx/board.c b/arch/mips/bcm47xx/board.c
+index d4a5a51..f936dcc 100644
+--- a/arch/mips/bcm47xx/board.c
++++ b/arch/mips/bcm47xx/board.c
+@@ -40,20 +40,6 @@ struct bcm47xx_board_type_list1 bcm47xx_board_list_model_name[] __initconst = {
+ { {0}, NULL},
+ };
+
+-/* model_no */
+-static const
+-struct bcm47xx_board_type_list1 bcm47xx_board_list_model_no[] __initconst = {
+- {{BCM47XX_BOARD_ASUS_WL700GE, "Asus WL700"}, "WL700"},
+- { {0}, NULL},
+-};
+-
+-/* machine_name */
+-static const
+-struct bcm47xx_board_type_list1 bcm47xx_board_list_machine_name[] __initconst = {
+- {{BCM47XX_BOARD_LINKSYS_WRTSL54GS, "Linksys WRTSL54GS"}, "WRTSL54GS"},
+- { {0}, NULL},
+-};
+-
+ /* hardware_version */
+ static const
+ struct bcm47xx_board_type_list1 bcm47xx_board_list_hardware_version[] __initconst = {
+@@ -202,6 +188,18 @@ struct bcm47xx_board_type_list2 bcm47xx_board_list_board_type_rev[] __initconst
+ { {0}, NULL},
+ };
+
++/*
++ * Some devices don't use any common NVRAM entry for identification and they
++ * have only one model specific variable.
++ * They don't deserve own arrays, let's group them there using key-value array.
++ */
++static const
++struct bcm47xx_board_type_list2 bcm47xx_board_list_key_value[] __initconst = {
++ {{BCM47XX_BOARD_ASUS_WL700GE, "Asus WL700"}, "model_no", "WL700"},
++ {{BCM47XX_BOARD_LINKSYS_WRTSL54GS, "Linksys WRTSL54GS"}, "machine_name", "WRTSL54GS"},
++ { {0}, NULL},
++};
++
+ static const
+ struct bcm47xx_board_type bcm47xx_board_unknown[] __initconst = {
+ {BCM47XX_BOARD_UNKNOWN, "Unknown Board"},
+@@ -225,20 +223,6 @@ static __init const struct bcm47xx_board_type *bcm47xx_board_get_nvram(void)
+ }
+ }
+
+- if (bcm47xx_nvram_getenv("model_no", buf1, sizeof(buf1)) >= 0) {
+- for (e1 = bcm47xx_board_list_model_no; e1->value1; e1++) {
+- if (strstarts(buf1, e1->value1))
+- return &e1->board;
+- }
+- }
+-
+- if (bcm47xx_nvram_getenv("machine_name", buf1, sizeof(buf1)) >= 0) {
+- for (e1 = bcm47xx_board_list_machine_name; e1->value1; e1++) {
+- if (strstarts(buf1, e1->value1))
+- return &e1->board;
+- }
+- }
+-
+ if (bcm47xx_nvram_getenv("hardware_version", buf1, sizeof(buf1)) >= 0) {
+ for (e1 = bcm47xx_board_list_hardware_version; e1->value1; e1++) {
+ if (strstarts(buf1, e1->value1))
+@@ -314,6 +298,14 @@ static __init const struct bcm47xx_board_type *bcm47xx_board_get_nvram(void)
+ return &e2->board;
+ }
+ }
++
++ for (e2 = bcm47xx_board_list_key_value; e2->value1; e2++) {
++ if (bcm47xx_nvram_getenv(e2->value1, buf1, sizeof(buf1)) >= 0) {
++ if (!strcmp(buf1, e2->value2))
++ return &e2->board;
++ }
++ }
++
+ return bcm47xx_board_unknown;
+ }
+
+--
+1.8.4.5
+
diff --git a/target/linux/brcm47xx/patches-3.18/031-11-MIPS-BCM47xx-Devices-database-update-for-4.1-or-4.2.patch b/target/linux/brcm47xx/patches-3.18/031-11-MIPS-BCM47xx-Devices-database-update-for-4.1-or-4.2.patch
new file mode 100644
index 0000000000..e81a99f7c3
--- /dev/null
+++ b/target/linux/brcm47xx/patches-3.18/031-11-MIPS-BCM47xx-Devices-database-update-for-4.1-or-4.2.patch
@@ -0,0 +1,158 @@
+From 160f14312b0b7d35759535b1f60be79247b263c4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
+Date: Wed, 1 Apr 2015 18:18:02 +0200
+Subject: [PATCH] MIPS: BCM47xx: Devices database update for 4.1 (or 4.2?)
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
+Cc: linux-mips@linux-mips.org
+Cc: Hauke Mehrtens <hauke@hauke-m.de>
+Patchwork: https://patchwork.linux-mips.org/patch/9656/
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+---
+ arch/mips/bcm47xx/board.c | 4 ++++
+ arch/mips/bcm47xx/buttons.c | 18 ++++++++++++++++++
+ arch/mips/bcm47xx/leds.c | 10 ++++++++++
+ arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h | 4 ++++
+ 4 files changed, 36 insertions(+)
+
+diff --git a/arch/mips/bcm47xx/board.c b/arch/mips/bcm47xx/board.c
+index f936dcc..41b9736 100644
+--- a/arch/mips/bcm47xx/board.c
++++ b/arch/mips/bcm47xx/board.c
+@@ -151,9 +151,11 @@ static const
+ struct bcm47xx_board_type_list1 bcm47xx_board_list_board_id[] __initconst = {
+ {{BCM47XX_BOARD_NETGEAR_WGR614V8, "Netgear WGR614 V8"}, "U12H072T00_NETGEAR"},
+ {{BCM47XX_BOARD_NETGEAR_WGR614V9, "Netgear WGR614 V9"}, "U12H094T00_NETGEAR"},
++ {{BCM47XX_BOARD_NETGEAR_WGR614_V10, "Netgear WGR614 V10"}, "U12H139T01_NETGEAR"},
+ {{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"},
++ {{BCM47XX_BOARD_NETGEAR_WNDR3400_V3, "Netgear WNDR3400 V3"}, "U12H208T00_NETGEAR"},
+ {{BCM47XX_BOARD_NETGEAR_WNDR3400VCNA, "Netgear WNDR3400 Vcna"}, "U12H155T01_NETGEAR"},
+ {{BCM47XX_BOARD_NETGEAR_WNDR3700V3, "Netgear WNDR3700 V3"}, "U12H194T00_NETGEAR"},
+ {{BCM47XX_BOARD_NETGEAR_WNDR4000, "Netgear WNDR4000"}, "U12H181T00_NETGEAR"},
+@@ -196,6 +198,8 @@ struct bcm47xx_board_type_list2 bcm47xx_board_list_board_type_rev[] __initconst
+ static const
+ struct bcm47xx_board_type_list2 bcm47xx_board_list_key_value[] __initconst = {
+ {{BCM47XX_BOARD_ASUS_WL700GE, "Asus WL700"}, "model_no", "WL700"},
++ {{BCM47XX_BOARD_LINKSYS_WRT300N_V1, "Linksys WRT300N V1"}, "router_name", "WRT300N"},
++ {{BCM47XX_BOARD_LINKSYS_WRT600N_V11, "Linksys WRT600N V1.1"}, "Model_Name", "WRT600N"},
+ {{BCM47XX_BOARD_LINKSYS_WRTSL54GS, "Linksys WRTSL54GS"}, "machine_name", "WRTSL54GS"},
+ { {0}, NULL},
+ };
+diff --git a/arch/mips/bcm47xx/buttons.c b/arch/mips/bcm47xx/buttons.c
+index 913182b..276276a 100644
+--- a/arch/mips/bcm47xx/buttons.c
++++ b/arch/mips/bcm47xx/buttons.c
+@@ -252,6 +252,12 @@ bcm47xx_buttons_linksys_wrt160nv3[] __initconst = {
+ };
+
+ static const struct gpio_keys_button
++bcm47xx_buttons_linksys_wrt300n_v1[] __initconst = {
++ BCM47XX_GPIO_KEY(4, KEY_WPS_BUTTON),
++ BCM47XX_GPIO_KEY(6, KEY_RESTART),
++};
++
++static const struct gpio_keys_button
+ bcm47xx_buttons_linksys_wrt300nv11[] __initconst = {
+ BCM47XX_GPIO_KEY(4, KEY_UNKNOWN),
+ BCM47XX_GPIO_KEY(6, KEY_RESTART),
+@@ -327,6 +333,12 @@ bcm47xx_buttons_netgear_wndr3400v1[] __initconst = {
+ };
+
+ static const struct gpio_keys_button
++bcm47xx_buttons_netgear_wndr3400_v3[] __initconst = {
++ BCM47XX_GPIO_KEY(12, KEY_RESTART),
++ BCM47XX_GPIO_KEY(23, KEY_WPS_BUTTON),
++};
++
++static const struct gpio_keys_button
+ bcm47xx_buttons_netgear_wndr3700v3[] __initconst = {
+ BCM47XX_GPIO_KEY(2, KEY_RFKILL),
+ BCM47XX_GPIO_KEY(3, KEY_RESTART),
+@@ -516,6 +528,9 @@ int __init bcm47xx_buttons_register(void)
+ case BCM47XX_BOARD_LINKSYS_WRT160NV3:
+ err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt160nv3);
+ break;
++ case BCM47XX_BOARD_LINKSYS_WRT300N_V1:
++ err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt300n_v1);
++ break;
+ case BCM47XX_BOARD_LINKSYS_WRT300NV11:
+ err = bcm47xx_copy_bdata(bcm47xx_buttons_linksys_wrt300nv11);
+ break;
+@@ -557,6 +572,9 @@ int __init bcm47xx_buttons_register(void)
+ case BCM47XX_BOARD_NETGEAR_WNDR3400V1:
+ err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3400v1);
+ break;
++ case BCM47XX_BOARD_NETGEAR_WNDR3400_V3:
++ err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3400_v3);
++ break;
+ case BCM47XX_BOARD_NETGEAR_WNDR3700V3:
+ err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3700v3);
+ break;
+diff --git a/arch/mips/bcm47xx/leds.c b/arch/mips/bcm47xx/leds.c
+index 903a656..0e4ade3 100644
+--- a/arch/mips/bcm47xx/leds.c
++++ b/arch/mips/bcm47xx/leds.c
+@@ -292,6 +292,13 @@ bcm47xx_leds_linksys_wrt160nv3[] __initconst = {
+ };
+
+ static const struct gpio_led
++bcm47xx_leds_linksys_wrt300n_v1[] __initconst = {
++ BCM47XX_GPIO_LED(1, "green", "power", 0, LEDS_GPIO_DEFSTATE_ON),
++ BCM47XX_GPIO_LED(3, "amber", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
++ BCM47XX_GPIO_LED(5, "green", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
++};
++
++static const struct gpio_led
+ bcm47xx_leds_linksys_wrt300nv11[] __initconst = {
+ BCM47XX_GPIO_LED(1, "unk", "power", 0, LEDS_GPIO_DEFSTATE_ON),
+ BCM47XX_GPIO_LED(3, "amber", "wps", 1, LEDS_GPIO_DEFSTATE_OFF),
+@@ -585,6 +592,9 @@ void __init bcm47xx_leds_register(void)
+ case BCM47XX_BOARD_LINKSYS_WRT160NV3:
+ bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt160nv3);
+ break;
++ case BCM47XX_BOARD_LINKSYS_WRT300N_V1:
++ bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt300n_v1);
++ break;
+ case BCM47XX_BOARD_LINKSYS_WRT300NV11:
+ bcm47xx_set_pdata(bcm47xx_leds_linksys_wrt300nv11);
+ break;
+diff --git a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
+index 1f5643b..c41d1dc 100644
+--- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
++++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
+@@ -67,6 +67,7 @@ enum bcm47xx_board {
+ BCM47XX_BOARD_LINKSYS_WRT150NV11,
+ BCM47XX_BOARD_LINKSYS_WRT160NV1,
+ BCM47XX_BOARD_LINKSYS_WRT160NV3,
++ BCM47XX_BOARD_LINKSYS_WRT300N_V1,
+ BCM47XX_BOARD_LINKSYS_WRT300NV11,
+ BCM47XX_BOARD_LINKSYS_WRT310NV1,
+ BCM47XX_BOARD_LINKSYS_WRT310NV2,
+@@ -74,6 +75,7 @@ enum bcm47xx_board {
+ BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0101,
+ BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0467,
+ BCM47XX_BOARD_LINKSYS_WRT54G_TYPE_0708,
++ BCM47XX_BOARD_LINKSYS_WRT600N_V11,
+ BCM47XX_BOARD_LINKSYS_WRT610NV1,
+ BCM47XX_BOARD_LINKSYS_WRT610NV2,
+ BCM47XX_BOARD_LINKSYS_WRTSL54GS,
+@@ -86,9 +88,11 @@ enum bcm47xx_board {
+
+ BCM47XX_BOARD_NETGEAR_WGR614V8,
+ BCM47XX_BOARD_NETGEAR_WGR614V9,
++ BCM47XX_BOARD_NETGEAR_WGR614_V10,
+ BCM47XX_BOARD_NETGEAR_WNDR3300,
+ BCM47XX_BOARD_NETGEAR_WNDR3400V1,
+ BCM47XX_BOARD_NETGEAR_WNDR3400V2,
++ BCM47XX_BOARD_NETGEAR_WNDR3400_V3,
+ BCM47XX_BOARD_NETGEAR_WNDR3400VCNA,
+ BCM47XX_BOARD_NETGEAR_WNDR3700V3,
+ BCM47XX_BOARD_NETGEAR_WNDR4000,
+--
+1.8.4.5
+
diff --git a/target/linux/brcm47xx/patches-3.18/031-12-MIPS-BCM47xx-Add-generic-function-filling-SPROM-entr.patch b/target/linux/brcm47xx/patches-3.18/031-12-MIPS-BCM47xx-Add-generic-function-filling-SPROM-entr.patch
new file mode 100644
index 0000000000..eb994facff
--- /dev/null
+++ b/target/linux/brcm47xx/patches-3.18/031-12-MIPS-BCM47xx-Add-generic-function-filling-SPROM-entr.patch
@@ -0,0 +1,85 @@
+From d55a52ccf8f80cdf51af2c5c6e56c825f98c4f85 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
+Date: Thu, 2 Apr 2015 09:13:49 +0200
+Subject: [PATCH] MIPS: BCM47xx: Add generic function filling SPROM entries
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Handling many SPROM revisions became messy, we have tons of functions
+specific to various revision groups which are quite hard to track.
+For years there is yet another revision 11 asking for support, but
+adding it in current the form would make things even worse.
+To resolve this problem let's add new function with table-like entries
+that will contain revision bitmask for every SPROM variable.
+
+Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
+Cc: linux-mips@linux-mips.org
+Cc: Hauke Mehrtens <hauke@hauke-m.de>
+Cc: Jonas Gorski <jonas.gorski@gmail.com>
+Patchwork: https://patchwork.linux-mips.org/patch/9659/
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+---
+ arch/mips/bcm47xx/sprom.c | 32 +++++++++++++++++++++++++++++---
+ 1 file changed, 29 insertions(+), 3 deletions(-)
+
+diff --git a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c
+index 5d32afc..77790c9 100644
+--- a/arch/mips/bcm47xx/sprom.c
++++ b/arch/mips/bcm47xx/sprom.c
+@@ -180,6 +180,33 @@ static void nvram_read_alpha2(const char *prefix, const char *name,
+ memcpy(val, buf, 2);
+ }
+
++/* This is one-function-only macro, it uses local "sprom" variable! */
++#define ENTRY(_revmask, _type, _prefix, _name, _val, _allset, _fallback) \
++ if (_revmask & BIT(sprom->revision)) \
++ nvram_read_ ## _type(_prefix, NULL, _name, &sprom->_val, \
++ _allset, _fallback)
++/*
++ * Special version of filling function that can be safely called for any SPROM
++ * revision. For every NVRAM to SPROM mapping it contains bitmask of revisions
++ * for which the mapping is valid.
++ * It obviously requires some hexadecimal/bitmasks knowledge, but allows
++ * writing cleaner code (easy revisions handling).
++ * Note that while SPROM revision 0 was never used, we still keep BIT(0)
++ * reserved for it, just to keep numbering sane.
++ */
++static void bcm47xx_sprom_fill_auto(struct ssb_sprom *sprom,
++ const char *prefix, bool fallback)
++{
++ const char *pre = prefix;
++ bool fb = fallback;
++
++ ENTRY(0xfffffffe, u16, pre, "boardrev", board_rev, 0, true);
++ ENTRY(0xfffffffe, u16, pre, "boardnum", board_num, 0, fb);
++
++ /* TODO: Move more mappings here */
++}
++#undef ENTRY /* It's specififc, uses local variable, don't use it (again). */
++
+ static void bcm47xx_fill_sprom_r1234589(struct ssb_sprom *sprom,
+ const char *prefix, bool fallback)
+ {
+@@ -714,9 +741,6 @@ static void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom,
+ static void bcm47xx_fill_board_data(struct ssb_sprom *sprom, const char *prefix,
+ bool fallback)
+ {
+- nvram_read_u16(prefix, NULL, "boardrev", &sprom->board_rev, 0, true);
+- nvram_read_u16(prefix, NULL, "boardnum", &sprom->board_num, 0,
+- fallback);
+ nvram_read_u16(prefix, NULL, "boardtype", &sprom->board_type, 0, true);
+ nvram_read_u32_2(prefix, "boardflags", &sprom->boardflags_lo,
+ &sprom->boardflags_hi, fallback);
+@@ -787,6 +811,8 @@ void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix,
+ bcm47xx_fill_sprom_r12389(sprom, prefix, fallback);
+ bcm47xx_fill_sprom_r1(sprom, prefix, fallback);
+ }
++
++ bcm47xx_sprom_fill_auto(sprom, prefix, fallback);
+ }
+
+ #ifdef CONFIG_BCM47XX_SSB
+--
+1.8.4.5
+
diff --git a/target/linux/brcm47xx/patches-3.18/031-13-MIPS-BCM47xx-Move-filling-most-of-SPROM-to-the-gener.patch b/target/linux/brcm47xx/patches-3.18/031-13-MIPS-BCM47xx-Move-filling-most-of-SPROM-to-the-gener.patch
new file mode 100644
index 0000000000..6056bdf71b
--- /dev/null
+++ b/target/linux/brcm47xx/patches-3.18/031-13-MIPS-BCM47xx-Move-filling-most-of-SPROM-to-the-gener.patch
@@ -0,0 +1,717 @@
+From e754dfcfe37f49c9249152e2e98e58887a4d87c8 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
+Date: Thu, 2 Apr 2015 12:30:24 +0200
+Subject: [PATCH] MIPS: BCM47xx: Move filling most of SPROM to the generic
+ function
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This simplifies code a lot by dropping many per-revision-group
+functions. There are still some paths left that use uncommon NVRAM read
+helpers or fill arrays. They will need to be handled in separated patch.
+
+I've tested this (by printing SPROM content) for regressions on:
+1) BCM4704 (SPROM revision 2)
+2) BCM4706 (SPROM revision 8 plus 11 & 9 on extra WiFi cards)
+The only difference is not reading board_type from SPROM rev 11 which is
+unsupported and treated as rev 1. This change for rev 1 is expected.
+
+Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
+Cc: linux-mips@linux-mips.org
+Cc: Hauke Mehrtens <hauke@hauke-m.de>
+Cc: Jonas Gorski <jonas.gorski@gmail.com>
+Patchwork: https://patchwork.linux-mips.org/patch/9660/
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+---
+ arch/mips/bcm47xx/sprom.c | 605 ++++++++++++++++------------------------------
+ 1 file changed, 204 insertions(+), 401 deletions(-)
+
+diff --git a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c
+index 77790c9..68ebf23 100644
+--- a/arch/mips/bcm47xx/sprom.c
++++ b/arch/mips/bcm47xx/sprom.c
+@@ -201,9 +201,211 @@ static void bcm47xx_sprom_fill_auto(struct ssb_sprom *sprom,
+ bool fb = fallback;
+
+ ENTRY(0xfffffffe, u16, pre, "boardrev", board_rev, 0, true);
++ ENTRY(0x00000002, u16, pre, "boardflags", boardflags_lo, 0, fb);
++ ENTRY(0xfffffffc, u16, pre, "boardtype", board_type, 0, true);
+ ENTRY(0xfffffffe, u16, pre, "boardnum", board_num, 0, fb);
+-
+- /* TODO: Move more mappings here */
++ ENTRY(0x00000002, u8, pre, "cc", country_code, 0, fb);
++ ENTRY(0xfffffff8, u8, pre, "regrev", regrev, 0, fb);
++
++ ENTRY(0xfffffffe, u8, pre, "ledbh0", gpio0, 0xff, fb);
++ ENTRY(0xfffffffe, u8, pre, "ledbh1", gpio1, 0xff, fb);
++ ENTRY(0xfffffffe, u8, pre, "ledbh2", gpio2, 0xff, fb);
++ ENTRY(0xfffffffe, u8, pre, "ledbh3", gpio3, 0xff, fb);
++
++ ENTRY(0x0000070e, u16, pre, "pa0b0", pa0b0, 0, fb);
++ ENTRY(0x0000070e, u16, pre, "pa0b1", pa0b1, 0, fb);
++ ENTRY(0x0000070e, u16, pre, "pa0b2", pa0b2, 0, fb);
++ ENTRY(0x0000070e, u8, pre, "pa0itssit", itssi_bg, 0, fb);
++ ENTRY(0x0000070e, u8, pre, "pa0maxpwr", maxpwr_bg, 0, fb);
++
++ ENTRY(0x0000070c, u8, pre, "opo", opo, 0, fb);
++ ENTRY(0xfffffffe, u8, pre, "aa2g", ant_available_bg, 0, fb);
++ ENTRY(0xfffffffe, u8, pre, "aa5g", ant_available_a, 0, fb);
++ ENTRY(0x000007fe, s8, pre, "ag0", antenna_gain.a0, 0, fb);
++ ENTRY(0x000007fe, s8, pre, "ag1", antenna_gain.a1, 0, fb);
++ ENTRY(0x000007f0, s8, pre, "ag2", antenna_gain.a2, 0, fb);
++ ENTRY(0x000007f0, s8, pre, "ag3", antenna_gain.a3, 0, fb);
++
++ ENTRY(0x0000070e, u16, pre, "pa1b0", pa1b0, 0, fb);
++ ENTRY(0x0000070e, u16, pre, "pa1b1", pa1b1, 0, fb);
++ ENTRY(0x0000070e, u16, pre, "pa1b2", pa1b2, 0, fb);
++ ENTRY(0x0000070c, u16, pre, "pa1lob0", pa1lob0, 0, fb);
++ ENTRY(0x0000070c, u16, pre, "pa1lob1", pa1lob1, 0, fb);
++ ENTRY(0x0000070c, u16, pre, "pa1lob2", pa1lob2, 0, fb);
++ ENTRY(0x0000070c, u16, pre, "pa1hib0", pa1hib0, 0, fb);
++ ENTRY(0x0000070c, u16, pre, "pa1hib1", pa1hib1, 0, fb);
++ ENTRY(0x0000070c, u16, pre, "pa1hib2", pa1hib2, 0, fb);
++ ENTRY(0x0000070e, u8, pre, "pa1itssit", itssi_a, 0, fb);
++ ENTRY(0x0000070e, u8, pre, "pa1maxpwr", maxpwr_a, 0, fb);
++ ENTRY(0x0000070c, u8, pre, "pa1lomaxpwr", maxpwr_al, 0, fb);
++ ENTRY(0x0000070c, u8, pre, "pa1himaxpwr", maxpwr_ah, 0, fb);
++
++ ENTRY(0x00000708, u8, pre, "bxa2g", bxa2g, 0, fb);
++ ENTRY(0x00000708, u8, pre, "rssisav2g", rssisav2g, 0, fb);
++ ENTRY(0x00000708, u8, pre, "rssismc2g", rssismc2g, 0, fb);
++ ENTRY(0x00000708, u8, pre, "rssismf2g", rssismf2g, 0, fb);
++ ENTRY(0x00000708, u8, pre, "bxa5g", bxa5g, 0, fb);
++ ENTRY(0x00000708, u8, pre, "rssisav5g", rssisav5g, 0, fb);
++ ENTRY(0x00000708, u8, pre, "rssismc5g", rssismc5g, 0, fb);
++ ENTRY(0x00000708, u8, pre, "rssismf5g", rssismf5g, 0, fb);
++ ENTRY(0x00000708, u8, pre, "tri2g", tri2g, 0, fb);
++ ENTRY(0x00000708, u8, pre, "tri5g", tri5g, 0, fb);
++ ENTRY(0x00000708, u8, pre, "tri5gl", tri5gl, 0, fb);
++ ENTRY(0x00000708, u8, pre, "tri5gh", tri5gh, 0, fb);
++ ENTRY(0x00000708, s8, pre, "rxpo2g", rxpo2g, 0, fb);
++ ENTRY(0x00000708, s8, pre, "rxpo5g", rxpo5g, 0, fb);
++ ENTRY(0xfffffff0, u8, pre, "txchain", txchain, 0xf, fb);
++ ENTRY(0xfffffff0, u8, pre, "rxchain", rxchain, 0xf, fb);
++ ENTRY(0xfffffff0, u8, pre, "antswitch", antswitch, 0xff, fb);
++ ENTRY(0x00000700, u8, pre, "tssipos2g", fem.ghz2.tssipos, 0, fb);
++ ENTRY(0x00000700, u8, pre, "extpagain2g", fem.ghz2.extpa_gain, 0, fb);
++ ENTRY(0x00000700, u8, pre, "pdetrange2g", fem.ghz2.pdet_range, 0, fb);
++ ENTRY(0x00000700, u8, pre, "triso2g", fem.ghz2.tr_iso, 0, fb);
++ ENTRY(0x00000700, u8, pre, "antswctl2g", fem.ghz2.antswlut, 0, fb);
++ ENTRY(0x00000700, u8, pre, "tssipos5g", fem.ghz5.tssipos, 0, fb);
++ ENTRY(0x00000700, u8, pre, "extpagain5g", fem.ghz5.extpa_gain, 0, fb);
++ ENTRY(0x00000700, u8, pre, "pdetrange5g", fem.ghz5.pdet_range, 0, fb);
++ ENTRY(0x00000700, u8, pre, "triso5g", fem.ghz5.tr_iso, 0, fb);
++ ENTRY(0x00000700, u8, pre, "antswctl5g", fem.ghz5.antswlut, 0, fb);
++ ENTRY(0x000000f0, u8, pre, "txpid2ga0", txpid2g[0], 0, fb);
++ ENTRY(0x000000f0, u8, pre, "txpid2ga1", txpid2g[1], 0, fb);
++ ENTRY(0x000000f0, u8, pre, "txpid2ga2", txpid2g[2], 0, fb);
++ ENTRY(0x000000f0, u8, pre, "txpid2ga3", txpid2g[3], 0, fb);
++ ENTRY(0x000000f0, u8, pre, "txpid5ga0", txpid5g[0], 0, fb);
++ ENTRY(0x000000f0, u8, pre, "txpid5ga1", txpid5g[1], 0, fb);
++ ENTRY(0x000000f0, u8, pre, "txpid5ga2", txpid5g[2], 0, fb);
++ ENTRY(0x000000f0, u8, pre, "txpid5ga3", txpid5g[3], 0, fb);
++ ENTRY(0x000000f0, u8, pre, "txpid5gla0", txpid5gl[0], 0, fb);
++ ENTRY(0x000000f0, u8, pre, "txpid5gla1", txpid5gl[1], 0, fb);
++ ENTRY(0x000000f0, u8, pre, "txpid5gla2", txpid5gl[2], 0, fb);
++ ENTRY(0x000000f0, u8, pre, "txpid5gla3", txpid5gl[3], 0, fb);
++ ENTRY(0x000000f0, u8, pre, "txpid5gha0", txpid5gh[0], 0, fb);
++ ENTRY(0x000000f0, u8, pre, "txpid5gha1", txpid5gh[1], 0, fb);
++ ENTRY(0x000000f0, u8, pre, "txpid5gha2", txpid5gh[2], 0, fb);
++ ENTRY(0x000000f0, u8, pre, "txpid5gha3", txpid5gh[3], 0, fb);
++
++ ENTRY(0xffffff00, u8, pre, "tempthresh", tempthresh, 0, fb);
++ ENTRY(0xffffff00, u8, pre, "tempoffset", tempoffset, 0, fb);
++ ENTRY(0xffffff00, u16, pre, "rawtempsense", rawtempsense, 0, fb);
++ ENTRY(0xffffff00, u8, pre, "measpower", measpower, 0, fb);
++ ENTRY(0xffffff00, u8, pre, "tempsense_slope", tempsense_slope, 0, fb);
++ ENTRY(0xffffff00, u8, pre, "tempcorrx", tempcorrx, 0, fb);
++ ENTRY(0xffffff00, u8, pre, "tempsense_option", tempsense_option, 0, fb);
++ ENTRY(0x00000700, u8, pre, "freqoffset_corr", freqoffset_corr, 0, fb);
++ ENTRY(0x00000700, u8, pre, "iqcal_swp_dis", iqcal_swp_dis, 0, fb);
++ ENTRY(0x00000700, u8, pre, "hw_iqcal_en", hw_iqcal_en, 0, fb);
++ ENTRY(0x00000700, u8, pre, "elna2g", elna2g, 0, fb);
++ ENTRY(0x00000700, u8, pre, "elna5g", elna5g, 0, fb);
++ ENTRY(0xffffff00, u8, pre, "phycal_tempdelta", phycal_tempdelta, 0, fb);
++ ENTRY(0xffffff00, u8, pre, "temps_period", temps_period, 0, fb);
++ ENTRY(0xffffff00, u8, pre, "temps_hysteresis", temps_hysteresis, 0, fb);
++ ENTRY(0xffffff00, u8, pre, "measpower1", measpower1, 0, fb);
++ ENTRY(0xffffff00, u8, pre, "measpower2", measpower2, 0, fb);
++
++ ENTRY(0x000001f0, u16, pre, "cck2gpo", cck2gpo, 0, fb);
++ ENTRY(0x000001f0, u32, pre, "ofdm2gpo", ofdm2gpo, 0, fb);
++ ENTRY(0x000001f0, u32, pre, "ofdm5gpo", ofdm5gpo, 0, fb);
++ ENTRY(0x000001f0, u32, pre, "ofdm5glpo", ofdm5glpo, 0, fb);
++ ENTRY(0x000001f0, u32, pre, "ofdm5ghpo", ofdm5ghpo, 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs2gpo0", mcs2gpo[0], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs2gpo1", mcs2gpo[1], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs2gpo2", mcs2gpo[2], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs2gpo3", mcs2gpo[3], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs2gpo4", mcs2gpo[4], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs2gpo5", mcs2gpo[5], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs2gpo6", mcs2gpo[6], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs2gpo7", mcs2gpo[7], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs5gpo0", mcs5gpo[0], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs5gpo1", mcs5gpo[1], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs5gpo2", mcs5gpo[2], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs5gpo3", mcs5gpo[3], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs5gpo4", mcs5gpo[4], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs5gpo5", mcs5gpo[5], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs5gpo6", mcs5gpo[6], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs5gpo7", mcs5gpo[7], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs5glpo0", mcs5glpo[0], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs5glpo1", mcs5glpo[1], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs5glpo2", mcs5glpo[2], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs5glpo3", mcs5glpo[3], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs5glpo4", mcs5glpo[4], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs5glpo5", mcs5glpo[5], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs5glpo6", mcs5glpo[6], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs5glpo7", mcs5glpo[7], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs5ghpo0", mcs5ghpo[0], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs5ghpo1", mcs5ghpo[1], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs5ghpo2", mcs5ghpo[2], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs5ghpo3", mcs5ghpo[3], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs5ghpo4", mcs5ghpo[4], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs5ghpo5", mcs5ghpo[5], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs5ghpo6", mcs5ghpo[6], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "mcs5ghpo7", mcs5ghpo[7], 0, fb);
++ ENTRY(0x000001f0, u16, pre, "cddpo", cddpo, 0, fb);
++ ENTRY(0x000001f0, u16, pre, "stbcpo", stbcpo, 0, fb);
++ ENTRY(0x000001f0, u16, pre, "bw40po", bw40po, 0, fb);
++ ENTRY(0x000001f0, u16, pre, "bwduppo", bwduppo, 0, fb);
++
++ ENTRY(0xfffffe00, u16, pre, "cckbw202gpo", cckbw202gpo, 0, fb);
++ ENTRY(0xfffffe00, u16, pre, "cckbw20ul2gpo", cckbw20ul2gpo, 0, fb);
++ ENTRY(0x00000600, u32, pre, "legofdmbw202gpo", legofdmbw202gpo, 0, fb);
++ ENTRY(0x00000600, u32, pre, "legofdmbw20ul2gpo", legofdmbw20ul2gpo, 0, fb);
++ ENTRY(0x00000600, u32, pre, "legofdmbw205glpo", legofdmbw205glpo, 0, fb);
++ ENTRY(0x00000600, u32, pre, "legofdmbw20ul5glpo", legofdmbw20ul5glpo, 0, fb);
++ ENTRY(0x00000600, u32, pre, "legofdmbw205gmpo", legofdmbw205gmpo, 0, fb);
++ ENTRY(0x00000600, u32, pre, "legofdmbw20ul5gmpo", legofdmbw20ul5gmpo, 0, fb);
++ ENTRY(0x00000600, u32, pre, "legofdmbw205ghpo", legofdmbw205ghpo, 0, fb);
++ ENTRY(0x00000600, u32, pre, "legofdmbw20ul5ghpo", legofdmbw20ul5ghpo, 0, fb);
++ ENTRY(0xfffffe00, u32, pre, "mcsbw202gpo", mcsbw202gpo, 0, fb);
++ ENTRY(0x00000600, u32, pre, "mcsbw20ul2gpo", mcsbw20ul2gpo, 0, fb);
++ ENTRY(0xfffffe00, u32, pre, "mcsbw402gpo", mcsbw402gpo, 0, fb);
++ ENTRY(0xfffffe00, u32, pre, "mcsbw205glpo", mcsbw205glpo, 0, fb);
++ ENTRY(0x00000600, u32, pre, "mcsbw20ul5glpo", mcsbw20ul5glpo, 0, fb);
++ ENTRY(0xfffffe00, u32, pre, "mcsbw405glpo", mcsbw405glpo, 0, fb);
++ ENTRY(0xfffffe00, u32, pre, "mcsbw205gmpo", mcsbw205gmpo, 0, fb);
++ ENTRY(0x00000600, u32, pre, "mcsbw20ul5gmpo", mcsbw20ul5gmpo, 0, fb);
++ ENTRY(0xfffffe00, u32, pre, "mcsbw405gmpo", mcsbw405gmpo, 0, fb);
++ ENTRY(0xfffffe00, u32, pre, "mcsbw205ghpo", mcsbw205ghpo, 0, fb);
++ ENTRY(0x00000600, u32, pre, "mcsbw20ul5ghpo", mcsbw20ul5ghpo, 0, fb);
++ ENTRY(0xfffffe00, u32, pre, "mcsbw405ghpo", mcsbw405ghpo, 0, fb);
++ ENTRY(0x00000600, u16, pre, "mcs32po", mcs32po, 0, fb);
++ ENTRY(0x00000600, u16, pre, "legofdm40duppo", legofdm40duppo, 0, fb);
++ ENTRY(0x00000700, u8, pre, "pcieingress_war", pcieingress_war, 0, fb);
++
++ /* TODO: rev 11 support */
++ ENTRY(0x00000700, u8, pre, "rxgainerr2ga0", rxgainerr2ga[0], 0, fb);
++ ENTRY(0x00000700, u8, pre, "rxgainerr2ga1", rxgainerr2ga[1], 0, fb);
++ ENTRY(0x00000700, u8, pre, "rxgainerr2ga2", rxgainerr2ga[2], 0, fb);
++ ENTRY(0x00000700, u8, pre, "rxgainerr5gla0", rxgainerr5gla[0], 0, fb);
++ ENTRY(0x00000700, u8, pre, "rxgainerr5gla1", rxgainerr5gla[1], 0, fb);
++ ENTRY(0x00000700, u8, pre, "rxgainerr5gla2", rxgainerr5gla[2], 0, fb);
++ ENTRY(0x00000700, u8, pre, "rxgainerr5gma0", rxgainerr5gma[0], 0, fb);
++ ENTRY(0x00000700, u8, pre, "rxgainerr5gma1", rxgainerr5gma[1], 0, fb);
++ ENTRY(0x00000700, u8, pre, "rxgainerr5gma2", rxgainerr5gma[2], 0, fb);
++ ENTRY(0x00000700, u8, pre, "rxgainerr5gha0", rxgainerr5gha[0], 0, fb);
++ ENTRY(0x00000700, u8, pre, "rxgainerr5gha1", rxgainerr5gha[1], 0, fb);
++ ENTRY(0x00000700, u8, pre, "rxgainerr5gha2", rxgainerr5gha[2], 0, fb);
++ ENTRY(0x00000700, u8, pre, "rxgainerr5gua0", rxgainerr5gua[0], 0, fb);
++ ENTRY(0x00000700, u8, pre, "rxgainerr5gua1", rxgainerr5gua[1], 0, fb);
++ ENTRY(0x00000700, u8, pre, "rxgainerr5gua2", rxgainerr5gua[2], 0, fb);
++
++ ENTRY(0xfffffe00, u8, pre, "sar2g", sar2g, 0, fb);
++ ENTRY(0xfffffe00, u8, pre, "sar5g", sar5g, 0, fb);
++
++ /* TODO: rev 11 support */
++ ENTRY(0x00000700, u8, pre, "noiselvl2ga0", noiselvl2ga[0], 0, fb);
++ ENTRY(0x00000700, u8, pre, "noiselvl2ga1", noiselvl2ga[1], 0, fb);
++ ENTRY(0x00000700, u8, pre, "noiselvl2ga2", noiselvl2ga[2], 0, fb);
++ ENTRY(0x00000700, u8, pre, "noiselvl5gla0", noiselvl5gla[0], 0, fb);
++ ENTRY(0x00000700, u8, pre, "noiselvl5gla1", noiselvl5gla[1], 0, fb);
++ ENTRY(0x00000700, u8, pre, "noiselvl5gla2", noiselvl5gla[2], 0, fb);
++ ENTRY(0x00000700, u8, pre, "noiselvl5gma0", noiselvl5gma[0], 0, fb);
++ ENTRY(0x00000700, u8, pre, "noiselvl5gma1", noiselvl5gma[1], 0, fb);
++ ENTRY(0x00000700, u8, pre, "noiselvl5gma2", noiselvl5gma[2], 0, fb);
++ ENTRY(0x00000700, u8, pre, "noiselvl5gha0", noiselvl5gha[0], 0, fb);
++ ENTRY(0x00000700, u8, pre, "noiselvl5gha1", noiselvl5gha[1], 0, fb);
++ ENTRY(0x00000700, u8, pre, "noiselvl5gha2", noiselvl5gha[2], 0, fb);
++ ENTRY(0x00000700, u8, pre, "noiselvl5gua0", noiselvl5gua[0], 0, fb);
++ ENTRY(0x00000700, u8, pre, "noiselvl5gua1", noiselvl5gua[1], 0, fb);
++ ENTRY(0x00000700, u8, pre, "noiselvl5gua2", noiselvl5gua[2], 0, fb);
+ }
+ #undef ENTRY /* It's specififc, uses local variable, don't use it (again). */
+
+@@ -211,90 +413,12 @@ static void bcm47xx_fill_sprom_r1234589(struct ssb_sprom *sprom,
+ const char *prefix, bool fallback)
+ {
+ nvram_read_u16(prefix, NULL, "devid", &sprom->dev_id, 0, fallback);
+- nvram_read_u8(prefix, NULL, "ledbh0", &sprom->gpio0, 0xff, fallback);
+- nvram_read_u8(prefix, NULL, "ledbh1", &sprom->gpio1, 0xff, fallback);
+- nvram_read_u8(prefix, NULL, "ledbh2", &sprom->gpio2, 0xff, fallback);
+- nvram_read_u8(prefix, NULL, "ledbh3", &sprom->gpio3, 0xff, fallback);
+- nvram_read_u8(prefix, NULL, "aa2g", &sprom->ant_available_bg, 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "aa5g", &sprom->ant_available_a, 0,
+- fallback);
+- nvram_read_s8(prefix, NULL, "ag0", &sprom->antenna_gain.a0, 0,
+- fallback);
+- nvram_read_s8(prefix, NULL, "ag1", &sprom->antenna_gain.a1, 0,
+- fallback);
+ nvram_read_alpha2(prefix, "ccode", sprom->alpha2, fallback);
+ }
+
+-static void bcm47xx_fill_sprom_r12389(struct ssb_sprom *sprom,
+- const char *prefix, bool fallback)
+-{
+- nvram_read_u16(prefix, NULL, "pa0b0", &sprom->pa0b0, 0, fallback);
+- nvram_read_u16(prefix, NULL, "pa0b1", &sprom->pa0b1, 0, fallback);
+- nvram_read_u16(prefix, NULL, "pa0b2", &sprom->pa0b2, 0, fallback);
+- nvram_read_u8(prefix, NULL, "pa0itssit", &sprom->itssi_bg, 0, fallback);
+- nvram_read_u8(prefix, NULL, "pa0maxpwr", &sprom->maxpwr_bg, 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "pa1b0", &sprom->pa1b0, 0, fallback);
+- nvram_read_u16(prefix, NULL, "pa1b1", &sprom->pa1b1, 0, fallback);
+- nvram_read_u16(prefix, NULL, "pa1b2", &sprom->pa1b2, 0, fallback);
+- nvram_read_u8(prefix, NULL, "pa1itssit", &sprom->itssi_a, 0, fallback);
+- nvram_read_u8(prefix, NULL, "pa1maxpwr", &sprom->maxpwr_a, 0, fallback);
+-}
+-
+-static void bcm47xx_fill_sprom_r1(struct ssb_sprom *sprom, const char *prefix,
+- bool fallback)
+-{
+- nvram_read_u16(prefix, NULL, "boardflags", &sprom->boardflags_lo, 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "cc", &sprom->country_code, 0, fallback);
+-}
+-
+-static void bcm47xx_fill_sprom_r2389(struct ssb_sprom *sprom,
+- const char *prefix, bool fallback)
+-{
+- nvram_read_u8(prefix, NULL, "opo", &sprom->opo, 0, fallback);
+- nvram_read_u16(prefix, NULL, "pa1lob0", &sprom->pa1lob0, 0, fallback);
+- nvram_read_u16(prefix, NULL, "pa1lob1", &sprom->pa1lob1, 0, fallback);
+- nvram_read_u16(prefix, NULL, "pa1lob2", &sprom->pa1lob2, 0, fallback);
+- nvram_read_u16(prefix, NULL, "pa1hib0", &sprom->pa1hib0, 0, fallback);
+- nvram_read_u16(prefix, NULL, "pa1hib1", &sprom->pa1hib1, 0, fallback);
+- nvram_read_u16(prefix, NULL, "pa1hib2", &sprom->pa1hib2, 0, fallback);
+- nvram_read_u8(prefix, NULL, "pa1lomaxpwr", &sprom->maxpwr_al, 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "pa1himaxpwr", &sprom->maxpwr_ah, 0,
+- fallback);
+-}
+-
+-static void bcm47xx_fill_sprom_r389(struct ssb_sprom *sprom, const char *prefix,
+- bool fallback)
+-{
+- nvram_read_u8(prefix, NULL, "bxa2g", &sprom->bxa2g, 0, fallback);
+- nvram_read_u8(prefix, NULL, "rssisav2g", &sprom->rssisav2g, 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "rssismc2g", &sprom->rssismc2g, 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "rssismf2g", &sprom->rssismf2g, 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "bxa5g", &sprom->bxa5g, 0, fallback);
+- nvram_read_u8(prefix, NULL, "rssisav5g", &sprom->rssisav5g, 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "rssismc5g", &sprom->rssismc5g, 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "rssismf5g", &sprom->rssismf5g, 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "tri2g", &sprom->tri2g, 0, fallback);
+- nvram_read_u8(prefix, NULL, "tri5g", &sprom->tri5g, 0, fallback);
+- nvram_read_u8(prefix, NULL, "tri5gl", &sprom->tri5gl, 0, fallback);
+- nvram_read_u8(prefix, NULL, "tri5gh", &sprom->tri5gh, 0, fallback);
+- nvram_read_s8(prefix, NULL, "rxpo2g", &sprom->rxpo2g, 0, fallback);
+- nvram_read_s8(prefix, NULL, "rxpo5g", &sprom->rxpo5g, 0, fallback);
+-}
+-
+ static void bcm47xx_fill_sprom_r3(struct ssb_sprom *sprom, const char *prefix,
+ bool fallback)
+ {
+- nvram_read_u8(prefix, NULL, "regrev", &sprom->regrev, 0, fallback);
+ nvram_read_leddc(prefix, "leddc", &sprom->leddc_on_time,
+ &sprom->leddc_off_time, fallback);
+ }
+@@ -302,309 +426,10 @@ static void bcm47xx_fill_sprom_r3(struct ssb_sprom *sprom, const char *prefix,
+ static void bcm47xx_fill_sprom_r4589(struct ssb_sprom *sprom,
+ const char *prefix, bool fallback)
+ {
+- nvram_read_u8(prefix, NULL, "regrev", &sprom->regrev, 0, fallback);
+- nvram_read_s8(prefix, NULL, "ag2", &sprom->antenna_gain.a2, 0,
+- fallback);
+- nvram_read_s8(prefix, NULL, "ag3", &sprom->antenna_gain.a3, 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "txchain", &sprom->txchain, 0xf, fallback);
+- nvram_read_u8(prefix, NULL, "rxchain", &sprom->rxchain, 0xf, fallback);
+- nvram_read_u8(prefix, NULL, "antswitch", &sprom->antswitch, 0xff,
+- fallback);
+ nvram_read_leddc(prefix, "leddc", &sprom->leddc_on_time,
+ &sprom->leddc_off_time, fallback);
+ }
+
+-static void bcm47xx_fill_sprom_r458(struct ssb_sprom *sprom, const char *prefix,
+- bool fallback)
+-{
+- nvram_read_u16(prefix, NULL, "cck2gpo", &sprom->cck2gpo, 0, fallback);
+- nvram_read_u32(prefix, NULL, "ofdm2gpo", &sprom->ofdm2gpo, 0, fallback);
+- nvram_read_u32(prefix, NULL, "ofdm5gpo", &sprom->ofdm5gpo, 0, fallback);
+- nvram_read_u32(prefix, NULL, "ofdm5glpo", &sprom->ofdm5glpo, 0,
+- fallback);
+- nvram_read_u32(prefix, NULL, "ofdm5ghpo", &sprom->ofdm5ghpo, 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "cddpo", &sprom->cddpo, 0, fallback);
+- nvram_read_u16(prefix, NULL, "stbcpo", &sprom->stbcpo, 0, fallback);
+- nvram_read_u16(prefix, NULL, "bw40po", &sprom->bw40po, 0, fallback);
+- nvram_read_u16(prefix, NULL, "bwduppo", &sprom->bwduppo, 0, fallback);
+- nvram_read_u16(prefix, NULL, "mcs2gpo0", &sprom->mcs2gpo[0], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs2gpo1", &sprom->mcs2gpo[1], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs2gpo2", &sprom->mcs2gpo[2], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs2gpo3", &sprom->mcs2gpo[3], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs2gpo4", &sprom->mcs2gpo[4], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs2gpo5", &sprom->mcs2gpo[5], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs2gpo6", &sprom->mcs2gpo[6], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs2gpo7", &sprom->mcs2gpo[7], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs5gpo0", &sprom->mcs5gpo[0], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs5gpo1", &sprom->mcs5gpo[1], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs5gpo2", &sprom->mcs5gpo[2], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs5gpo3", &sprom->mcs5gpo[3], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs5gpo4", &sprom->mcs5gpo[4], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs5gpo5", &sprom->mcs5gpo[5], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs5gpo6", &sprom->mcs5gpo[6], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs5gpo7", &sprom->mcs5gpo[7], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs5glpo0", &sprom->mcs5glpo[0], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs5glpo1", &sprom->mcs5glpo[1], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs5glpo2", &sprom->mcs5glpo[2], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs5glpo3", &sprom->mcs5glpo[3], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs5glpo4", &sprom->mcs5glpo[4], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs5glpo5", &sprom->mcs5glpo[5], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs5glpo6", &sprom->mcs5glpo[6], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs5glpo7", &sprom->mcs5glpo[7], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs5ghpo0", &sprom->mcs5ghpo[0], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs5ghpo1", &sprom->mcs5ghpo[1], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs5ghpo2", &sprom->mcs5ghpo[2], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs5ghpo3", &sprom->mcs5ghpo[3], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs5ghpo4", &sprom->mcs5ghpo[4], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs5ghpo5", &sprom->mcs5ghpo[5], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs5ghpo6", &sprom->mcs5ghpo[6], 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs5ghpo7", &sprom->mcs5ghpo[7], 0,
+- fallback);
+-}
+-
+-static void bcm47xx_fill_sprom_r45(struct ssb_sprom *sprom, const char *prefix,
+- bool fallback)
+-{
+- nvram_read_u8(prefix, NULL, "txpid2ga0", &sprom->txpid2g[0], 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "txpid2ga1", &sprom->txpid2g[1], 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "txpid2ga2", &sprom->txpid2g[2], 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "txpid2ga3", &sprom->txpid2g[3], 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "txpid5ga0", &sprom->txpid5g[0], 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "txpid5ga1", &sprom->txpid5g[1], 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "txpid5ga2", &sprom->txpid5g[2], 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "txpid5ga3", &sprom->txpid5g[3], 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "txpid5gla0", &sprom->txpid5gl[0], 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "txpid5gla1", &sprom->txpid5gl[1], 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "txpid5gla2", &sprom->txpid5gl[2], 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "txpid5gla3", &sprom->txpid5gl[3], 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "txpid5gha0", &sprom->txpid5gh[0], 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "txpid5gha1", &sprom->txpid5gh[1], 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "txpid5gha2", &sprom->txpid5gh[2], 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "txpid5gha3", &sprom->txpid5gh[3], 0,
+- fallback);
+-}
+-
+-static void bcm47xx_fill_sprom_r89(struct ssb_sprom *sprom, const char *prefix,
+- bool fallback)
+-{
+- nvram_read_u8(prefix, NULL, "tssipos2g", &sprom->fem.ghz2.tssipos, 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "extpagain2g",
+- &sprom->fem.ghz2.extpa_gain, 0, fallback);
+- nvram_read_u8(prefix, NULL, "pdetrange2g",
+- &sprom->fem.ghz2.pdet_range, 0, fallback);
+- nvram_read_u8(prefix, NULL, "triso2g", &sprom->fem.ghz2.tr_iso, 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "antswctl2g", &sprom->fem.ghz2.antswlut, 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "tssipos5g", &sprom->fem.ghz5.tssipos, 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "extpagain5g",
+- &sprom->fem.ghz5.extpa_gain, 0, fallback);
+- nvram_read_u8(prefix, NULL, "pdetrange5g",
+- &sprom->fem.ghz5.pdet_range, 0, fallback);
+- nvram_read_u8(prefix, NULL, "triso5g", &sprom->fem.ghz5.tr_iso, 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "antswctl5g", &sprom->fem.ghz5.antswlut, 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "tempthresh", &sprom->tempthresh, 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "tempoffset", &sprom->tempoffset, 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "rawtempsense", &sprom->rawtempsense, 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "measpower", &sprom->measpower, 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "tempsense_slope",
+- &sprom->tempsense_slope, 0, fallback);
+- nvram_read_u8(prefix, NULL, "tempcorrx", &sprom->tempcorrx, 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "tempsense_option",
+- &sprom->tempsense_option, 0, fallback);
+- nvram_read_u8(prefix, NULL, "freqoffset_corr",
+- &sprom->freqoffset_corr, 0, fallback);
+- nvram_read_u8(prefix, NULL, "iqcal_swp_dis", &sprom->iqcal_swp_dis, 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "hw_iqcal_en", &sprom->hw_iqcal_en, 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "elna2g", &sprom->elna2g, 0, fallback);
+- nvram_read_u8(prefix, NULL, "elna5g", &sprom->elna5g, 0, fallback);
+- nvram_read_u8(prefix, NULL, "phycal_tempdelta",
+- &sprom->phycal_tempdelta, 0, fallback);
+- nvram_read_u8(prefix, NULL, "temps_period", &sprom->temps_period, 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "temps_hysteresis",
+- &sprom->temps_hysteresis, 0, fallback);
+- nvram_read_u8(prefix, NULL, "measpower1", &sprom->measpower1, 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "measpower2", &sprom->measpower2, 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "rxgainerr2ga0",
+- &sprom->rxgainerr2ga[0], 0, fallback);
+- nvram_read_u8(prefix, NULL, "rxgainerr2ga1",
+- &sprom->rxgainerr2ga[1], 0, fallback);
+- nvram_read_u8(prefix, NULL, "rxgainerr2ga2",
+- &sprom->rxgainerr2ga[2], 0, fallback);
+- nvram_read_u8(prefix, NULL, "rxgainerr5gla0",
+- &sprom->rxgainerr5gla[0], 0, fallback);
+- nvram_read_u8(prefix, NULL, "rxgainerr5gla1",
+- &sprom->rxgainerr5gla[1], 0, fallback);
+- nvram_read_u8(prefix, NULL, "rxgainerr5gla2",
+- &sprom->rxgainerr5gla[2], 0, fallback);
+- nvram_read_u8(prefix, NULL, "rxgainerr5gma0",
+- &sprom->rxgainerr5gma[0], 0, fallback);
+- nvram_read_u8(prefix, NULL, "rxgainerr5gma1",
+- &sprom->rxgainerr5gma[1], 0, fallback);
+- nvram_read_u8(prefix, NULL, "rxgainerr5gma2",
+- &sprom->rxgainerr5gma[2], 0, fallback);
+- nvram_read_u8(prefix, NULL, "rxgainerr5gha0",
+- &sprom->rxgainerr5gha[0], 0, fallback);
+- nvram_read_u8(prefix, NULL, "rxgainerr5gha1",
+- &sprom->rxgainerr5gha[1], 0, fallback);
+- nvram_read_u8(prefix, NULL, "rxgainerr5gha2",
+- &sprom->rxgainerr5gha[2], 0, fallback);
+- nvram_read_u8(prefix, NULL, "rxgainerr5gua0",
+- &sprom->rxgainerr5gua[0], 0, fallback);
+- nvram_read_u8(prefix, NULL, "rxgainerr5gua1",
+- &sprom->rxgainerr5gua[1], 0, fallback);
+- nvram_read_u8(prefix, NULL, "rxgainerr5gua2",
+- &sprom->rxgainerr5gua[2], 0, fallback);
+- nvram_read_u8(prefix, NULL, "noiselvl2ga0", &sprom->noiselvl2ga[0], 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "noiselvl2ga1", &sprom->noiselvl2ga[1], 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "noiselvl2ga2", &sprom->noiselvl2ga[2], 0,
+- fallback);
+- nvram_read_u8(prefix, NULL, "noiselvl5gla0",
+- &sprom->noiselvl5gla[0], 0, fallback);
+- nvram_read_u8(prefix, NULL, "noiselvl5gla1",
+- &sprom->noiselvl5gla[1], 0, fallback);
+- nvram_read_u8(prefix, NULL, "noiselvl5gla2",
+- &sprom->noiselvl5gla[2], 0, fallback);
+- nvram_read_u8(prefix, NULL, "noiselvl5gma0",
+- &sprom->noiselvl5gma[0], 0, fallback);
+- nvram_read_u8(prefix, NULL, "noiselvl5gma1",
+- &sprom->noiselvl5gma[1], 0, fallback);
+- nvram_read_u8(prefix, NULL, "noiselvl5gma2",
+- &sprom->noiselvl5gma[2], 0, fallback);
+- nvram_read_u8(prefix, NULL, "noiselvl5gha0",
+- &sprom->noiselvl5gha[0], 0, fallback);
+- nvram_read_u8(prefix, NULL, "noiselvl5gha1",
+- &sprom->noiselvl5gha[1], 0, fallback);
+- nvram_read_u8(prefix, NULL, "noiselvl5gha2",
+- &sprom->noiselvl5gha[2], 0, fallback);
+- nvram_read_u8(prefix, NULL, "noiselvl5gua0",
+- &sprom->noiselvl5gua[0], 0, fallback);
+- nvram_read_u8(prefix, NULL, "noiselvl5gua1",
+- &sprom->noiselvl5gua[1], 0, fallback);
+- nvram_read_u8(prefix, NULL, "noiselvl5gua2",
+- &sprom->noiselvl5gua[2], 0, fallback);
+- nvram_read_u8(prefix, NULL, "pcieingress_war",
+- &sprom->pcieingress_war, 0, fallback);
+-}
+-
+-static void bcm47xx_fill_sprom_r9(struct ssb_sprom *sprom, const char *prefix,
+- bool fallback)
+-{
+- nvram_read_u16(prefix, NULL, "cckbw202gpo", &sprom->cckbw202gpo, 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "cckbw20ul2gpo", &sprom->cckbw20ul2gpo, 0,
+- fallback);
+- nvram_read_u32(prefix, NULL, "legofdmbw202gpo",
+- &sprom->legofdmbw202gpo, 0, fallback);
+- nvram_read_u32(prefix, NULL, "legofdmbw20ul2gpo",
+- &sprom->legofdmbw20ul2gpo, 0, fallback);
+- nvram_read_u32(prefix, NULL, "legofdmbw205glpo",
+- &sprom->legofdmbw205glpo, 0, fallback);
+- nvram_read_u32(prefix, NULL, "legofdmbw20ul5glpo",
+- &sprom->legofdmbw20ul5glpo, 0, fallback);
+- nvram_read_u32(prefix, NULL, "legofdmbw205gmpo",
+- &sprom->legofdmbw205gmpo, 0, fallback);
+- nvram_read_u32(prefix, NULL, "legofdmbw20ul5gmpo",
+- &sprom->legofdmbw20ul5gmpo, 0, fallback);
+- nvram_read_u32(prefix, NULL, "legofdmbw205ghpo",
+- &sprom->legofdmbw205ghpo, 0, fallback);
+- nvram_read_u32(prefix, NULL, "legofdmbw20ul5ghpo",
+- &sprom->legofdmbw20ul5ghpo, 0, fallback);
+- nvram_read_u32(prefix, NULL, "mcsbw202gpo", &sprom->mcsbw202gpo, 0,
+- fallback);
+- nvram_read_u32(prefix, NULL, "mcsbw20ul2gpo", &sprom->mcsbw20ul2gpo, 0,
+- fallback);
+- nvram_read_u32(prefix, NULL, "mcsbw402gpo", &sprom->mcsbw402gpo, 0,
+- fallback);
+- nvram_read_u32(prefix, NULL, "mcsbw205glpo", &sprom->mcsbw205glpo, 0,
+- fallback);
+- nvram_read_u32(prefix, NULL, "mcsbw20ul5glpo",
+- &sprom->mcsbw20ul5glpo, 0, fallback);
+- nvram_read_u32(prefix, NULL, "mcsbw405glpo", &sprom->mcsbw405glpo, 0,
+- fallback);
+- nvram_read_u32(prefix, NULL, "mcsbw205gmpo", &sprom->mcsbw205gmpo, 0,
+- fallback);
+- nvram_read_u32(prefix, NULL, "mcsbw20ul5gmpo",
+- &sprom->mcsbw20ul5gmpo, 0, fallback);
+- nvram_read_u32(prefix, NULL, "mcsbw405gmpo", &sprom->mcsbw405gmpo, 0,
+- fallback);
+- nvram_read_u32(prefix, NULL, "mcsbw205ghpo", &sprom->mcsbw205ghpo, 0,
+- fallback);
+- nvram_read_u32(prefix, NULL, "mcsbw20ul5ghpo",
+- &sprom->mcsbw20ul5ghpo, 0, fallback);
+- nvram_read_u32(prefix, NULL, "mcsbw405ghpo", &sprom->mcsbw405ghpo, 0,
+- fallback);
+- nvram_read_u16(prefix, NULL, "mcs32po", &sprom->mcs32po, 0, fallback);
+- nvram_read_u16(prefix, NULL, "legofdm40duppo",
+- &sprom->legofdm40duppo, 0, fallback);
+- nvram_read_u8(prefix, NULL, "sar2g", &sprom->sar2g, 0, fallback);
+- nvram_read_u8(prefix, NULL, "sar5g", &sprom->sar5g, 0, fallback);
+-}
+-
+ static void bcm47xx_fill_sprom_path_r4589(struct ssb_sprom *sprom,
+ const char *prefix, bool fallback)
+ {
+@@ -741,7 +566,6 @@ static void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom,
+ static void bcm47xx_fill_board_data(struct ssb_sprom *sprom, const char *prefix,
+ bool fallback)
+ {
+- nvram_read_u16(prefix, NULL, "boardtype", &sprom->board_type, 0, true);
+ nvram_read_u32_2(prefix, "boardflags", &sprom->boardflags_lo,
+ &sprom->boardflags_hi, fallback);
+ nvram_read_u32_2(prefix, "boardflags2", &sprom->boardflags2_lo,
+@@ -759,48 +583,29 @@ void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix,
+ switch (sprom->revision) {
+ case 1:
+ bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback);
+- bcm47xx_fill_sprom_r12389(sprom, prefix, fallback);
+- bcm47xx_fill_sprom_r1(sprom, prefix, fallback);
+ break;
+ case 2:
+ bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback);
+- bcm47xx_fill_sprom_r12389(sprom, prefix, fallback);
+- bcm47xx_fill_sprom_r2389(sprom, prefix, fallback);
+ break;
+ case 3:
+ bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback);
+- bcm47xx_fill_sprom_r12389(sprom, prefix, fallback);
+- bcm47xx_fill_sprom_r2389(sprom, prefix, fallback);
+- bcm47xx_fill_sprom_r389(sprom, prefix, fallback);
+ bcm47xx_fill_sprom_r3(sprom, prefix, fallback);
+ break;
+ case 4:
+ case 5:
+ bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback);
+ bcm47xx_fill_sprom_r4589(sprom, prefix, fallback);
+- bcm47xx_fill_sprom_r458(sprom, prefix, fallback);
+- bcm47xx_fill_sprom_r45(sprom, prefix, fallback);
+ bcm47xx_fill_sprom_path_r4589(sprom, prefix, fallback);
+ bcm47xx_fill_sprom_path_r45(sprom, prefix, fallback);
+ break;
+ case 8:
+ bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback);
+- bcm47xx_fill_sprom_r12389(sprom, prefix, fallback);
+- bcm47xx_fill_sprom_r2389(sprom, prefix, fallback);
+- bcm47xx_fill_sprom_r389(sprom, prefix, fallback);
+ bcm47xx_fill_sprom_r4589(sprom, prefix, fallback);
+- bcm47xx_fill_sprom_r458(sprom, prefix, fallback);
+- bcm47xx_fill_sprom_r89(sprom, prefix, fallback);
+ bcm47xx_fill_sprom_path_r4589(sprom, prefix, fallback);
+ break;
+ case 9:
+ bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback);
+- bcm47xx_fill_sprom_r12389(sprom, prefix, fallback);
+- bcm47xx_fill_sprom_r2389(sprom, prefix, fallback);
+- bcm47xx_fill_sprom_r389(sprom, prefix, fallback);
+ bcm47xx_fill_sprom_r4589(sprom, prefix, fallback);
+- bcm47xx_fill_sprom_r89(sprom, prefix, fallback);
+- bcm47xx_fill_sprom_r9(sprom, prefix, fallback);
+ bcm47xx_fill_sprom_path_r4589(sprom, prefix, fallback);
+ break;
+ default:
+@@ -808,8 +613,6 @@ void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix,
+ sprom->revision);
+ sprom->revision = 1;
+ bcm47xx_fill_sprom_r1234589(sprom, prefix, fallback);
+- bcm47xx_fill_sprom_r12389(sprom, prefix, fallback);
+- bcm47xx_fill_sprom_r1(sprom, prefix, fallback);
+ }
+
+ bcm47xx_sprom_fill_auto(sprom, prefix, fallback);
+--
+1.8.4.5
+
diff --git a/target/linux/brcm47xx/patches-3.18/320-MIPS-BCM47XX-Devices-database-update-for-3.x.patch b/target/linux/brcm47xx/patches-3.18/320-MIPS-BCM47XX-Devices-database-update-for-3.x.patch
deleted file mode 100644
index fc7569becc..0000000000
--- a/target/linux/brcm47xx/patches-3.18/320-MIPS-BCM47XX-Devices-database-update-for-3.x.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-From be64eb65a1b24ea9528b0fcdd652ee2068da6106 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
-Date: Thu, 20 Nov 2014 20:56:27 +0100
-Subject: [PATCH] MIPS: BCM47XX: Devices database update for 3.x
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
----
- arch/mips/bcm47xx/board.c | 1 +
- arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h | 1 +
- 2 files changed, 2 insertions(+)
-
---- a/arch/mips/bcm47xx/board.c
-+++ b/arch/mips/bcm47xx/board.c
-@@ -165,9 +165,11 @@ static const
- struct bcm47xx_board_type_list1 bcm47xx_board_list_board_id[] __initconst = {
- {{BCM47XX_BOARD_NETGEAR_WGR614V8, "Netgear WGR614 V8"}, "U12H072T00_NETGEAR"},
- {{BCM47XX_BOARD_NETGEAR_WGR614V9, "Netgear WGR614 V9"}, "U12H094T00_NETGEAR"},
-+ {{BCM47XX_BOARD_NETGEAR_WGR614_V10, "Netgear WGR614 V10"}, "U12H139T01_NETGEAR"},
- {{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"},
-+ {{BCM47XX_BOARD_NETGEAR_WNDR3400_V3, "Netgear WNDR3400 V3"}, "U12H208T00_NETGEAR"},
- {{BCM47XX_BOARD_NETGEAR_WNDR3400VCNA, "Netgear WNDR3400 Vcna"}, "U12H155T01_NETGEAR"},
- {{BCM47XX_BOARD_NETGEAR_WNDR3700V3, "Netgear WNDR3700 V3"}, "U12H194T00_NETGEAR"},
- {{BCM47XX_BOARD_NETGEAR_WNDR4000, "Netgear WNDR4000"}, "U12H181T00_NETGEAR"},
---- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
-+++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx_board.h
-@@ -86,9 +86,11 @@ enum bcm47xx_board {
-
- BCM47XX_BOARD_NETGEAR_WGR614V8,
- BCM47XX_BOARD_NETGEAR_WGR614V9,
-+ BCM47XX_BOARD_NETGEAR_WGR614_V10,
- BCM47XX_BOARD_NETGEAR_WNDR3300,
- BCM47XX_BOARD_NETGEAR_WNDR3400V1,
- BCM47XX_BOARD_NETGEAR_WNDR3400V2,
-+ BCM47XX_BOARD_NETGEAR_WNDR3400_V3,
- BCM47XX_BOARD_NETGEAR_WNDR3400VCNA,
- BCM47XX_BOARD_NETGEAR_WNDR3700V3,
- BCM47XX_BOARD_NETGEAR_WNDR4000,
---- a/arch/mips/bcm47xx/buttons.c
-+++ b/arch/mips/bcm47xx/buttons.c
-@@ -327,6 +327,12 @@ bcm47xx_buttons_netgear_wndr3400v1[] __i
- };
-
- static const struct gpio_keys_button
-+bcm47xx_buttons_netgear_wndr3400_v3[] __initconst = {
-+ BCM47XX_GPIO_KEY(12, KEY_RESTART),
-+ BCM47XX_GPIO_KEY(23, KEY_WPS_BUTTON),
-+};
-+
-+static const struct gpio_keys_button
- bcm47xx_buttons_netgear_wndr3700v3[] __initconst = {
- BCM47XX_GPIO_KEY(2, KEY_RFKILL),
- BCM47XX_GPIO_KEY(3, KEY_RESTART),
-@@ -557,6 +563,9 @@ int __init bcm47xx_buttons_register(void
- case BCM47XX_BOARD_NETGEAR_WNDR3400V1:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3400v1);
- break;
-+ case BCM47XX_BOARD_NETGEAR_WNDR3400_V3:
-+ err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3400_v3);
-+ break;
- case BCM47XX_BOARD_NETGEAR_WNDR3700V3:
- err = bcm47xx_copy_bdata(bcm47xx_buttons_netgear_wndr3700v3);
- break;
diff --git a/target/linux/brcm47xx/patches-3.18/820-wgt634u-nvram-fix.patch b/target/linux/brcm47xx/patches-3.18/820-wgt634u-nvram-fix.patch
index 818641bcbe..714fb6d18a 100644
--- a/target/linux/brcm47xx/patches-3.18/820-wgt634u-nvram-fix.patch
+++ b/target/linux/brcm47xx/patches-3.18/820-wgt634u-nvram-fix.patch
@@ -243,7 +243,7 @@ out the configuration than the in kernel cfe config reader.
+
--- a/arch/mips/bcm47xx/nvram.c
+++ b/arch/mips/bcm47xx/nvram.c
-@@ -33,6 +33,8 @@ struct nvram_header {
+@@ -36,6 +36,8 @@ struct nvram_header {
static char nvram_buf[NVRAM_SPACE];
static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000};
@@ -252,7 +252,7 @@ out the configuration than the in kernel cfe config reader.
static u32 find_nvram_size(void __iomem *end)
{
-@@ -62,6 +64,26 @@ static int nvram_find_and_copy(void __io
+@@ -65,6 +67,26 @@ static int nvram_find_and_copy(void __io
return -EEXIST;
}
@@ -279,7 +279,7 @@ out the configuration than the in kernel cfe config reader.
/* TODO: when nvram is on nand flash check for bad blocks first. */
off = FLASH_MIN;
while (off <= lim) {
-@@ -189,6 +211,13 @@ int bcm47xx_nvram_getenv(const char *nam
+@@ -181,6 +203,13 @@ int bcm47xx_nvram_getenv(const char *nam
return err;
}
diff --git a/target/linux/brcm47xx/patches-3.18/830-huawei_e970_support.patch b/target/linux/brcm47xx/patches-3.18/830-huawei_e970_support.patch
index bab051a647..e475532d42 100644
--- a/target/linux/brcm47xx/patches-3.18/830-huawei_e970_support.patch
+++ b/target/linux/brcm47xx/patches-3.18/830-huawei_e970_support.patch
@@ -8,7 +8,7 @@
#include <asm/bootinfo.h>
#include <asm/idle.h>
#include <asm/prom.h>
-@@ -249,6 +250,33 @@ static struct fixed_phy_status bcm47xx_f
+@@ -248,6 +249,33 @@ static struct fixed_phy_status bcm47xx_f
.duplex = DUPLEX_FULL,
};
@@ -42,7 +42,7 @@
static int __init bcm47xx_register_bus_complete(void)
{
switch (bcm47xx_bus_type) {
-@@ -268,6 +296,7 @@ static int __init bcm47xx_register_bus_c
+@@ -267,6 +295,7 @@ static int __init bcm47xx_register_bus_c
bcm47xx_workarounds();
fixed_phy_add(PHY_POLL, 0, &bcm47xx_fixed_phy_status);
diff --git a/target/linux/brcm47xx/patches-3.18/980-wnr834b_no_cardbus_invariant.patch b/target/linux/brcm47xx/patches-3.18/980-wnr834b_no_cardbus_invariant.patch
index 86c00c93a3..74a8916ab1 100644
--- a/target/linux/brcm47xx/patches-3.18/980-wnr834b_no_cardbus_invariant.patch
+++ b/target/linux/brcm47xx/patches-3.18/980-wnr834b_no_cardbus_invariant.patch
@@ -1,6 +1,6 @@
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
-@@ -119,6 +119,10 @@ static int bcm47xx_get_invariants(struct
+@@ -118,6 +118,10 @@ static int bcm47xx_get_invariants(struct
if (bcm47xx_nvram_getenv("cardbus", buf, sizeof(buf)) >= 0)
iv->has_cardbus_slot = !!simple_strtoul(buf, NULL, 10);
diff --git a/target/linux/brcm47xx/patches-3.18/999-wl_exports.patch b/target/linux/brcm47xx/patches-3.18/999-wl_exports.patch
index c74c4cca24..e3c6691c8c 100644
--- a/target/linux/brcm47xx/patches-3.18/999-wl_exports.patch
+++ b/target/linux/brcm47xx/patches-3.18/999-wl_exports.patch
@@ -1,6 +1,6 @@
--- a/arch/mips/bcm47xx/nvram.c
+++ b/arch/mips/bcm47xx/nvram.c
-@@ -31,7 +31,8 @@ struct nvram_header {
+@@ -34,7 +34,8 @@ struct nvram_header {
u32 config_ncdl; /* ncdl values for memc */
};