brcm63xx: add kernel 4.1 support
[openwrt/openwrt.git] / target / linux / brcm63xx / patches-4.1 / 311-bcm63xxpart_use_cfedetection.patch
1 --- a/drivers/mtd/bcm63xxpart.c
2 +++ b/drivers/mtd/bcm63xxpart.c
3 @@ -35,7 +35,7 @@
4
5 #include <asm/mach-bcm63xx/bcm63xx_nvram.h>
6 #include <asm/mach-bcm63xx/bcm963xx_tag.h>
7 -#include <asm/mach-bcm63xx/board_bcm963xx.h>
8 +#include <asm/mach-bcm63xx/bcm63xx_board.h>
9
10 #define BCM63XX_EXTENDED_SIZE 0xBFC00000 /* Extended flash address */
11
12 @@ -43,30 +43,6 @@
13
14 #define BCM63XX_CFE_MAGIC_OFFSET 0x4e0
15
16 -static int bcm63xx_detect_cfe(struct mtd_info *master)
17 -{
18 - char buf[9];
19 - int ret;
20 - size_t retlen;
21 -
22 - ret = mtd_read(master, BCM963XX_CFE_VERSION_OFFSET, 5, &retlen,
23 - (void *)buf);
24 - buf[retlen] = 0;
25 -
26 - if (ret)
27 - return ret;
28 -
29 - if (strncmp("cfe-v", buf, 5) == 0)
30 - return 0;
31 -
32 - /* very old CFE's do not have the cfe-v string, so check for magic */
33 - ret = mtd_read(master, BCM63XX_CFE_MAGIC_OFFSET, 8, &retlen,
34 - (void *)buf);
35 - buf[retlen] = 0;
36 -
37 - return strncmp("CFE1CFE1", buf, 8);
38 -}
39 -
40 static int bcm63xx_parse_cfe_partitions(struct mtd_info *master,
41 struct mtd_partition **pparts,
42 struct mtd_part_parser_data *data)
43 @@ -85,7 +61,7 @@ static int bcm63xx_parse_cfe_partitions(
44 u32 computed_crc;
45 bool rootfs_first = false;
46
47 - if (bcm63xx_detect_cfe(master))
48 + if (!bcm63xx_is_cfe_present())
49 return -EINVAL;
50
51 cfe_erasesize = max_t(uint32_t, master->erasesize,