kernel: add the latest mtd patch extending ofpart parser
[openwrt/openwrt.git] / target / linux / lantiq / patches-5.4 / 0101-find_active_root.patch
index b6b4ab7409fde6cf005909d43c45fdf85a89f06b..d541cc247cb08f07a10d70e785dd07f34f02f460 100644 (file)
@@ -1,6 +1,6 @@
---- a/drivers/mtd/parsers/ofpart.c
-+++ b/drivers/mtd/parsers/ofpart.c
-@@ -21,6 +21,38 @@ static bool node_has_compatible(struct d
+--- a/drivers/mtd/parsers/ofpart_core.c
++++ b/drivers/mtd/parsers/ofpart_core.c
+@@ -33,6 +33,38 @@ static bool node_has_compatible(struct d
        return of_get_property(pp, "compatible", NULL);
  }
  
  static int parse_fixed_partitions(struct mtd_info *master,
                                  const struct mtd_partition **pparts,
                                  struct mtd_part_parser_data *data)
-@@ -32,7 +64,8 @@ static int parse_fixed_partitions(struct
+@@ -46,6 +78,8 @@ static int parse_fixed_partitions(struct
        struct device_node *pp;
        int nr_parts, i, ret = 0;
        bool dedicated = true;
--
 +      uint8_t *proot_id = NULL;
 +      struct device_node **part_nodes;
  
        /* Pull of_node from the master device node */
        mtd_node = mtd_get_of_node(master);
-@@ -68,7 +101,9 @@ static int parse_fixed_partitions(struct
+@@ -86,7 +120,9 @@ static int parse_fixed_partitions(struct
                return 0;
  
        parts = kcalloc(nr_parts, sizeof(*parts), GFP_KERNEL);
@@ -60,7 +59,7 @@
                return -ENOMEM;
  
        i = 0;
-@@ -117,12 +152,22 @@ static int parse_fixed_partitions(struct
+@@ -135,6 +171,11 @@ static int parse_fixed_partitions(struct
                if (of_get_property(pp, "lock", &len))
                        parts[i].mask_flags |= MTD_POWERUP_LOCK;
  
@@ -72,8 +71,9 @@
                i++;
        }
  
-       if (!nr_parts)
-               goto ofpart_none;
+@@ -144,6 +185,11 @@ static int parse_fixed_partitions(struct
+       if (quirks && quirks->post_parse)
+               quirks->post_parse(master, parts, nr_parts);
  
 +      if (proot_id)
 +              brnboot_set_active_root_part(parts, part_nodes, nr_parts, proot_id);
@@ -83,7 +83,7 @@
        *pparts = parts;
        return nr_parts;
  
-@@ -133,6 +178,7 @@ ofpart_fail:
+@@ -154,6 +200,7 @@ ofpart_fail:
  ofpart_none:
        of_node_put(pp);
        kfree(parts);