bcm53xx: use bcm47xx_nvram.c with the latest patches
This will be hopefully a mainline version. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 45204
This commit is contained in:
parent
36e10677df
commit
bf828d3fd0
2 changed files with 24 additions and 53 deletions
|
@ -11,6 +11,7 @@
|
||||||
* option) any later version.
|
* option) any later version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <linux/io.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
|
@ -19,7 +20,7 @@
|
||||||
#include <linux/bcm47xx_nvram.h>
|
#include <linux/bcm47xx_nvram.h>
|
||||||
|
|
||||||
#define NVRAM_MAGIC 0x48534C46 /* 'FLSH' */
|
#define NVRAM_MAGIC 0x48534C46 /* 'FLSH' */
|
||||||
#define NVRAM_SPACE 0x8000
|
#define NVRAM_SPACE 0x10000
|
||||||
#define NVRAM_MAX_GPIO_ENTRIES 32
|
#define NVRAM_MAX_GPIO_ENTRIES 32
|
||||||
#define NVRAM_MAX_GPIO_VALUE_LEN 30
|
#define NVRAM_MAX_GPIO_VALUE_LEN 30
|
||||||
|
|
||||||
|
@ -138,36 +139,28 @@ static int nvram_init(void)
|
||||||
struct mtd_info *mtd;
|
struct mtd_info *mtd;
|
||||||
struct nvram_header header;
|
struct nvram_header header;
|
||||||
size_t bytes_read;
|
size_t bytes_read;
|
||||||
int err, i;
|
int err;
|
||||||
|
|
||||||
mtd = get_mtd_device_nm("nvram");
|
mtd = get_mtd_device_nm("nvram");
|
||||||
if (IS_ERR(mtd))
|
if (IS_ERR(mtd))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(nvram_sizes); i++) {
|
err = mtd_read(mtd, 0, sizeof(header), &bytes_read, (uint8_t *)&header);
|
||||||
loff_t from = mtd->size - nvram_sizes[i];
|
if (!err && header.magic == NVRAM_MAGIC) {
|
||||||
|
u8 *dst = (uint8_t *)nvram_buf;
|
||||||
|
size_t len = header.len;
|
||||||
|
|
||||||
if (from < 0)
|
if (header.len > NVRAM_SPACE) {
|
||||||
continue;
|
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);
|
||||||
err = mtd_read(mtd, from, sizeof(header), &bytes_read,
|
len = NVRAM_SPACE;
|
||||||
(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;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = mtd_read(mtd, from, len, &bytes_read, dst);
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = mtd_read(mtd, 0, len, &bytes_read, dst);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -8,14 +8,13 @@ Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
|
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
|
||||||
---
|
---
|
||||||
arch/arm/Kconfig | 2 ++
|
arch/arm/Kconfig | 2 ++
|
||||||
drivers/firmware/Kconfig | 1 +
|
drivers/firmware/Kconfig | 1 +
|
||||||
drivers/firmware/Makefile | 1 +
|
drivers/firmware/Makefile | 1 +
|
||||||
drivers/firmware/broadcom/bcm47xx_nvram.c | 3 ++-
|
drivers/net/ethernet/broadcom/b44.c | 2 +-
|
||||||
drivers/net/ethernet/broadcom/b44.c | 2 +-
|
drivers/net/ethernet/broadcom/bgmac.c | 2 +-
|
||||||
drivers/net/ethernet/broadcom/bgmac.c | 2 +-
|
drivers/ssb/driver_chipcommon_pmu.c | 2 +-
|
||||||
drivers/ssb/driver_chipcommon_pmu.c | 2 +-
|
6 files changed, 7 insertions(+), 3 deletions(-)
|
||||||
7 files changed, 9 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
|
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
|
||||||
index 4733d32..ab18030 100644
|
index 4733d32..ab18030 100644
|
||||||
|
@ -54,27 +53,6 @@ index 5373dc5..e251f2b 100644
|
||||||
obj-$(CONFIG_GOOGLE_FIRMWARE) += google/
|
obj-$(CONFIG_GOOGLE_FIRMWARE) += google/
|
||||||
obj-$(CONFIG_EFI) += efi/
|
obj-$(CONFIG_EFI) += efi/
|
||||||
obj-$(CONFIG_UEFI_CPER) += 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
|
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
|
||||||
index 8a7bf7d..bf3bcd6 100644
|
index 8a7bf7d..bf3bcd6 100644
|
||||||
--- a/drivers/net/ethernet/broadcom/b44.c
|
--- a/drivers/net/ethernet/broadcom/b44.c
|
||||||
|
|
Loading…
Reference in a new issue