Update brcm63xx flash map driver for 2.6.19
[openwrt/svn-archive/archive.git] / target / linux / brcm63xx-2.6 / patches / 040-bcm963xx_flashmap.patch
1 diff -urN linux-2.6.19/drivers/mtd/redboot.c linux-2.6.19.new/drivers/mtd/redboot.c
2 --- linux-2.6.19/drivers/mtd/redboot.c 2006-12-18 17:09:14.000000000 +0100
3 +++ linux-2.6.19.new/drivers/mtd/redboot.c 2006-12-18 17:14:26.000000000 +0100
4 @@ -39,7 +39,7 @@
5 return 1;
6 }
7
8 -static int parse_redboot_partitions(struct mtd_info *master,
9 +int parse_redboot_partitions(struct mtd_info *master,
10 struct mtd_partition **pparts,
11 unsigned long fis_origin)
12 {
13 @@ -132,6 +132,14 @@
14 goto out;
15 }
16
17 + if (!fis_origin) {
18 + for (i = 0; i < numslots; i++) {
19 + if (!strncmp(buf[i].name, "RedBoot", 8)) {
20 + fis_origin = (buf[i].flash_base & (master->size << 1) - 1);
21 + }
22 + }
23 + }
24 +
25 for (i = 0; i < numslots; i++) {
26 struct fis_list *new_fl, **prev;
27
28 @@ -154,9 +162,8 @@
29 new_fl->img = &buf[i];
30 if (fis_origin) {
31 buf[i].flash_base -= fis_origin;
32 - } else {
33 - buf[i].flash_base &= master->size-1;
34 }
35 + buf[i].flash_base &= (master->size << 1) - 1;
36
37 /* I'm sure the JFFS2 code has done me permanent damage.
38 * I now think the following is _normal_