aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm63xx/patches-4.9
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2018-07-27 21:54:08 +0200
committerRafał Miłecki <rafal@milecki.pl>2018-07-31 10:14:47 +0200
commitb5b5f5dfa64519120369c5f5d26ba922c9fbcd4f (patch)
tree541b990524050299fc323d8a27a5b20b72249b5b /target/linux/brcm63xx/patches-4.9
parentf8e57f450dad5d5e7f40f24158472bda0896f6f5 (diff)
downloadupstream-b5b5f5dfa64519120369c5f5d26ba922c9fbcd4f.tar.gz
upstream-b5b5f5dfa64519120369c5f5d26ba922c9fbcd4f.tar.bz2
upstream-b5b5f5dfa64519120369c5f5d26ba922c9fbcd4f.zip
kernel: backport mtd support for subpartitions in DT
This is a new & warm feature that allows nesting partiitons in DT and mixing their types (e.g. static vs. dynamic). It's very useful for boards that have most partitions static but some of them require extra parsing (e.g. a "firmware" partition). It's required to successfully backport support for new devices using that new syntax in their DT files. Since brcm63xx has a custom alternative patch the upstream one is being reverted for it. The plan is to make brcm63xx use the upstream implementation. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit 2a598bbaa3f75b7051c2453a6ccf706191cf2153)
Diffstat (limited to 'target/linux/brcm63xx/patches-4.9')
-rw-r--r--target/linux/brcm63xx/patches-4.9/119-Revert-mtd-partitions-use-DT-info-for-parsing-partit.patch81
1 files changed, 81 insertions, 0 deletions
diff --git a/target/linux/brcm63xx/patches-4.9/119-Revert-mtd-partitions-use-DT-info-for-parsing-partit.patch b/target/linux/brcm63xx/patches-4.9/119-Revert-mtd-partitions-use-DT-info-for-parsing-partit.patch
new file mode 100644
index 0000000000..a3e9ce86a3
--- /dev/null
+++ b/target/linux/brcm63xx/patches-4.9/119-Revert-mtd-partitions-use-DT-info-for-parsing-partit.patch
@@ -0,0 +1,81 @@
+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++) {
+ /*