aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2014-08-18 14:20:27 -0400
committerBrian Norris <computersforpeace@gmail.com>2014-09-18 02:15:38 -0400
commit024629fdca1bbb44a25d40c2362a878a7a67ce3b (patch)
tree09749a9214afe4435ab962a3ed131091aa6e41d5
parent022a478ce650f5c36d2a9badfd805368a90fb506 (diff)
mtd: bcm47xxpart: find NVRAM partitions in middle blocks
Old devices used to have NVRAM at the very end of flash and they could be unaligned (starting at some offset in a block). In new devices NVRAM can be located quite randomly, however it seems to always start at the beginning of a block. For example Netgear R6250 has NVRAM located right after the bootloader, before the kernel partition. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-rw-r--r--drivers/mtd/bcm47xxpart.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/mtd/bcm47xxpart.c b/drivers/mtd/bcm47xxpart.c
index adfa74c1bc45..8057f52a45b7 100644
--- a/drivers/mtd/bcm47xxpart.c
+++ b/drivers/mtd/bcm47xxpart.c
@@ -199,6 +199,17 @@ static int bcm47xxpart_parse(struct mtd_info *master,
199 continue; 199 continue;
200 } 200 }
201 201
202 /*
203 * New (ARM?) devices may have NVRAM in some middle block. Last
204 * block will be checked later, so skip it.
205 */
206 if (offset != master->size - blocksize &&
207 buf[0x000 / 4] == NVRAM_HEADER) {
208 bcm47xxpart_add_part(&parts[curr_part++], "nvram",
209 offset, 0);
210 continue;
211 }
212
202 /* Read middle of the block */ 213 /* Read middle of the block */
203 if (mtd_read(master, offset + 0x8000, 0x4, 214 if (mtd_read(master, offset + 0x8000, 0x4,
204 &bytes_read, (uint8_t *)buf) < 0) { 215 &bytes_read, (uint8_t *)buf) < 0) {