aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm53xx/files/drivers
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2015-04-01 07:21:59 +0000
committerRafał Miłecki <zajec5@gmail.com>2015-04-01 07:21:59 +0000
commitbf828d3fd096df494f43dd53e2358ef511dc5775 (patch)
tree098b653eaf09f8d23690d7620dc3ec2feeb422f4 /target/linux/bcm53xx/files/drivers
parent36e10677df06c7ce01c434736ffb37c53735fd0b (diff)
downloadupstream-bf828d3fd096df494f43dd53e2358ef511dc5775.tar.gz
upstream-bf828d3fd096df494f43dd53e2358ef511dc5775.tar.bz2
upstream-bf828d3fd096df494f43dd53e2358ef511dc5775.zip
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
Diffstat (limited to 'target/linux/bcm53xx/files/drivers')
-rw-r--r--target/linux/bcm53xx/files/drivers/firmware/broadcom/bcm47xx_nvram.c39
1 files changed, 16 insertions, 23 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