kernel: add the latest mtd patch extending ofpart parser

This adds the latest version of ofpart commit. It hopefully
1. Doesn't break compilation
2. Doesn't break partitioning
(this time).

It's required to implement fixed partitioning with some quirks. It's
required by bcm53xx, bcm4908, kirkwood, lantiq and mvebu.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
(cherry picked from commit 7a7b2fd809)
This commit is contained in:
Rafał Miłecki
2021-03-01 18:12:48 +01:00
parent 67df3a829b
commit 543007917a
8 changed files with 41 additions and 43 deletions

View 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);
}
@@ -39,17 +39,16 @@
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);