diff --git a/target/linux/brcm63xx/patches-4.14/119-Revert-mtd-partitions-use-DT-info-for-parsing-partit.patch b/target/linux/brcm63xx/patches-4.14/119-Revert-mtd-partitions-use-DT-info-for-parsing-partit.patch new file mode 100644 index 00000000000..073a8a45f6b --- /dev/null +++ b/target/linux/brcm63xx/patches-4.14/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?= +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++) { + /* 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 00000000000..a3e9ce86a3b --- /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?= +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++) { + /* diff --git a/target/linux/generic/backport-4.14/046-v4.19-mtd-partitions-use-DT-info-for-parsing-partitions-wi.patch b/target/linux/generic/backport-4.14/046-v4.19-mtd-partitions-use-DT-info-for-parsing-partitions-wi.patch new file mode 100644 index 00000000000..1bb3563f15f --- /dev/null +++ b/target/linux/generic/backport-4.14/046-v4.19-mtd-partitions-use-DT-info-for-parsing-partitions-wi.patch @@ -0,0 +1,102 @@ +From 76a832254ab05502c9394cc51ded6f0abe0e0bee Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 13 Jul 2018 16:32:21 +0200 +Subject: [PATCH] mtd: partitions: use DT info for parsing partitions with + "compatible" prop +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +So far only flash devices could be described in DT regarding partitions +parsing. That could be done with "partitions" subnode and a proper +"compatible" string. + +Some devices may use hierarchical (multi-level) layouts and may mix used +layouts (fixed and dynamic). Describing that in DT is done by specifying +"compatible" for DT-represented partition plus optionally more +properties and/or subnodes. + +To support such layouts each DT partition has to be checked for +additional description. + +Please note this implementation will work in parallel with support for +partition type specified for non-DT setups. That already works since +commit 1a0915be1926 ("mtd: partitions: add support for partition +parsers"). + +Signed-off-by: Rafał Miłecki +Signed-off-by: Boris Brezillon +--- + drivers/mtd/mtdpart.c | 33 +++++++++++++-------------------- + 1 file changed, 13 insertions(+), 20 deletions(-) + +--- a/drivers/mtd/mtdpart.c ++++ b/drivers/mtd/mtdpart.c +@@ -370,22 +370,6 @@ 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) +@@ -783,8 +767,8 @@ int add_mtd_partitions(struct mtd_info * + + add_mtd_device(&slave->mtd); + mtd_add_partition_attrs(slave); +- if (parts[i].types) +- mtd_parse_part(slave, parts[i].types); ++ /* Look for subpartitions */ ++ parse_mtd_partitions(&slave->mtd, parts[i].types, NULL); + + cur_offset = slave->offset + slave->mtd.size; + } +@@ -860,6 +844,12 @@ 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, +@@ -930,7 +920,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) +@@ -993,7 +985,8 @@ int parse_mtd_partitions(struct mtd_info + int ret, err = 0; + + if (!types) +- types = default_mtd_part_types; ++ types = mtd_is_partition(master) ? default_subpartition_types : ++ default_mtd_part_types; + + for ( ; *types; types++) { + /* diff --git a/target/linux/generic/backport-4.9/402-v4.19-mtd-partitions-use-DT-info-for-parsing-partitions-wi.patch b/target/linux/generic/backport-4.9/402-v4.19-mtd-partitions-use-DT-info-for-parsing-partitions-wi.patch new file mode 100644 index 00000000000..4186f5599f1 --- /dev/null +++ b/target/linux/generic/backport-4.9/402-v4.19-mtd-partitions-use-DT-info-for-parsing-partitions-wi.patch @@ -0,0 +1,102 @@ +From 76a832254ab05502c9394cc51ded6f0abe0e0bee Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 13 Jul 2018 16:32:21 +0200 +Subject: [PATCH] mtd: partitions: use DT info for parsing partitions with + "compatible" prop +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +So far only flash devices could be described in DT regarding partitions +parsing. That could be done with "partitions" subnode and a proper +"compatible" string. + +Some devices may use hierarchical (multi-level) layouts and may mix used +layouts (fixed and dynamic). Describing that in DT is done by specifying +"compatible" for DT-represented partition plus optionally more +properties and/or subnodes. + +To support such layouts each DT partition has to be checked for +additional description. + +Please note this implementation will work in parallel with support for +partition type specified for non-DT setups. That already works since +commit 1a0915be1926 ("mtd: partitions: add support for partition +parsers"). + +Signed-off-by: Rafał Miłecki +Signed-off-by: Boris Brezillon +--- + drivers/mtd/mtdpart.c | 33 +++++++++++++-------------------- + 1 file changed, 13 insertions(+), 20 deletions(-) + +--- a/drivers/mtd/mtdpart.c ++++ b/drivers/mtd/mtdpart.c +@@ -370,22 +370,6 @@ 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) +@@ -775,8 +759,8 @@ int add_mtd_partitions(struct mtd_info * + + add_mtd_device(&slave->mtd); + mtd_add_partition_attrs(slave); +- if (parts[i].types) +- mtd_parse_part(slave, parts[i].types); ++ /* Look for subpartitions */ ++ parse_mtd_partitions(&slave->mtd, parts[i].types, NULL); + + cur_offset = slave->offset + slave->mtd.size; + } +@@ -852,6 +836,12 @@ 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, +@@ -922,7 +912,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) +@@ -985,7 +977,8 @@ int parse_mtd_partitions(struct mtd_info + int ret, err = 0; + + if (!types) +- types = default_mtd_part_types; ++ types = mtd_is_partition(master) ? default_subpartition_types : ++ default_mtd_part_types; + + for ( ; *types; types++) { + /* diff --git a/target/linux/generic/pending-4.14/161-mtd-part-add-generic-parsing-of-linux-part-probe.patch b/target/linux/generic/pending-4.14/161-mtd-part-add-generic-parsing-of-linux-part-probe.patch index 0e858d93bba..80ff556a49d 100644 --- a/target/linux/generic/pending-4.14/161-mtd-part-add-generic-parsing-of-linux-part-probe.patch +++ b/target/linux/generic/pending-4.14/161-mtd-part-add-generic-parsing-of-linux-part-probe.patch @@ -104,7 +104,7 @@ Signed-off-by: Hauke Mehrtens #include #include -@@ -851,6 +852,32 @@ void deregister_mtd_parser(struct mtd_pa +@@ -835,6 +836,32 @@ void deregister_mtd_parser(struct mtd_pa EXPORT_SYMBOL_GPL(deregister_mtd_parser); /* @@ -137,7 +137,7 @@ Signed-off-by: Hauke Mehrtens * Do not forget to update 'parse_mtd_partitions()' kerneldoc comment if you * are changing this array! */ -@@ -991,6 +1018,13 @@ int parse_mtd_partitions(struct mtd_info +@@ -983,6 +1010,13 @@ int parse_mtd_partitions(struct mtd_info struct mtd_partitions pparts = { }; struct mtd_part_parser *parser; int ret, err = 0; @@ -150,8 +150,8 @@ Signed-off-by: Hauke Mehrtens + } if (!types) - types = default_mtd_part_types; -@@ -1031,6 +1065,7 @@ int parse_mtd_partitions(struct mtd_info + types = mtd_is_partition(master) ? default_subpartition_types : +@@ -1024,6 +1058,7 @@ int parse_mtd_partitions(struct mtd_info if (ret < 0 && !err) err = ret; } diff --git a/target/linux/generic/pending-4.14/400-mtd-add-rootfs-split-support.patch b/target/linux/generic/pending-4.14/400-mtd-add-rootfs-split-support.patch index bc2272d26de..68737803d8f 100644 --- a/target/linux/generic/pending-4.14/400-mtd-add-rootfs-split-support.patch +++ b/target/linux/generic/pending-4.14/400-mtd-add-rootfs-split-support.patch @@ -60,7 +60,7 @@ Signed-off-by: Felix Fietkau /* * Given a pointer to the MTD object in the mtd_part structure, we can retrieve * the pointer to that structure. -@@ -674,6 +678,7 @@ int mtd_add_partition(struct mtd_info *p +@@ -658,6 +662,7 @@ int mtd_add_partition(struct mtd_info *p mutex_unlock(&mtd_partitions_mutex); add_mtd_device(&new->mtd); @@ -68,7 +68,7 @@ Signed-off-by: Felix Fietkau mtd_add_partition_attrs(new); -@@ -752,6 +757,35 @@ int mtd_del_partition(struct mtd_info *m +@@ -736,6 +741,35 @@ int mtd_del_partition(struct mtd_info *m } EXPORT_SYMBOL_GPL(mtd_del_partition); @@ -104,14 +104,14 @@ Signed-off-by: Felix Fietkau /* * This function, given a master MTD object and a partition table, creates * and registers slave MTD objects which are bound to the master according to -@@ -783,6 +817,7 @@ int add_mtd_partitions(struct mtd_info * +@@ -767,6 +801,7 @@ int add_mtd_partitions(struct mtd_info * mutex_unlock(&mtd_partitions_mutex); 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); + /* Look for subpartitions */ + parse_mtd_partitions(&slave->mtd, parts[i].types, NULL); --- a/include/linux/mtd/partitions.h +++ b/include/linux/mtd/partitions.h @@ -110,5 +110,7 @@ int mtd_add_partition(struct mtd_info *m diff --git a/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch b/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch index 7cb336bd182..503a86e24ef 100644 --- a/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch +++ b/target/linux/generic/pending-4.14/401-mtd-add-support-for-different-partition-parser-types.patch @@ -9,7 +9,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -1120,6 +1120,62 @@ void mtd_part_parser_cleanup(struct mtd_ +@@ -1113,6 +1113,62 @@ void mtd_part_parser_cleanup(struct mtd_ } } diff --git a/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch b/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch index cfd178e42d1..f93b816a381 100644 --- a/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch +++ b/target/linux/generic/pending-4.14/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -757,6 +757,36 @@ int mtd_del_partition(struct mtd_info *m +@@ -741,6 +741,36 @@ int mtd_del_partition(struct mtd_info *m } EXPORT_SYMBOL_GPL(mtd_del_partition); @@ -47,7 +47,7 @@ Signed-off-by: Gabor Juhos #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME #else -@@ -765,6 +795,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition); +@@ -749,6 +779,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition); static void split_firmware(struct mtd_info *master, struct mtd_part *part) { @@ -55,7 +55,7 @@ Signed-off-by: Gabor Juhos } void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, -@@ -779,6 +810,12 @@ static void mtd_partition_split(struct m +@@ -763,6 +794,12 @@ static void mtd_partition_split(struct m if (rootfs_found) return; diff --git a/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch b/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch index 98732e4c840..5df24dff091 100644 --- a/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch +++ b/target/linux/generic/pending-4.14/404-mtd-add-more-helper-functions.patch @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -787,6 +787,17 @@ run_parsers_by_type(struct mtd_part *sla +@@ -771,6 +771,17 @@ run_parsers_by_type(struct mtd_part *sla return nr_parts; } @@ -29,7 +29,7 @@ Signed-off-by: Gabor Juhos #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME #else -@@ -1230,6 +1241,24 @@ int mtd_is_partition(const struct mtd_in +@@ -1223,6 +1234,24 @@ int mtd_is_partition(const struct mtd_in } EXPORT_SYMBOL_GPL(mtd_is_partition); diff --git a/target/linux/generic/pending-4.14/411-mtd-partial_eraseblock_write.patch b/target/linux/generic/pending-4.14/411-mtd-partial_eraseblock_write.patch index 2fcaec52dcb..8497bfb7658 100644 --- a/target/linux/generic/pending-4.14/411-mtd-partial_eraseblock_write.patch +++ b/target/linux/generic/pending-4.14/411-mtd-partial_eraseblock_write.patch @@ -107,7 +107,7 @@ Signed-off-by: Felix Fietkau if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN) instr->fail_addr -= part->offset; -@@ -586,19 +655,22 @@ static struct mtd_part *allocate_partiti +@@ -570,19 +639,22 @@ static struct mtd_part *allocate_partiti remainder = do_div(tmp, wr_alignment); if ((slave->mtd.flags & MTD_WRITEABLE) && remainder) { /* Doesn't start on a boundary of major erase size */ diff --git a/target/linux/generic/pending-4.9/161-mtd-part-add-generic-parsing-of-linux-part-probe.patch b/target/linux/generic/pending-4.9/161-mtd-part-add-generic-parsing-of-linux-part-probe.patch index e2a0e4887d4..1b6290fca25 100644 --- a/target/linux/generic/pending-4.9/161-mtd-part-add-generic-parsing-of-linux-part-probe.patch +++ b/target/linux/generic/pending-4.9/161-mtd-part-add-generic-parsing-of-linux-part-probe.patch @@ -114,7 +114,7 @@ Signed-off-by: Hauke Mehrtens #include #include -@@ -843,6 +844,42 @@ void deregister_mtd_parser(struct mtd_pa +@@ -827,6 +828,42 @@ void deregister_mtd_parser(struct mtd_pa EXPORT_SYMBOL_GPL(deregister_mtd_parser); /* @@ -157,7 +157,7 @@ Signed-off-by: Hauke Mehrtens * Do not forget to update 'parse_mtd_partitions()' kerneldoc comment if you * are changing this array! */ -@@ -983,6 +1020,13 @@ int parse_mtd_partitions(struct mtd_info +@@ -975,6 +1012,13 @@ int parse_mtd_partitions(struct mtd_info struct mtd_partitions pparts = { }; struct mtd_part_parser *parser; int ret, err = 0; @@ -170,8 +170,8 @@ Signed-off-by: Hauke Mehrtens + } if (!types) - types = default_mtd_part_types; -@@ -1023,6 +1067,7 @@ int parse_mtd_partitions(struct mtd_info + types = mtd_is_partition(master) ? default_subpartition_types : +@@ -1016,6 +1060,7 @@ int parse_mtd_partitions(struct mtd_info if (ret < 0 && !err) err = ret; } diff --git a/target/linux/generic/pending-4.9/400-mtd-add-rootfs-split-support.patch b/target/linux/generic/pending-4.9/400-mtd-add-rootfs-split-support.patch index 10be7a16ab7..b0cb2731417 100644 --- a/target/linux/generic/pending-4.9/400-mtd-add-rootfs-split-support.patch +++ b/target/linux/generic/pending-4.9/400-mtd-add-rootfs-split-support.patch @@ -60,7 +60,7 @@ Signed-off-by: Felix Fietkau /* * Given a pointer to the MTD object in the mtd_part structure, we can retrieve * the pointer to that structure. -@@ -666,6 +670,7 @@ int mtd_add_partition(struct mtd_info *p +@@ -650,6 +654,7 @@ int mtd_add_partition(struct mtd_info *p mutex_unlock(&mtd_partitions_mutex); add_mtd_device(&new->mtd); @@ -68,7 +68,7 @@ Signed-off-by: Felix Fietkau mtd_add_partition_attrs(new); -@@ -744,6 +749,35 @@ int mtd_del_partition(struct mtd_info *m +@@ -728,6 +733,35 @@ int mtd_del_partition(struct mtd_info *m } EXPORT_SYMBOL_GPL(mtd_del_partition); @@ -104,14 +104,14 @@ Signed-off-by: Felix Fietkau /* * This function, given a master MTD object and a partition table, creates * and registers slave MTD objects which are bound to the master according to -@@ -775,6 +809,7 @@ int add_mtd_partitions(struct mtd_info * +@@ -759,6 +793,7 @@ int add_mtd_partitions(struct mtd_info * mutex_unlock(&mtd_partitions_mutex); 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); + /* Look for subpartitions */ + parse_mtd_partitions(&slave->mtd, parts[i].types, NULL); --- a/include/linux/mtd/partitions.h +++ b/include/linux/mtd/partitions.h @@ -110,5 +110,7 @@ int mtd_add_partition(struct mtd_info *m diff --git a/target/linux/generic/pending-4.9/401-mtd-add-support-for-different-partition-parser-types.patch b/target/linux/generic/pending-4.9/401-mtd-add-support-for-different-partition-parser-types.patch index 63affd7eed9..1188cc656f9 100644 --- a/target/linux/generic/pending-4.9/401-mtd-add-support-for-different-partition-parser-types.patch +++ b/target/linux/generic/pending-4.9/401-mtd-add-support-for-different-partition-parser-types.patch @@ -9,7 +9,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -1122,6 +1122,62 @@ void mtd_part_parser_cleanup(struct mtd_ +@@ -1115,6 +1115,62 @@ void mtd_part_parser_cleanup(struct mtd_ } } diff --git a/target/linux/generic/pending-4.9/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch b/target/linux/generic/pending-4.9/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch index 10d85514824..9c2650b45f1 100644 --- a/target/linux/generic/pending-4.9/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch +++ b/target/linux/generic/pending-4.9/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch @@ -10,7 +10,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -749,6 +749,36 @@ int mtd_del_partition(struct mtd_info *m +@@ -733,6 +733,36 @@ int mtd_del_partition(struct mtd_info *m } EXPORT_SYMBOL_GPL(mtd_del_partition); @@ -47,7 +47,7 @@ Signed-off-by: Gabor Juhos #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME #else -@@ -757,6 +787,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition); +@@ -741,6 +771,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition); static void split_firmware(struct mtd_info *master, struct mtd_part *part) { @@ -55,7 +55,7 @@ Signed-off-by: Gabor Juhos } void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, -@@ -771,6 +802,12 @@ static void mtd_partition_split(struct m +@@ -755,6 +786,12 @@ static void mtd_partition_split(struct m if (rootfs_found) return; diff --git a/target/linux/generic/pending-4.9/404-mtd-add-more-helper-functions.patch b/target/linux/generic/pending-4.9/404-mtd-add-more-helper-functions.patch index 076ec314b2e..886dece4f78 100644 --- a/target/linux/generic/pending-4.9/404-mtd-add-more-helper-functions.patch +++ b/target/linux/generic/pending-4.9/404-mtd-add-more-helper-functions.patch @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -779,6 +779,17 @@ run_parsers_by_type(struct mtd_part *sla +@@ -763,6 +763,17 @@ run_parsers_by_type(struct mtd_part *sla return nr_parts; } @@ -29,7 +29,7 @@ Signed-off-by: Gabor Juhos #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME #else -@@ -1232,6 +1243,24 @@ int mtd_is_partition(const struct mtd_in +@@ -1225,6 +1236,24 @@ int mtd_is_partition(const struct mtd_in } EXPORT_SYMBOL_GPL(mtd_is_partition); diff --git a/target/linux/generic/pending-4.9/411-mtd-partial_eraseblock_write.patch b/target/linux/generic/pending-4.9/411-mtd-partial_eraseblock_write.patch index e925983b309..4e66272bb61 100644 --- a/target/linux/generic/pending-4.9/411-mtd-partial_eraseblock_write.patch +++ b/target/linux/generic/pending-4.9/411-mtd-partial_eraseblock_write.patch @@ -107,7 +107,7 @@ Signed-off-by: Felix Fietkau if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN) instr->fail_addr -= part->offset; -@@ -578,19 +647,22 @@ static struct mtd_part *allocate_partiti +@@ -562,19 +631,22 @@ static struct mtd_part *allocate_partiti remainder = do_div(tmp, wr_alignment); if ((slave->mtd.flags & MTD_WRITEABLE) && remainder) { /* Doesn't start on a boundary of major erase size */ diff --git a/target/linux/generic/pending-4.9/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch b/target/linux/generic/pending-4.9/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch index d54c284c343..cbd185e0ae0 100644 --- a/target/linux/generic/pending-4.9/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch +++ b/target/linux/generic/pending-4.9/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch @@ -6,7 +6,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/mtd/parsers/parser_trx.c +++ b/drivers/mtd/parsers/parser_trx.c -@@ -29,6 +29,33 @@ struct trx_header { +@@ -30,6 +30,33 @@ struct trx_header { uint32_t offset[3]; } __packed; @@ -40,7 +40,7 @@ Signed-off-by: Rafał Miłecki static const char *parser_trx_data_part_name(struct mtd_info *master, size_t offset) { -@@ -83,21 +110,21 @@ static int parser_trx_parse(struct mtd_i +@@ -84,21 +111,21 @@ static int parser_trx_parse(struct mtd_i if (trx.offset[2]) { part = &parts[curr_part++]; part->name = "loader"; diff --git a/target/linux/generic/pending-4.9/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch b/target/linux/generic/pending-4.9/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch index a6d0828b995..39706415557 100644 --- a/target/linux/generic/pending-4.9/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch +++ b/target/linux/generic/pending-4.9/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch @@ -11,7 +11,7 @@ Signed-off-by: Rafał Miłecki --- a/drivers/mtd/bcm47xxpart.c +++ b/drivers/mtd/bcm47xxpart.c -@@ -39,6 +39,7 @@ +@@ -40,6 +40,7 @@ #define NVRAM_HEADER 0x48534C46 /* FLSH */ #define POT_MAGIC1 0x54544f50 /* POTT */ #define POT_MAGIC2 0x504f /* OP */ @@ -19,7 +19,7 @@ Signed-off-by: Rafał Miłecki #define ML_MAGIC1 0x39685a42 #define ML_MAGIC2 0x26594131 #define TRX_MAGIC 0x30524448 -@@ -182,6 +183,15 @@ static int bcm47xxpart_parse(struct mtd_ +@@ -183,6 +184,15 @@ static int bcm47xxpart_parse(struct mtd_ MTD_WRITEABLE); continue; }