[kernel] adds patch to make Tantos (psb6970) switch buildable again
[openwrt.git] / target / linux / ar7 / patches-3.3 / 920-ar7part.patch
1 --- a/drivers/mtd/ar7part.c
2 +++ b/drivers/mtd/ar7part.c
3 @@ -29,11 +29,14 @@
4  #include <linux/magic.h>
5  #include <linux/module.h>
6  
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 @@ -45,6 +48,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 +        struct mtd_part_parser_data *data);
25 +
26  static int create_mtd_partitions(struct mtd_info *master,
27                                  struct mtd_partition **pparts,
28                                  struct mtd_part_parser_data *data)
29 @@ -58,6 +65,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, data);
41 +       }
42 +
43         ar7_parts = kzalloc(sizeof(*ar7_parts) * AR7_PARTS, GFP_KERNEL);
44         if (!ar7_parts)
45                 return -ENOMEM;
46 --- a/drivers/mtd/titanpart.c
47 +++ b/drivers/mtd/titanpart.c
48 @@ -149,7 +149,7 @@ static void titan_add_partition(char * e
49  }
50  int create_titan_partitions(struct mtd_info *master,
51         struct mtd_partition **pparts,
52 -       unsigned long origin)
53 +       struct mtd_part_parser_data *data)
54  {
55         struct nsp_img_hdr_head         hdr;
56         struct nsp_img_hdr_section_info sect_info;