summaryrefslogtreecommitdiff
path: root/target/linux/pxa-2.6/patches/005-mtd.patch
blob: 6156b6a930c0f06db5e427ccfb35185c57aa46c6 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
diff -Nurb linux-2.6.17/drivers/mtd/chips/cfi_cmdset_0001.c linux-2.6.17-patched/drivers/mtd/chips/cfi_cmdset_0001.c
--- linux-2.6.17/drivers/mtd/chips/cfi_cmdset_0001.c	2006-06-17 18:49:35.000000000 -0700
+++ linux-2.6.17-patched/drivers/mtd/chips/cfi_cmdset_0001.c	2006-09-25 11:27:06.000000000 -0700
@@ -40,7 +40,7 @@
 /* #define CMDSET0001_DISABLE_WRITE_SUSPEND */
 
 // debugging, turns off buffer write mode if set to 1
-#define FORCE_WORD_WRITE 0
+#define FORCE_WORD_WRITE 1
 
 #define MANUFACTURER_INTEL	0x0089
 #define I82802AB	0x00ad
diff -Nurb linux-2.6.17/drivers/mtd/maps/lubbock-flash.c linux-2.6.17-patched/drivers/mtd/maps/lubbock-flash.c
--- linux-2.6.17/drivers/mtd/maps/lubbock-flash.c	2006-06-17 18:49:35.000000000 -0700
+++ linux-2.6.17-patched/drivers/mtd/maps/lubbock-flash.c	2006-09-25 10:50:08.000000000 -0700
@@ -26,6 +26,7 @@
 #include <asm/hardware.h>
 #include <asm/arch/pxa-regs.h>
 #include <asm/arch/lubbock.h>
+#include <linux/mtd/concat.h>
 
 
 #define ROM_ADDR	0x00000000
@@ -48,24 +49,27 @@
 	.inval_cache = 	lubbock_map_inval_cache,
 } };
 
-static struct mtd_partition lubbock_partitions[] = {
+static struct mtd_partition lubbock_partitions[] =
+{
 	{
-		.name =		"Bootloader",
-		.size =		0x00040000,
-		.offset =	0,
-		.mask_flags =	MTD_WRITEABLE  /* force read-only */
-	},{
-		.name =		"Kernel",
-		.size =		0x00100000,
-		.offset =	0x00040000,
-	},{
-		.name =		"Filesystem",
-		.size =		MTDPART_SIZ_FULL,
-		.offset =	0x00140000
-	}
+		.name   =   "root",
+		.offset =   0x00410000
+	},
+	{
+		.name   =  "kernel",
+		.size   =  0x00150000,
+		.offset =  0x000B0000
+	},
+	{
+		.name   =  "bootloader",
+		.size   =  0x000B0000,
+		.offset =  0x00000000
+	},
 };
 
+
 static struct mtd_info *mymtds[2];
+static struct mtd_info *merged_mtd;
 static struct mtd_partition *parsed_parts[2];
 static int nr_parsed_parts[2];
 
@@ -83,8 +87,8 @@
 	printk(KERN_NOTICE "Lubbock configured to boot from %s (bank %d)\n",
 	       flashboot?"Flash":"ROM", flashboot);
 
-	lubbock_maps[flashboot^1].name = "Lubbock Application Flash";
-	lubbock_maps[flashboot].name = "Lubbock Boot ROM";
+	lubbock_maps[flashboot^1].name = "Flash-1";
+	lubbock_maps[flashboot].name = "Flash-0";
 
 	for (i = 0; i < 2; i++) {
 		lubbock_maps[i].virt = ioremap(lubbock_maps[i].phys, WINDOW_SIZE);
@@ -125,25 +129,23 @@
 	if (!mymtds[0] && !mymtds[1])
 		return ret;
 
-	for (i = 0; i < 2; i++) {
-		if (!mymtds[i]) {
-			printk(KERN_WARNING "%s is absent. Skipping\n", lubbock_maps[i].name);
-		} else if (nr_parsed_parts[i]) {
-			add_mtd_partitions(mymtds[i], parsed_parts[i], nr_parsed_parts[i]);
-		} else if (!i) {
-			printk("Using static partitions on %s\n", lubbock_maps[i].name);
-			add_mtd_partitions(mymtds[i], lubbock_partitions, ARRAY_SIZE(lubbock_partitions));
-		} else {
-			printk("Registering %s as whole device\n", lubbock_maps[i].name);
-			add_mtd_device(mymtds[i]);
-		}
-	}
+	if (mymtds[0] && mymtds[1]) {
+		merged_mtd = mtd_concat_create(mymtds, 2, "Concated Flash #1 and #2");
+		if(merged_mtd)
+			add_mtd_partitions(merged_mtd, lubbock_partitions, ARRAY_SIZE(lubbock_partitions));
+		else
+			printk("YoKu: Failed to concate\n");
 	return 0;
+	}
 }
 
 static void __exit cleanup_lubbock(void)
 {
 	int i;
+
+	del_mtd_partitions(merged_mtd);
+	map_destroy(merged_mtd);
+
 	for (i = 0; i < 2; i++) {