aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--target/linux/bcm53xx/files/drivers/firmware/broadcom/bcm47xx_nvram.c39
-rw-r--r--target/linux/bcm53xx/patches-3.18/110-firmware-backport-NVRAM-driver.patch36
2 files changed, 23 insertions, 52 deletions
diff --git a/target/linux/bcm53xx/files/drivers/firmware/broadcom/bcm47xx_nvram.c b/target/linux/bcm53xx/files/drivers/firmware/broadcom/bcm47xx_nvram.c
index b6e1cc733d..d0055a4bdf 100644
--- a/target/linux/bcm53xx/files/drivers/firmware/broadcom/bcm47xx_nvram.c
+++ b/target/linux/bcm53xx/files/drivers/firmware/broadcom/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>
@@ -19,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
@@ -138,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
diff --git a/target/linux/bcm53xx/patches-3.18/110-firmware-backport-NVRAM-driver.patch b/target/linux/bcm53xx/patches-3.18/110-firmware-backport-NVRAM-driver.patch
index 9b0a508f2c..e6199db315 100644
--- a/target/linux/bcm53xx/patches-3.18/110-firmware-backport-NVRAM-driver.patch
+++ b/target/linux/bcm53xx/patches-3.18/110-firmware-backport-NVRAM-driver.patch
@@ -8,14 +8,13 @@ Content-Transfer-Encoding: 8bit
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
- arch/arm/Kconfig | 2 ++
- drivers/firmware/Kconfig | 1 +
- drivers/firmware/Makefile | 1 +
- drivers/firmware/broadcom/bcm47xx_nvram.c | 3 ++-
- drivers/net/ethernet/broadcom/b44.c | 2 +-
- drivers/net/ethernet/broadcom/bgmac.c | 2 +-
- drivers/ssb/driver_chipcommon_pmu.c | 2 +-
- 7 files changed, 9 insertions(+), 4 deletions(-)
+ arch/arm/Kconfig | 2 ++
+ drivers/firmware/Kconfig | 1 +
+ drivers/firmware/Makefile | 1 +
+ drivers/net/ethernet/broadcom/b44.c | 2 +-
+ drivers/net/ethernet/broadcom/bgmac.c | 2 +-
+ drivers/ssb/driver_chipcommon_pmu.c | 2 +-
+ 6 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 4733d32..ab18030 100644
@@ -54,27 +53,6 @@ index 5373dc5..e251f2b 100644
obj-$(CONFIG_GOOGLE_FIRMWARE) += google/
obj-$(CONFIG_EFI) += efi/
obj-$(CONFIG_UEFI_CPER) += efi/
-diff --git a/drivers/firmware/broadcom/bcm47xx_nvram.c b/drivers/firmware/broadcom/bcm47xx_nvram.c
-index b6e1cc7..8ca7358 100644
---- a/drivers/firmware/broadcom/bcm47xx_nvram.c
-+++ b/drivers/firmware/broadcom/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>
-@@ -34,7 +35,7 @@ struct nvram_header {
- };
-
- static char nvram_buf[NVRAM_SPACE];
--static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000};
-+static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000, 0x160000, 0x180000};
-
- static u32 find_nvram_size(void __iomem *end)
- {
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
index 8a7bf7d..bf3bcd6 100644
--- a/drivers/net/ethernet/broadcom/b44.c