brcm47xx: update mtd drivers
[openwrt.git] / target / linux / brcm47xx / patches-3.10 / 022-mtd-bcm47xxpart-detect-factory-partition.patch
1 From 33094c736cd36a6cecadae6bce4daba89dabc326 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
3 Date: Mon, 21 Oct 2013 22:35:34 +0200
4 Subject: [PATCH] mtd: bcm47xxpart: detect "factory" partition
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 A new type of partition with magic FCTY was found on Huawei E970:
10 46 43 54 59 4b 51 37 4e  41 42 31 38 41 32 39 30  |FCTYKQ7NAB18A290|
11
12 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
13 Signed-off-by: Brian Norris <computersforpeace@gmail.com>
14 ---
15  drivers/mtd/bcm47xxpart.c |    8 ++++++++
16  1 file changed, 8 insertions(+)
17
18 --- a/drivers/mtd/bcm47xxpart.c
19 +++ b/drivers/mtd/bcm47xxpart.c
20 @@ -27,6 +27,7 @@
21  
22  /* Magics */
23  #define BOARD_DATA_MAGIC               0x5246504D      /* MPFR */
24 +#define FACTORY_MAGIC                  0x59544346      /* FCTY */
25  #define POT_MAGIC1                     0x54544f50      /* POTT */
26  #define POT_MAGIC2                     0x504f          /* OP */
27  #define ML_MAGIC1                      0x39685a42
28 @@ -117,6 +118,13 @@ static int bcm47xxpart_parse(struct mtd_
29                                              offset, MTD_WRITEABLE);
30                         continue;
31                 }
32 +
33 +               /* Found on Huawei E970 */
34 +               if (buf[0x000 / 4] == FACTORY_MAGIC) {
35 +                       bcm47xxpart_add_part(&parts[curr_part++], "factory",
36 +                                            offset, MTD_WRITEABLE);
37 +                       continue;
38 +               }
39  
40                 /* POT(TOP) */
41                 if (buf[0x000 / 4] == POT_MAGIC1 &&