From 520f3f6374be807704203144cc50cc1b3fac1442 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Mon, 17 Aug 2015 06:17:37 +0000 Subject: [PATCH] kernel: move linux, part-probe dt parsing in generic code The "linux,part-probe" dts parsing is a pretty neat generic feature. It has been posted to kernel.org and could easily be reused by all targets. This change moves the patch to the 3.18 and 4.1 generic folders, and makes the feature available to all platforms who may want to use it. Signed-off-by: Mathieu Olivari Acked-by: Hauke Mehrtens SVN-Revision: 46654 --- ...-generic-parsing-of-linux-part-probe.patch | 175 ++++++++++++++++++ .../400-mtd-add-rootfs-split-support.patch | 16 +- ...for-different-partition-parser-types.patch | 4 +- ...arsers-for-rootfs-and-firmware-split.patch | 6 +- .../404-mtd-add-more-helper-functions.patch | 6 +- ...405-mtd-old-firmware-uimage-splitter.patch | 4 +- ...406-mtd-old-rootfs-squashfs-splitter.patch | 4 +- .../411-mtd-partial_eraseblock_write.patch | 8 +- .../412-mtd-partial_eraseblock_unlock.patch | 2 +- ...generic-parsing-of-linux-part-probe.patch} | 8 +- .../400-mtd-add-rootfs-split-support.patch | 15 +- ...for-different-partition-parser-types.patch | 4 +- ...arsers-for-rootfs-and-firmware-split.patch | 6 +- .../404-mtd-add-more-helper-functions.patch | 6 +- ...405-mtd-old-firmware-uimage-splitter.patch | 4 +- ...406-mtd-old-rootfs-squashfs-splitter.patch | 4 +- .../411-mtd-partial_eraseblock_write.patch | 8 +- .../412-mtd-partial_eraseblock_unlock.patch | 2 +- 18 files changed, 229 insertions(+), 53 deletions(-) create mode 100644 target/linux/generic/patches-3.18/140-mtd-part-add-generic-parsing-of-linux-part-probe.patch rename target/linux/{bcm53xx/patches-4.1/095-mtd-part-add-generic-parsing-of-linux-part-probe.patch => generic/patches-4.1/140-mtd-part-add-generic-parsing-of-linux-part-probe.patch} (95%) diff --git a/target/linux/generic/patches-3.18/140-mtd-part-add-generic-parsing-of-linux-part-probe.patch b/target/linux/generic/patches-3.18/140-mtd-part-add-generic-parsing-of-linux-part-probe.patch new file mode 100644 index 0000000000..bd34f9698a --- /dev/null +++ b/target/linux/generic/patches-3.18/140-mtd-part-add-generic-parsing-of-linux-part-probe.patch @@ -0,0 +1,175 @@ +From 173b0add0cff6558f950c0cb1eacfb729d482711 Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Sun, 17 May 2015 18:48:38 +0200 +Subject: [PATCH 4/8] mtd: part: add generic parsing of linux,part-probe + +This moves the linux,part-probe device tree parsing code from +physmap_of.c to mtdpart.c. Now all drivers can use this feature by just +providing a reference to their device tree node in struct +mtd_part_parser_data. + +Signed-off-by: Hauke Mehrtens +--- + Documentation/devicetree/bindings/mtd/nand.txt | 16 ++++++++++ + drivers/mtd/maps/physmap_of.c | 40 +----------------------- + drivers/mtd/mtdpart.c | 43 ++++++++++++++++++++++++++ + 3 files changed, 60 insertions(+), 39 deletions(-) + +--- a/Documentation/devicetree/bindings/mtd/nand.txt ++++ b/Documentation/devicetree/bindings/mtd/nand.txt +@@ -12,6 +12,22 @@ + - nand-ecc-step-size: integer representing the number of data bytes + that are covered by a single ECC step. + ++- linux,part-probe: list of name as strings of the partition parser ++ which should be used to parse the partition table. ++ They will be tried in the specified ordering and ++ the next one will be used if the previous one ++ failed. ++ ++ Example: linux,part-probe = "cmdlinepart", "ofpart"; ++ ++ This is also the default value, which will be used ++ if this attribute is not specified. It could be ++ that the flash driver in use overwrote the default ++ value and uses some other default. ++ ++ Possible values are: bcm47xxpart, afs, ar7part, ++ ofoldpart, ofpart, bcm63xxpart, RedBoot, cmdlinepart ++ + The ECC strength and ECC step size properties define the correction capability + of a controller. Together, they say a controller can correct "{strength} bit + errors per {size} bytes". +--- a/drivers/mtd/maps/physmap_of.c ++++ b/drivers/mtd/maps/physmap_of.c +@@ -114,45 +114,9 @@ static struct mtd_info *obsolete_probe(s + static const char * const part_probe_types_def[] = { + "cmdlinepart", "RedBoot", "ofpart", "ofoldpart", NULL }; + +-static const char * const *of_get_probes(struct device_node *dp) +-{ +- const char *cp; +- int cplen; +- unsigned int l; +- unsigned int count; +- const char **res; +- +- cp = of_get_property(dp, "linux,part-probe", &cplen); +- if (cp == NULL) +- return part_probe_types_def; +- +- count = 0; +- for (l = 0; l != cplen; l++) +- if (cp[l] == 0) +- count++; +- +- res = kzalloc((count + 1)*sizeof(*res), GFP_KERNEL); +- count = 0; +- while (cplen > 0) { +- res[count] = cp; +- l = strlen(cp) + 1; +- cp += l; +- cplen -= l; +- count++; +- } +- return res; +-} +- +-static void of_free_probes(const char * const *probes) +-{ +- if (probes != part_probe_types_def) +- kfree(probes); +-} +- + static struct of_device_id of_flash_match[]; + static int of_flash_probe(struct platform_device *dev) + { +- const char * const *part_probe_types; + const struct of_device_id *match; + struct device_node *dp = dev->dev.of_node; + struct resource res; +@@ -302,10 +266,8 @@ static int of_flash_probe(struct platfor + goto err_out; + + ppdata.of_node = dp; +- part_probe_types = of_get_probes(dp); +- mtd_device_parse_register(info->cmtd, part_probe_types, &ppdata, ++ mtd_device_parse_register(info->cmtd, part_probe_types_def, &ppdata, + NULL, 0); +- of_free_probes(part_probe_types); + + kfree(mtd_list); + +--- a/drivers/mtd/mtdpart.c ++++ b/drivers/mtd/mtdpart.c +@@ -29,6 +29,7 @@ + #include + #include + #include ++#include + #include + + #include "mtdcore.h" +@@ -702,6 +703,40 @@ void deregister_mtd_parser(struct mtd_pa + EXPORT_SYMBOL_GPL(deregister_mtd_parser); + + /* ++ * Parses the linux,part-probe device tree property. ++ * When a non null value is returned it has to be freed with kfree() by ++ * the caller. ++ */ ++static const char * const *of_get_probes(struct device_node *dp) ++{ ++ const char *cp; ++ int cplen; ++ unsigned int l; ++ unsigned int count; ++ const char **res; ++ ++ cp = of_get_property(dp, "linux,part-probe", &cplen); ++ if (cp == NULL) ++ return NULL; ++ ++ count = 0; ++ for (l = 0; l != cplen; l++) ++ if (cp[l] == 0) ++ count++; ++ ++ res = kzalloc((count + 1) * sizeof(*res), GFP_KERNEL); ++ count = 0; ++ while (cplen > 0) { ++ res[count] = cp; ++ l = strlen(cp) + 1; ++ cp += l; ++ cplen -= l; ++ count++; ++ } ++ return res; ++} ++ ++/* + * Do not forget to update 'parse_mtd_partitions()' kerneldoc comment if you + * are changing this array! + */ +@@ -737,6 +772,13 @@ int parse_mtd_partitions(struct mtd_info + { + struct mtd_part_parser *parser; + int ret = 0; ++ const char *const *types_of = NULL; ++ ++ if (data && data->of_node) { ++ types_of = of_get_probes(data->of_node); ++ if (types_of != NULL) ++ types = types_of; ++ } + + if (!types) + types = default_mtd_part_types; +@@ -755,6 +797,7 @@ int parse_mtd_partitions(struct mtd_info + break; + } + } ++ kfree(types_of); + return ret; + } + diff --git a/target/linux/generic/patches-3.18/400-mtd-add-rootfs-split-support.patch b/target/linux/generic/patches-3.18/400-mtd-add-rootfs-split-support.patch index bf69a3509d..0a6e134ed5 100644 --- a/target/linux/generic/patches-3.18/400-mtd-add-rootfs-split-support.patch +++ b/target/linux/generic/patches-3.18/400-mtd-add-rootfs-split-support.patch @@ -26,10 +26,10 @@ depends on m --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -29,9 +29,11 @@ - #include +@@ -30,9 +30,11 @@ #include #include + #include +#include #include @@ -38,7 +38,7 @@ /* Our partition linked list */ static LIST_HEAD(mtd_partitions); -@@ -45,13 +47,14 @@ struct mtd_part { +@@ -46,13 +48,14 @@ struct mtd_part { struct list_head list; }; @@ -54,7 +54,7 @@ /* * MTD methods which simply translate the effective address and pass through * to the _real_ device. -@@ -547,8 +550,10 @@ out_register: +@@ -548,8 +551,10 @@ out_register: return slave; } @@ -67,7 +67,7 @@ { struct mtd_partition part; struct mtd_part *p, *new; -@@ -580,21 +585,24 @@ int mtd_add_partition(struct mtd_info *m +@@ -581,21 +586,24 @@ int mtd_add_partition(struct mtd_info *m end = offset + length; mutex_lock(&mtd_partitions_mutex); @@ -102,7 +102,7 @@ return ret; err_inv: -@@ -604,6 +612,12 @@ err_inv: +@@ -605,6 +613,12 @@ err_inv: } EXPORT_SYMBOL_GPL(mtd_add_partition); @@ -115,7 +115,7 @@ int mtd_del_partition(struct mtd_info *master, int partno) { struct mtd_part *slave, *next; -@@ -627,6 +641,35 @@ int mtd_del_partition(struct mtd_info *m +@@ -628,6 +642,35 @@ int mtd_del_partition(struct mtd_info *m } EXPORT_SYMBOL_GPL(mtd_del_partition); @@ -151,7 +151,7 @@ /* * 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 -@@ -656,6 +699,7 @@ int add_mtd_partitions(struct mtd_info * +@@ -657,6 +700,7 @@ int add_mtd_partitions(struct mtd_info * mutex_unlock(&mtd_partitions_mutex); add_mtd_device(&slave->mtd); diff --git a/target/linux/generic/patches-3.18/401-mtd-add-support-for-different-partition-parser-types.patch b/target/linux/generic/patches-3.18/401-mtd-add-support-for-different-partition-parser-types.patch index 2ddcbff011..684234161a 100644 --- a/target/linux/generic/patches-3.18/401-mtd-add-support-for-different-partition-parser-types.patch +++ b/target/linux/generic/patches-3.18/401-mtd-add-support-for-different-partition-parser-types.patch @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -729,6 +729,30 @@ static struct mtd_part_parser *get_parti +@@ -730,6 +730,30 @@ static struct mtd_part_parser *get_parti #define put_partition_parser(p) do { module_put((p)->owner); } while (0) @@ -42,7 +42,7 @@ Signed-off-by: Gabor Juhos void register_mtd_parser(struct mtd_part_parser *p) { spin_lock(&part_parser_lock); -@@ -802,6 +826,38 @@ int parse_mtd_partitions(struct mtd_info +@@ -845,6 +869,38 @@ int parse_mtd_partitions(struct mtd_info return ret; } diff --git a/target/linux/generic/patches-3.18/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch b/target/linux/generic/patches-3.18/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch index 4d994221c5..dead0fbf5f 100644 --- a/target/linux/generic/patches-3.18/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch +++ b/target/linux/generic/patches-3.18/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -641,6 +641,37 @@ int mtd_del_partition(struct mtd_info *m +@@ -642,6 +642,37 @@ int mtd_del_partition(struct mtd_info *m } EXPORT_SYMBOL_GPL(mtd_del_partition); @@ -38,7 +38,7 @@ #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME #else -@@ -649,6 +680,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition); +@@ -650,6 +681,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition); static void split_firmware(struct mtd_info *master, struct mtd_part *part) { @@ -46,7 +46,7 @@ } void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, -@@ -663,6 +695,12 @@ static void mtd_partition_split(struct m +@@ -664,6 +696,12 @@ static void mtd_partition_split(struct m if (rootfs_found) return; diff --git a/target/linux/generic/patches-3.18/404-mtd-add-more-helper-functions.patch b/target/linux/generic/patches-3.18/404-mtd-add-more-helper-functions.patch index d7c38011ec..b2f62c115d 100644 --- a/target/linux/generic/patches-3.18/404-mtd-add-more-helper-functions.patch +++ b/target/linux/generic/patches-3.18/404-mtd-add-more-helper-functions.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -445,14 +445,12 @@ static struct mtd_part *allocate_partiti +@@ -446,14 +446,12 @@ static struct mtd_part *allocate_partiti if (slave->offset == MTDPART_OFS_APPEND) slave->offset = cur_offset; if (slave->offset == MTDPART_OFS_NXTBLK) { @@ -18,7 +18,7 @@ } if (slave->offset == MTDPART_OFS_RETAIN) { slave->offset = cur_offset; -@@ -672,6 +670,17 @@ run_parsers_by_type(struct mtd_part *sla +@@ -673,6 +671,17 @@ run_parsers_by_type(struct mtd_part *sla return nr_parts; } @@ -36,7 +36,7 @@ #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME #else -@@ -913,6 +922,24 @@ int mtd_is_partition(const struct mtd_in +@@ -956,6 +965,24 @@ int mtd_is_partition(const struct mtd_in } EXPORT_SYMBOL_GPL(mtd_is_partition); diff --git a/target/linux/generic/patches-3.18/405-mtd-old-firmware-uimage-splitter.patch b/target/linux/generic/patches-3.18/405-mtd-old-firmware-uimage-splitter.patch index df1d726e86..7e74c4e538 100644 --- a/target/linux/generic/patches-3.18/405-mtd-old-firmware-uimage-splitter.patch +++ b/target/linux/generic/patches-3.18/405-mtd-old-firmware-uimage-splitter.patch @@ -14,7 +14,7 @@ endmenu --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -681,6 +681,37 @@ mtd_pad_erasesize(struct mtd_info *mtd, +@@ -682,6 +682,37 @@ mtd_pad_erasesize(struct mtd_info *mtd, return len; } @@ -52,7 +52,7 @@ #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME #else -@@ -689,7 +720,14 @@ mtd_pad_erasesize(struct mtd_info *mtd, +@@ -690,7 +721,14 @@ mtd_pad_erasesize(struct mtd_info *mtd, static void split_firmware(struct mtd_info *master, struct mtd_part *part) { diff --git a/target/linux/generic/patches-3.18/406-mtd-old-rootfs-squashfs-splitter.patch b/target/linux/generic/patches-3.18/406-mtd-old-rootfs-squashfs-splitter.patch index ca81958432..cc548efb60 100644 --- a/target/linux/generic/patches-3.18/406-mtd-old-rootfs-squashfs-splitter.patch +++ b/target/linux/generic/patches-3.18/406-mtd-old-rootfs-squashfs-splitter.patch @@ -14,7 +14,7 @@ default y --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -681,6 +681,47 @@ mtd_pad_erasesize(struct mtd_info *mtd, +@@ -682,6 +682,47 @@ mtd_pad_erasesize(struct mtd_info *mtd, return len; } @@ -62,7 +62,7 @@ #define UBOOT_MAGIC 0x27051956 static void split_uimage(struct mtd_info *master, struct mtd_part *part) -@@ -743,7 +784,10 @@ static void mtd_partition_split(struct m +@@ -744,7 +785,10 @@ static void mtd_partition_split(struct m return; if (!strcmp(part->mtd.name, "rootfs")) { diff --git a/target/linux/generic/patches-3.18/411-mtd-partial_eraseblock_write.patch b/target/linux/generic/patches-3.18/411-mtd-partial_eraseblock_write.patch index 7692d3dd42..5d5c6ed5d3 100644 --- a/target/linux/generic/patches-3.18/411-mtd-partial_eraseblock_write.patch +++ b/target/linux/generic/patches-3.18/411-mtd-partial_eraseblock_write.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -35,6 +35,8 @@ +@@ -36,6 +36,8 @@ #include "mtdcore.h" #include "mtdsplit/mtdsplit.h" @@ -9,7 +9,7 @@ /* Our partition linked list */ static LIST_HEAD(mtd_partitions); static DEFINE_MUTEX(mtd_partitions_mutex); -@@ -233,13 +235,61 @@ static int part_erase(struct mtd_info *m +@@ -234,13 +236,61 @@ static int part_erase(struct mtd_info *m struct mtd_part *part = PART(mtd); int ret; @@ -71,7 +71,7 @@ return ret; } -@@ -247,7 +297,25 @@ void mtd_erase_callback(struct erase_inf +@@ -248,7 +298,25 @@ void mtd_erase_callback(struct erase_inf { if (instr->mtd->_erase == part_erase) { struct mtd_part *part = PART(instr->mtd); @@ -97,7 +97,7 @@ if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN) instr->fail_addr -= part->offset; instr->addr -= part->offset; -@@ -514,17 +582,20 @@ static struct mtd_part *allocate_partiti +@@ -515,17 +583,20 @@ static struct mtd_part *allocate_partiti if ((slave->mtd.flags & MTD_WRITEABLE) && mtd_mod_by_eb(slave->offset, &slave->mtd)) { /* Doesn't start on a boundary of major erase size */ diff --git a/target/linux/generic/patches-3.18/412-mtd-partial_eraseblock_unlock.patch b/target/linux/generic/patches-3.18/412-mtd-partial_eraseblock_unlock.patch index ba45accd4b..62f9d5bad0 100644 --- a/target/linux/generic/patches-3.18/412-mtd-partial_eraseblock_unlock.patch +++ b/target/linux/generic/patches-3.18/412-mtd-partial_eraseblock_unlock.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -334,7 +334,14 @@ static int part_lock(struct mtd_info *mt +@@ -335,7 +335,14 @@ static int part_lock(struct mtd_info *mt static int part_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) { struct mtd_part *part = PART(mtd); diff --git a/target/linux/bcm53xx/patches-4.1/095-mtd-part-add-generic-parsing-of-linux-part-probe.patch b/target/linux/generic/patches-4.1/140-mtd-part-add-generic-parsing-of-linux-part-probe.patch similarity index 95% rename from target/linux/bcm53xx/patches-4.1/095-mtd-part-add-generic-parsing-of-linux-part-probe.patch rename to target/linux/generic/patches-4.1/140-mtd-part-add-generic-parsing-of-linux-part-probe.patch index 686696e61e..18ec833f70 100644 --- a/target/linux/bcm53xx/patches-4.1/095-mtd-part-add-generic-parsing-of-linux-part-probe.patch +++ b/target/linux/generic/patches-4.1/140-mtd-part-add-generic-parsing-of-linux-part-probe.patch @@ -107,10 +107,10 @@ Signed-off-by: Hauke Mehrtens #include #include +#include - #include #include #include -@@ -992,6 +993,40 @@ void deregister_mtd_parser(struct mtd_pa + +@@ -719,6 +720,40 @@ void deregister_mtd_parser(struct mtd_pa EXPORT_SYMBOL_GPL(deregister_mtd_parser); /* @@ -151,7 +151,7 @@ Signed-off-by: Hauke Mehrtens * Do not forget to update 'parse_mtd_partitions()' kerneldoc comment if you * are changing this array! */ -@@ -1027,6 +1062,13 @@ int parse_mtd_partitions(struct mtd_info +@@ -754,6 +789,13 @@ int parse_mtd_partitions(struct mtd_info { struct mtd_part_parser *parser; int ret = 0; @@ -165,7 +165,7 @@ Signed-off-by: Hauke Mehrtens if (!types) types = default_mtd_part_types; -@@ -1045,6 +1087,7 @@ int parse_mtd_partitions(struct mtd_info +@@ -772,6 +814,7 @@ int parse_mtd_partitions(struct mtd_info break; } } diff --git a/target/linux/generic/patches-4.1/400-mtd-add-rootfs-split-support.patch b/target/linux/generic/patches-4.1/400-mtd-add-rootfs-split-support.patch index cbc2325d84..ba64e093a9 100644 --- a/target/linux/generic/patches-4.1/400-mtd-add-rootfs-split-support.patch +++ b/target/linux/generic/patches-4.1/400-mtd-add-rootfs-split-support.patch @@ -26,11 +26,12 @@ depends on m --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -29,10 +29,12 @@ +@@ -29,11 +29,13 @@ #include #include #include +#include + #include #include #include @@ -39,7 +40,7 @@ /* Our partition linked list */ static LIST_HEAD(mtd_partitions); -@@ -46,13 +48,14 @@ struct mtd_part { +@@ -47,13 +49,14 @@ struct mtd_part { struct list_head list; }; @@ -55,7 +56,7 @@ /* * MTD methods which simply translate the effective address and pass through * to the _real_ device. -@@ -578,8 +581,10 @@ static int mtd_add_partition_attrs(struc +@@ -579,8 +582,10 @@ static int mtd_add_partition_attrs(struc return ret; } @@ -68,7 +69,7 @@ { struct mtd_partition part; struct mtd_part *new; -@@ -611,6 +616,7 @@ int mtd_add_partition(struct mtd_info *m +@@ -612,6 +617,7 @@ int mtd_add_partition(struct mtd_info *m mutex_unlock(&mtd_partitions_mutex); add_mtd_device(&new->mtd); @@ -76,7 +77,7 @@ mtd_add_partition_attrs(new); -@@ -618,6 +624,12 @@ int mtd_add_partition(struct mtd_info *m +@@ -619,6 +625,12 @@ int mtd_add_partition(struct mtd_info *m } EXPORT_SYMBOL_GPL(mtd_add_partition); @@ -89,7 +90,7 @@ int mtd_del_partition(struct mtd_info *master, int partno) { struct mtd_part *slave, *next; -@@ -643,6 +655,35 @@ int mtd_del_partition(struct mtd_info *m +@@ -644,6 +656,35 @@ int mtd_del_partition(struct mtd_info *m } EXPORT_SYMBOL_GPL(mtd_del_partition); @@ -125,7 +126,7 @@ /* * 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 -@@ -672,6 +713,7 @@ int add_mtd_partitions(struct mtd_info * +@@ -673,6 +714,7 @@ int add_mtd_partitions(struct mtd_info * mutex_unlock(&mtd_partitions_mutex); add_mtd_device(&slave->mtd); diff --git a/target/linux/generic/patches-4.1/401-mtd-add-support-for-different-partition-parser-types.patch b/target/linux/generic/patches-4.1/401-mtd-add-support-for-different-partition-parser-types.patch index 178247e83b..31dee98efd 100644 --- a/target/linux/generic/patches-4.1/401-mtd-add-support-for-different-partition-parser-types.patch +++ b/target/linux/generic/patches-4.1/401-mtd-add-support-for-different-partition-parser-types.patch @@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -744,6 +744,30 @@ static struct mtd_part_parser *get_parti +@@ -745,6 +745,30 @@ static struct mtd_part_parser *get_parti #define put_partition_parser(p) do { module_put((p)->owner); } while (0) @@ -42,7 +42,7 @@ Signed-off-by: Gabor Juhos void register_mtd_parser(struct mtd_part_parser *p) { spin_lock(&part_parser_lock); -@@ -817,6 +841,38 @@ int parse_mtd_partitions(struct mtd_info +@@ -860,6 +884,38 @@ int parse_mtd_partitions(struct mtd_info return ret; } diff --git a/target/linux/generic/patches-4.1/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch b/target/linux/generic/patches-4.1/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch index 23e09c2efc..725dbe8b4d 100644 --- a/target/linux/generic/patches-4.1/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch +++ b/target/linux/generic/patches-4.1/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -655,6 +655,37 @@ int mtd_del_partition(struct mtd_info *m +@@ -656,6 +656,37 @@ int mtd_del_partition(struct mtd_info *m } EXPORT_SYMBOL_GPL(mtd_del_partition); @@ -38,7 +38,7 @@ #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME #else -@@ -663,6 +694,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition); +@@ -664,6 +695,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition); static void split_firmware(struct mtd_info *master, struct mtd_part *part) { @@ -46,7 +46,7 @@ } void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, -@@ -677,6 +709,12 @@ static void mtd_partition_split(struct m +@@ -678,6 +710,12 @@ static void mtd_partition_split(struct m if (rootfs_found) return; diff --git a/target/linux/generic/patches-4.1/404-mtd-add-more-helper-functions.patch b/target/linux/generic/patches-4.1/404-mtd-add-more-helper-functions.patch index fe3a2129de..42e5cfdd45 100644 --- a/target/linux/generic/patches-4.1/404-mtd-add-more-helper-functions.patch +++ b/target/linux/generic/patches-4.1/404-mtd-add-more-helper-functions.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -452,14 +452,12 @@ static struct mtd_part *allocate_partiti +@@ -453,14 +453,12 @@ static struct mtd_part *allocate_partiti if (slave->offset == MTDPART_OFS_APPEND) slave->offset = cur_offset; if (slave->offset == MTDPART_OFS_NXTBLK) { @@ -18,7 +18,7 @@ } if (slave->offset == MTDPART_OFS_RETAIN) { slave->offset = cur_offset; -@@ -686,6 +684,17 @@ run_parsers_by_type(struct mtd_part *sla +@@ -687,6 +685,17 @@ run_parsers_by_type(struct mtd_part *sla return nr_parts; } @@ -36,7 +36,7 @@ #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME #else -@@ -928,6 +937,24 @@ int mtd_is_partition(const struct mtd_in +@@ -971,6 +980,24 @@ int mtd_is_partition(const struct mtd_in } EXPORT_SYMBOL_GPL(mtd_is_partition); diff --git a/target/linux/generic/patches-4.1/405-mtd-old-firmware-uimage-splitter.patch b/target/linux/generic/patches-4.1/405-mtd-old-firmware-uimage-splitter.patch index 127d647b16..430fd6f025 100644 --- a/target/linux/generic/patches-4.1/405-mtd-old-firmware-uimage-splitter.patch +++ b/target/linux/generic/patches-4.1/405-mtd-old-firmware-uimage-splitter.patch @@ -14,7 +14,7 @@ endmenu --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -695,6 +695,37 @@ mtd_pad_erasesize(struct mtd_info *mtd, +@@ -696,6 +696,37 @@ mtd_pad_erasesize(struct mtd_info *mtd, return len; } @@ -52,7 +52,7 @@ #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME #else -@@ -703,7 +734,14 @@ mtd_pad_erasesize(struct mtd_info *mtd, +@@ -704,7 +735,14 @@ mtd_pad_erasesize(struct mtd_info *mtd, static void split_firmware(struct mtd_info *master, struct mtd_part *part) { diff --git a/target/linux/generic/patches-4.1/406-mtd-old-rootfs-squashfs-splitter.patch b/target/linux/generic/patches-4.1/406-mtd-old-rootfs-squashfs-splitter.patch index 65424b065d..cb1f29c901 100644 --- a/target/linux/generic/patches-4.1/406-mtd-old-rootfs-squashfs-splitter.patch +++ b/target/linux/generic/patches-4.1/406-mtd-old-rootfs-squashfs-splitter.patch @@ -14,7 +14,7 @@ default y --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -695,6 +695,47 @@ mtd_pad_erasesize(struct mtd_info *mtd, +@@ -696,6 +696,47 @@ mtd_pad_erasesize(struct mtd_info *mtd, return len; } @@ -62,7 +62,7 @@ #define UBOOT_MAGIC 0x27051956 static void split_uimage(struct mtd_info *master, struct mtd_part *part) -@@ -757,7 +798,10 @@ static void mtd_partition_split(struct m +@@ -758,7 +799,10 @@ static void mtd_partition_split(struct m return; if (!strcmp(part->mtd.name, "rootfs")) { diff --git a/target/linux/generic/patches-4.1/411-mtd-partial_eraseblock_write.patch b/target/linux/generic/patches-4.1/411-mtd-partial_eraseblock_write.patch index a66507bc81..e6e809cf3c 100644 --- a/target/linux/generic/patches-4.1/411-mtd-partial_eraseblock_write.patch +++ b/target/linux/generic/patches-4.1/411-mtd-partial_eraseblock_write.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -36,6 +36,8 @@ +@@ -37,6 +37,8 @@ #include "mtdcore.h" #include "mtdsplit/mtdsplit.h" @@ -9,7 +9,7 @@ /* Our partition linked list */ static LIST_HEAD(mtd_partitions); static DEFINE_MUTEX(mtd_partitions_mutex); -@@ -234,13 +236,61 @@ static int part_erase(struct mtd_info *m +@@ -235,13 +237,61 @@ static int part_erase(struct mtd_info *m struct mtd_part *part = PART(mtd); int ret; @@ -71,7 +71,7 @@ return ret; } -@@ -248,7 +298,25 @@ void mtd_erase_callback(struct erase_inf +@@ -249,7 +299,25 @@ void mtd_erase_callback(struct erase_inf { if (instr->mtd->_erase == part_erase) { struct mtd_part *part = PART(instr->mtd); @@ -97,7 +97,7 @@ if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN) instr->fail_addr -= part->offset; instr->addr -= part->offset; -@@ -521,17 +589,20 @@ static struct mtd_part *allocate_partiti +@@ -522,17 +590,20 @@ static struct mtd_part *allocate_partiti if ((slave->mtd.flags & MTD_WRITEABLE) && mtd_mod_by_eb(slave->offset, &slave->mtd)) { /* Doesn't start on a boundary of major erase size */ diff --git a/target/linux/generic/patches-4.1/412-mtd-partial_eraseblock_unlock.patch b/target/linux/generic/patches-4.1/412-mtd-partial_eraseblock_unlock.patch index 62f9d5bad0..b7964e25b8 100644 --- a/target/linux/generic/patches-4.1/412-mtd-partial_eraseblock_unlock.patch +++ b/target/linux/generic/patches-4.1/412-mtd-partial_eraseblock_unlock.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -335,7 +335,14 @@ static int part_lock(struct mtd_info *mt +@@ -336,7 +336,14 @@ static int part_lock(struct mtd_info *mt static int part_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) { struct mtd_part *part = PART(mtd); -- 2.30.2