diff options
Diffstat (limited to 'target/linux/generic/patches-3.18')
9 files changed, 200 insertions, 25 deletions
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 <hauke@hauke-m.de> +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 <hauke@hauke-m.de> +--- + 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 <linux/kmod.h> + #include <linux/mtd/mtd.h> + #include <linux/mtd/partitions.h> ++#include <linux/of.h> + #include <linux/err.h> + + #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 <linux/kmod.h> +@@ -30,9 +30,11 @@ #include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h> + #include <linux/of.h> +#include <linux/magic.h> #include <linux/err.h> @@ -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 <juhosg@openwrt.org> --- 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 <juhosg@openwrt.org> 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); |