1 --- a/drivers/mtd/bcm47xxpart.c
2 +++ b/drivers/mtd/bcm47xxpart.c
3 @@ -63,6 +63,7 @@ static int bcm47xxpart_parse(struct mtd_
4 struct trx_header *trx;
6 int last_trx_part = -1;
7 + int possible_nvram_sizes[] = { 0x8000, 0xF000, 0x10000, };
9 if (blocksize <= 0x10000)
11 @@ -99,13 +100,6 @@ static int bcm47xxpart_parse(struct mtd_
15 - /* Standard NVRAM */
16 - if (buf[0x000 / 4] == NVRAM_HEADER) {
17 - bcm47xxpart_add_part(&parts[curr_part++], "nvram",
23 * board_data starts with board_id which differs across boards,
24 * but we can use 'MPFR' (hopefully) magic at 0x100
25 @@ -174,6 +168,30 @@ static int bcm47xxpart_parse(struct mtd_
30 + /* Look for NVRAM at the end of the last block. */
31 + for (i = 0; i < ARRAY_SIZE(possible_nvram_sizes); i++) {
32 + if (curr_part > BCM47XXPART_MAX_PARTS) {
33 + pr_warn("Reached maximum number of partitions, scanning stopped!\n");
37 + offset = master->size - possible_nvram_sizes[i];
38 + if (mtd_read(master, offset, 0x4, &bytes_read,
39 + (uint8_t *)buf) < 0) {
40 + pr_err("mtd_read error while reading at offset 0x%X!\n",
45 + /* Standard NVRAM */
46 + if (buf[0] == NVRAM_HEADER) {
47 + bcm47xxpart_add_part(&parts[curr_part++], "nvram",
48 + master->size - blocksize, 0);