diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2015-04-07 12:54:23 +0000 |
---|---|---|
committer | Rafał Miłecki <zajec5@gmail.com> | 2015-04-07 12:54:23 +0000 |
commit | dc4363da2f85eafea2d7eeba7f13f94cdff12556 (patch) | |
tree | 4a80bac0ec92271c069ffa9997365f56e1550a7e /target/linux/brcm47xx/patches-3.18/031-09-MIPS-BCM47XX-Don-t-try-guessing-NVRAM-size-on-MTD-pa.patch | |
parent | b5f93e8c0a9ab2d1580a5fdb37ae37492f84b853 (diff) | |
download | upstream-dc4363da2f85eafea2d7eeba7f13f94cdff12556.tar.gz upstream-dc4363da2f85eafea2d7eeba7f13f94cdff12556.tar.bz2 upstream-dc4363da2f85eafea2d7eeba7f13f94cdff12556.zip |
brcm47xx: backport MIPS BCM47XX patches queued for 4.1
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@45288 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/brcm47xx/patches-3.18/031-09-MIPS-BCM47XX-Don-t-try-guessing-NVRAM-size-on-MTD-pa.patch')
-rw-r--r-- | target/linux/brcm47xx/patches-3.18/031-09-MIPS-BCM47XX-Don-t-try-guessing-NVRAM-size-on-MTD-pa.patch | 79 |
1 files changed, 79 insertions, 0 deletions
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 + |