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