diff options
author | Rafał Miłecki <rafal@milecki.pl> | 2018-01-11 11:59:39 +0100 |
---|---|---|
committer | Rafał Miłecki <rafal@milecki.pl> | 2018-01-11 12:07:49 +0100 |
commit | bde5e7a632ef06b16ea77af037c1442e10949666 (patch) | |
tree | 51dce463c6c4514b9da7ea389cab4133072c3129 /target/linux/generic/pending-4.14 | |
parent | ef27f153302b9f8296f5a8c71d08ae7392e721de (diff) | |
download | upstream-bde5e7a632ef06b16ea77af037c1442e10949666.tar.gz upstream-bde5e7a632ef06b16ea77af037c1442e10949666.tar.bz2 upstream-bde5e7a632ef06b16ea77af037c1442e10949666.zip |
kernel: backport mtd implementation for "compatible" in "partitions" subnode
This backports upstream support for "compatible" DT property set for the
"partitions" subnode of flash node. It allows specifying how partitions
should be created/parsed. Right now only "fixed-partitions" is
supported.
It should eventually replace our downstream "linux,part-probe" solution.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Diffstat (limited to 'target/linux/generic/pending-4.14')
7 files changed, 29 insertions, 28 deletions
diff --git a/target/linux/generic/pending-4.14/160-mtd-part-add-generic-parsing-of-linux-part-probe.patch b/target/linux/generic/pending-4.14/160-mtd-part-add-generic-parsing-of-linux-part-probe.patch index 2706f13dc9..e57214ba05 100644 --- a/target/linux/generic/pending-4.14/160-mtd-part-add-generic-parsing-of-linux-part-probe.patch +++ b/target/linux/generic/pending-4.14/160-mtd-part-add-generic-parsing-of-linux-part-probe.patch @@ -102,9 +102,9 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> #include <linux/mtd/partitions.h> +#include <linux/of.h> #include <linux/err.h> + #include <linux/of.h> - #include "mtdcore.h" -@@ -863,6 +864,32 @@ void deregister_mtd_parser(struct mtd_pa +@@ -864,6 +865,32 @@ void deregister_mtd_parser(struct mtd_pa EXPORT_SYMBOL_GPL(deregister_mtd_parser); /* @@ -137,9 +137,9 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> * Do not forget to update 'parse_mtd_partitions()' kerneldoc comment if you * are changing this array! */ -@@ -920,6 +947,13 @@ int parse_mtd_partitions(struct mtd_info - { - struct mtd_part_parser *parser; +@@ -963,6 +990,13 @@ int parse_mtd_partitions(struct mtd_info + struct property *prop; + const char *compat; int ret, err = 0; + const char *const *types_of = NULL; + @@ -149,9 +149,9 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> + types = types_of; + } - if (!types) - types = default_mtd_part_types; -@@ -945,6 +979,7 @@ int parse_mtd_partitions(struct mtd_info + np = of_get_child_by_name(mtd_get_of_node(master), "partitions"); + of_property_for_each_string(np, "compatible", prop, compat) { +@@ -1004,6 +1038,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 f0c852a695..e722d8ca92 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 @@ -37,20 +37,21 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> depends on m --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -29,10 +29,12 @@ +@@ -29,11 +29,13 @@ #include <linux/kmod.h> #include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h> +#include <linux/magic.h> #include <linux/of.h> #include <linux/err.h> + #include <linux/of.h> #include "mtdcore.h" +#include "mtdsplit/mtdsplit.h" /* Our partition linked list */ static LIST_HEAD(mtd_partitions); -@@ -52,6 +54,8 @@ struct mtd_part { +@@ -53,6 +55,8 @@ struct mtd_part { struct list_head list; }; @@ -59,7 +60,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> /* * Given a pointer to the MTD object in the mtd_part structure, we can retrieve * the pointer to that structure. -@@ -686,6 +690,7 @@ int mtd_add_partition(struct mtd_info *p +@@ -687,6 +691,7 @@ int mtd_add_partition(struct mtd_info *p mutex_unlock(&mtd_partitions_mutex); add_mtd_device(&new->mtd); @@ -67,7 +68,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> mtd_add_partition_attrs(new); -@@ -764,6 +769,35 @@ int mtd_del_partition(struct mtd_info *m +@@ -765,6 +770,35 @@ int mtd_del_partition(struct mtd_info *m } EXPORT_SYMBOL_GPL(mtd_del_partition); @@ -103,7 +104,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> /* * 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 -@@ -795,6 +829,7 @@ int add_mtd_partitions(struct mtd_info * +@@ -796,6 +830,7 @@ int add_mtd_partitions(struct mtd_info * mutex_unlock(&mtd_partitions_mutex); add_mtd_device(&slave->mtd); @@ -113,7 +114,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> mtd_parse_part(slave, parts[i].types); --- a/include/linux/mtd/partitions.h +++ b/include/linux/mtd/partitions.h -@@ -109,5 +109,7 @@ int mtd_add_partition(struct mtd_info *m +@@ -110,5 +110,7 @@ int mtd_add_partition(struct mtd_info *m long long offset, long long length); int mtd_del_partition(struct mtd_info *master, int partno); uint64_t mtd_get_device_size(const struct mtd_info *mtd); 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 77ee85a8c8..7481225be8 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 <juhosg@openwrt.org> --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -1034,6 +1034,62 @@ void mtd_part_parser_cleanup(struct mtd_ +@@ -1093,6 +1093,62 @@ void mtd_part_parser_cleanup(struct mtd_ } } @@ -90,7 +90,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> struct mtd_part_parser { struct list_head list; struct module *owner; -@@ -80,6 +83,7 @@ struct mtd_part_parser { +@@ -81,6 +84,7 @@ struct mtd_part_parser { int (*parse_fn)(struct mtd_info *, const struct mtd_partition **, struct mtd_part_parser_data *); void (*cleanup)(const struct mtd_partition *pparts, int nr_parts); @@ -98,7 +98,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> }; /* Container for passing around a set of parsed partitions */ -@@ -112,4 +116,9 @@ uint64_t mtd_get_device_size(const struc +@@ -113,4 +117,9 @@ uint64_t mtd_get_device_size(const struc extern void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, int offset, int size); 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 dff9c3166e..26a19b82fd 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 <juhosg@openwrt.org> --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -769,6 +769,36 @@ int mtd_del_partition(struct mtd_info *m +@@ -770,6 +770,36 @@ int mtd_del_partition(struct mtd_info *m } EXPORT_SYMBOL_GPL(mtd_del_partition); @@ -47,7 +47,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME #else -@@ -777,6 +807,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition); +@@ -778,6 +808,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 <juhosg@openwrt.org> } void __weak arch_split_mtd_part(struct mtd_info *master, const char *name, -@@ -791,6 +822,12 @@ static void mtd_partition_split(struct m +@@ -792,6 +823,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 97bd7730c8..a4fb155863 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 <juhosg@openwrt.org> --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -799,6 +799,17 @@ run_parsers_by_type(struct mtd_part *sla +@@ -800,6 +800,17 @@ run_parsers_by_type(struct mtd_part *sla return nr_parts; } @@ -29,7 +29,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> #ifdef CONFIG_MTD_SPLIT_FIRMWARE_NAME #define SPLIT_FIRMWARE_NAME CONFIG_MTD_SPLIT_FIRMWARE_NAME #else -@@ -1144,6 +1155,24 @@ int mtd_is_partition(const struct mtd_in +@@ -1203,6 +1214,24 @@ int mtd_is_partition(const struct mtd_in } EXPORT_SYMBOL_GPL(mtd_is_partition); @@ -83,7 +83,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> if (mtd->writesize_shift) --- a/include/linux/mtd/partitions.h +++ b/include/linux/mtd/partitions.h -@@ -114,6 +114,8 @@ int mtd_is_partition(const struct mtd_in +@@ -115,6 +115,8 @@ int mtd_is_partition(const struct mtd_in int mtd_add_partition(struct mtd_info *master, const char *name, long long offset, long long length); int mtd_del_partition(struct mtd_info *master, int partno); 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 096d6a4e71..9de5fd263c 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 @@ -10,7 +10,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> --- 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" @@ -19,7 +19,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> /* Our partition linked list */ static LIST_HEAD(mtd_partitions); static DEFINE_MUTEX(mtd_partitions_mutex); -@@ -241,13 +243,61 @@ static int part_erase(struct mtd_info *m +@@ -242,13 +244,61 @@ static int part_erase(struct mtd_info *m struct mtd_part *part = mtd_to_part(mtd); int ret; @@ -81,7 +81,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> return ret; } -@@ -255,6 +305,25 @@ void mtd_erase_callback(struct erase_inf +@@ -256,6 +306,25 @@ void mtd_erase_callback(struct erase_inf { if (instr->mtd->_erase == part_erase) { struct mtd_part *part = mtd_to_part(instr->mtd); @@ -107,7 +107,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN) instr->fail_addr -= part->offset; -@@ -598,19 +667,22 @@ static struct mtd_part *allocate_partiti +@@ -599,19 +668,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.14/412-mtd-partial_eraseblock_unlock.patch b/target/linux/generic/pending-4.14/412-mtd-partial_eraseblock_unlock.patch index fd6ffc6fa9..2ffff4ecf9 100644 --- a/target/linux/generic/pending-4.14/412-mtd-partial_eraseblock_unlock.patch +++ b/target/linux/generic/pending-4.14/412-mtd-partial_eraseblock_unlock.patch @@ -20,7 +20,7 @@ Signed-off-by: Tim Harvey <tharvey@gateworks.com> --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -343,7 +343,16 @@ static int part_lock(struct mtd_info *mt +@@ -344,7 +344,16 @@ 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 = mtd_to_part(mtd); |