[ar7] add Titan MTD partitionning support (#6632)
[openwrt/svn-archive/archive.git] / target / linux / ar7 / patches-2.6.32 / 920-ar7part.patch
1 --- a/drivers/mtd/ar7part.c-back 2010-01-13 15:58:44.000000000 -0500
2 +++ b/drivers/mtd/ar7part.c 2010-01-13 16:16:05.000000000 -0500
3 @@ -27,12 +27,14 @@
4 #include <linux/mtd/partitions.h>
5 #include <linux/bootmem.h>
6 #include <linux/magic.h>
7 +#include <asm/mach-ar7/prom.h>
8
9 #define AR7_PARTS 4
10 #define ROOT_OFFSET 0xe0000
11
12 #define LOADER_MAGIC1 le32_to_cpu(0xfeedfa42)
13 #define LOADER_MAGIC2 le32_to_cpu(0xfeed1281)
14 +#define LOADER_MAGIC3 le32_to_cpu(0x434d4d4c)
15
16 #ifndef SQUASHFS_MAGIC
17 #define SQUASHFS_MAGIC 0x73717368
18 @@ -44,6 +46,10 @@ struct ar7_bin_rec {
19 unsigned int address;
20 };
21
22 +int create_titan_partitions(struct mtd_info *master,
23 + struct mtd_partition **pparts,
24 + unsigned long origin);
25 +
26 static int create_mtd_partitions(struct mtd_info *master,
27 struct mtd_partition **pparts,
28 unsigned long origin)
29 @@ -57,6 +63,16 @@ static int create_mtd_partitions(struct
30 int retries = 10;
31 struct mtd_partition *ar7_parts;
32
33 + const char *prod_id ;
34 + prod_id = prom_getenv("ProductID");
35 + if(prod_id &&
36 + (strcmp(prod_id, "CYWL")==0 ||
37 + strcmp(prod_id, "CYWM")==0 ||
38 + strcmp(prod_id, "CYLM")==0 ||
39 + strcmp(prod_id, "CYLL")==0)){
40 + return create_titan_partitions(master, pparts, origin);
41 + }
42 +
43 ar7_parts = kzalloc(sizeof(*ar7_parts) * AR7_PARTS, GFP_KERNEL);
44 if (!ar7_parts)
45 return -ENOMEM;
46 --- a/drivers/mtd/Makefile 2010-01-11 14:44:12.000000000 -0500
47 +++ a/drivers/mtd/Makefile 2010-02-03 13:44:38.000000000 -0500
48 @@ -12,6 +12,7 @@ obj-$(CONFIG_MTD_REDBOOT_PARTS) += redbo
49 obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o
50 obj-$(CONFIG_MTD_AFS_PARTS) += afs.o
51 obj-$(CONFIG_MTD_AR7_PARTS) += ar7part.o
52 +obj-$(CONFIG_MTD_AR7_PARTS) += titanpart.o
53 obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o
54 obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o
55