brcm47xx: add initial support for kernel 3.8
[openwrt/svn-archive/archive.git] / target / linux / brcm47xx / patches-3.8 / 024-mtd-bcm47xxpart-get-nvram.patch
1 --- a/drivers/mtd/bcm47xxpart.c
2 +++ b/drivers/mtd/bcm47xxpart.c
3 @@ -58,6 +58,7 @@ static int bcm47xxpart_parse(struct mtd_
4 int trx_part = -1;
5 int last_trx_part = -1;
6 int max_bytes_to_read = 0x8004;
7 + bool found_nvram = false;
8
9 if (blocksize <= 0x10000)
10 blocksize = 0x10000;
11 @@ -107,6 +108,7 @@ static int bcm47xxpart_parse(struct mtd_
12 bcm47xxpart_add_part(&parts[curr_part++], "nvram",
13 offset, 0);
14 offset = rounddown(offset, blocksize);
15 + found_nvram = true;
16 continue;
17 }
18
19 @@ -194,6 +196,15 @@ static int bcm47xxpart_parse(struct mtd_
20 parts[trx_part].offset;
21 }
22
23 + if (!found_nvram) {
24 + pr_err("can not find a nvram partition reserve last block\n");
25 + bcm47xxpart_add_part(&parts[curr_part++], "nvram_guess",
26 + master->size - blocksize, MTD_WRITEABLE);
27 + for (i = 0; i < curr_part; i++) {
28 + if (parts[i].size + parts[i].offset == master->size)
29 + parts[i].offset -= blocksize;
30 + }
31 + }
32 *pparts = parts;
33 return curr_part;
34 };