brcm63xx: drop own implementation of DT partitions in favour of upstream

The binding works the same, so we can just drop the revert and the patch.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
(cherry picked from commit abb28bec25)
This commit is contained in:
Jonas Gorski 2018-07-29 12:53:49 +02:00
parent 68a5e662c2
commit cfb72eed69
4 changed files with 0 additions and 320 deletions

View File

@ -1,81 +0,0 @@
From e62ff8f02eb3ae35ae7ece7c5272a689fd8b0bcd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
Date: Fri, 27 Jul 2018 21:37:48 +0200
Subject: [PATCH] Revert "mtd: partitions: use DT info for parsing partitions
with "compatible" prop"
This reverts commit 76a832254ab05502c9394cc51ded6f0abe0e0bee.
---
drivers/mtd/mtdpart.c | 33 ++++++++++++++++++++-------------
1 file changed, 20 insertions(+), 13 deletions(-)
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -453,6 +453,22 @@ static inline void free_partition(struct
kfree(p);
}
+/**
+ * mtd_parse_part - parse MTD partition looking for subpartitions
+ *
+ * @slave: part that is supposed to be a container and should be parsed
+ * @types: NULL-terminated array with names of partition parsers to try
+ *
+ * Some partitions are kind of containers with extra subpartitions (volumes).
+ * There can be various formats of such containers. This function tries to use
+ * specified parsers to analyze given partition and registers found
+ * subpartitions on success.
+ */
+static int mtd_parse_part(struct mtd_part *slave, const char *const *types)
+{
+ return parse_mtd_partitions(&slave->mtd, types, NULL);
+}
+
static struct mtd_part *allocate_partition(struct mtd_info *parent,
const struct mtd_partition *part, int partno,
uint64_t cur_offset)
@@ -932,8 +948,8 @@ int add_mtd_partitions(struct mtd_info *
add_mtd_device(&slave->mtd);
mtd_partition_split(master, slave);
mtd_add_partition_attrs(slave);
- /* Look for subpartitions */
- parse_mtd_partitions(&slave->mtd, parts[i].types, NULL);
+ if (parts[i].types)
+ mtd_parse_part(slave, parts[i].types);
cur_offset = slave->offset + slave->mtd.size;
}
@@ -1035,12 +1051,6 @@ static const char * const default_mtd_pa
NULL
};
-/* Check DT only when looking for subpartitions. */
-static const char * const default_subpartition_types[] = {
- "ofpart",
- NULL
-};
-
static int mtd_part_do_parse(struct mtd_part_parser *parser,
struct mtd_info *master,
struct mtd_partitions *pparts,
@@ -1111,9 +1121,7 @@ static int mtd_part_of_parse(struct mtd_
const char *fixed = "fixed-partitions";
int ret, err = 0;
- np = mtd_get_of_node(master);
- if (!mtd_is_partition(master))
- np = of_get_child_by_name(np, "partitions");
+ np = of_get_child_by_name(mtd_get_of_node(master), "partitions");
of_property_for_each_string(np, "compatible", prop, compat) {
parser = mtd_part_get_compatible_parser(compat);
if (!parser)
@@ -1183,8 +1191,7 @@ int parse_mtd_partitions(struct mtd_info
}
if (!types)
- types = mtd_is_partition(master) ? default_subpartition_types :
- default_mtd_part_types;
+ types = default_mtd_part_types;
for ( ; *types; types++) {
/*

View File

@ -1,79 +0,0 @@
From 53980645bb12bd8723ac226805ee171780b24196 Mon Sep 17 00:00:00 2001
From: Jonas Gorski <jonas.gorski@gmail.com>
Date: Mon, 26 Jun 2017 13:37:11 +0200
Subject: [PATCH 1/4] mtd: add of_match_table parsing for partition parsers
Allow partition parsers to be matched by attaching compatible strings to
partitions.
This allows specifying the expected format of flash partitions for
matching partition parsers.
Example:
flash@foo {
...
partitions {
compatible = "fixed-partitions";
cfe@0 {
reg = <0x0 0x10000>;
label = "cfe";
read-only;
};
firmware@10000 {
reg = <0x10000 0x3e0000>;
label = "firmware";
compatible = "brcm,bcm63xx-imagetag";
};
nvram@3f0000 {
reg = <0x3e0000 0x10000>;
label = "nvram";
};
};
};
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
---
drivers/mtd/mtdpart.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -948,8 +948,7 @@ int add_mtd_partitions(struct mtd_info *
add_mtd_device(&slave->mtd);
mtd_partition_split(master, slave);
mtd_add_partition_attrs(slave);
- if (parts[i].types)
- mtd_parse_part(slave, parts[i].types);
+ mtd_parse_part(slave, parts[i].types);
cur_offset = slave->offset + slave->mtd.size;
}
@@ -1121,7 +1120,9 @@ static int mtd_part_of_parse(struct mtd_
const char *fixed = "fixed-partitions";
int ret, err = 0;
- np = of_get_child_by_name(mtd_get_of_node(master), "partitions");
+ np = mtd_get_of_node(master);
+ if (!mtd_is_partition(master))
+ np = of_get_child_by_name(np, "partitions");
of_property_for_each_string(np, "compatible", prop, compat) {
parser = mtd_part_get_compatible_parser(compat);
if (!parser)
@@ -1190,8 +1191,12 @@ int parse_mtd_partitions(struct mtd_info
types = types_of;
}
- if (!types)
+ if (!types) {
+ if (mtd_is_partition(master))
+ return -ENOENT;
+
types = default_mtd_part_types;
+ }
for ( ; *types; types++) {
/*

View File

@ -1,81 +0,0 @@
From e62ff8f02eb3ae35ae7ece7c5272a689fd8b0bcd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
Date: Fri, 27 Jul 2018 21:37:48 +0200
Subject: [PATCH] Revert "mtd: partitions: use DT info for parsing partitions
with "compatible" prop"
This reverts commit 76a832254ab05502c9394cc51ded6f0abe0e0bee.
---
drivers/mtd/mtdpart.c | 33 ++++++++++++++++++++-------------
1 file changed, 20 insertions(+), 13 deletions(-)
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -453,6 +453,22 @@ static inline void free_partition(struct
kfree(p);
}
+/**
+ * mtd_parse_part - parse MTD partition looking for subpartitions
+ *
+ * @slave: part that is supposed to be a container and should be parsed
+ * @types: NULL-terminated array with names of partition parsers to try
+ *
+ * Some partitions are kind of containers with extra subpartitions (volumes).
+ * There can be various formats of such containers. This function tries to use
+ * specified parsers to analyze given partition and registers found
+ * subpartitions on success.
+ */
+static int mtd_parse_part(struct mtd_part *slave, const char *const *types)
+{
+ return parse_mtd_partitions(&slave->mtd, types, NULL);
+}
+
static struct mtd_part *allocate_partition(struct mtd_info *parent,
const struct mtd_partition *part, int partno,
uint64_t cur_offset)
@@ -924,8 +940,8 @@ int add_mtd_partitions(struct mtd_info *
add_mtd_device(&slave->mtd);
mtd_partition_split(master, slave);
mtd_add_partition_attrs(slave);
- /* Look for subpartitions */
- parse_mtd_partitions(&slave->mtd, parts[i].types, NULL);
+ if (parts[i].types)
+ mtd_parse_part(slave, parts[i].types);
cur_offset = slave->offset + slave->mtd.size;
}
@@ -1037,12 +1053,6 @@ static const char * const default_mtd_pa
NULL
};
-/* Check DT only when looking for subpartitions. */
-static const char * const default_subpartition_types[] = {
- "ofpart",
- NULL
-};
-
static int mtd_part_do_parse(struct mtd_part_parser *parser,
struct mtd_info *master,
struct mtd_partitions *pparts,
@@ -1113,9 +1123,7 @@ static int mtd_part_of_parse(struct mtd_
const char *fixed = "fixed-partitions";
int ret, err = 0;
- np = mtd_get_of_node(master);
- if (!mtd_is_partition(master))
- np = of_get_child_by_name(np, "partitions");
+ np = of_get_child_by_name(mtd_get_of_node(master), "partitions");
of_property_for_each_string(np, "compatible", prop, compat) {
parser = mtd_part_get_compatible_parser(compat);
if (!parser)
@@ -1185,8 +1193,7 @@ int parse_mtd_partitions(struct mtd_info
}
if (!types)
- types = mtd_is_partition(master) ? default_subpartition_types :
- default_mtd_part_types;
+ types = default_mtd_part_types;
for ( ; *types; types++) {
/*

View File

@ -1,79 +0,0 @@
From 53980645bb12bd8723ac226805ee171780b24196 Mon Sep 17 00:00:00 2001
From: Jonas Gorski <jonas.gorski@gmail.com>
Date: Mon, 26 Jun 2017 13:37:11 +0200
Subject: [PATCH 1/4] mtd: add of_match_table parsing for partition parsers
Allow partition parsers to be matched by attaching compatible strings to
partitions.
This allows specifying the expected format of flash partitions for
matching partition parsers.
Example:
flash@foo {
...
partitions {
compatible = "fixed-partitions";
cfe@0 {
reg = <0x0 0x10000>;
label = "cfe";
read-only;
};
firmware@10000 {
reg = <0x10000 0x3e0000>;
label = "firmware";
compatible = "brcm,bcm63xx-imagetag";
};
nvram@3f0000 {
reg = <0x3e0000 0x10000>;
label = "nvram";
};
};
};
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
---
drivers/mtd/mtdpart.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -940,8 +940,7 @@ int add_mtd_partitions(struct mtd_info *
add_mtd_device(&slave->mtd);
mtd_partition_split(master, slave);
mtd_add_partition_attrs(slave);
- if (parts[i].types)
- mtd_parse_part(slave, parts[i].types);
+ mtd_parse_part(slave, parts[i].types);
cur_offset = slave->offset + slave->mtd.size;
}
@@ -1123,7 +1122,9 @@ static int mtd_part_of_parse(struct mtd_
const char *fixed = "fixed-partitions";
int ret, err = 0;
- np = of_get_child_by_name(mtd_get_of_node(master), "partitions");
+ np = mtd_get_of_node(master);
+ if (!mtd_is_partition(master))
+ np = of_get_child_by_name(np, "partitions");
of_property_for_each_string(np, "compatible", prop, compat) {
parser = mtd_part_get_compatible_parser(compat);
if (!parser)
@@ -1192,8 +1193,12 @@ int parse_mtd_partitions(struct mtd_info
types = types_of;
}
- if (!types)
+ if (!types) {
+ if (mtd_is_partition(master))
+ return -ENOENT;
+
types = default_mtd_part_types;
+ }
for ( ; *types; types++) {
/*