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