ramips: rt3833: fix build breakage
[oweals/openwrt.git] / target / linux / brcm63xx / patches-4.14 / 311-bcm63xxpart_use_cfedetection.patch
1 --- a/drivers/mtd/bcm63xxpart.c
2 +++ b/drivers/mtd/bcm63xxpart.c
3 @@ -35,6 +35,8 @@
4  #include <linux/mtd/mtd.h>
5  #include <linux/mtd/partitions.h>
6  #include <linux/of.h>
7
8 +#include <asm/mach-bcm63xx/bcm63xx_board.h>
9  
10  #define BCM963XX_CFE_BLOCK_SIZE                SZ_64K  /* always at least 64KiB */
11  
12 @@ -46,30 +48,6 @@
13  #define STR_NULL_TERMINATE(x) \
14         do { char *_str = (x); _str[sizeof(x) - 1] = 0; } while (0)
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, BCM963XX_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_read_nvram(struct mtd_info *master,
41         struct bcm963xx_nvram *nvram)
42  {
43 @@ -152,7 +130,7 @@ static int bcm63xx_parse_cfe_partitions(
44         struct bcm963xx_nvram *nvram = NULL;
45         int ret;
46  
47 -       if (bcm63xx_detect_cfe(master))
48 +       if (!bcm63xx_is_cfe_present())
49                 return -EINVAL;
50  
51         nvram = vzalloc(sizeof(*nvram));