aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/pending-4.9
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2018-01-11 11:59:39 +0100
committerRafał Miłecki <rafal@milecki.pl>2018-01-11 12:07:49 +0100
commitbde5e7a632ef06b16ea77af037c1442e10949666 (patch)
tree51dce463c6c4514b9da7ea389cab4133072c3129 /target/linux/generic/pending-4.9
parentef27f153302b9f8296f5a8c71d08ae7392e721de (diff)
downloadupstream-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.9')
-rw-r--r--target/linux/generic/pending-4.9/160-mtd-part-add-generic-parsing-of-linux-part-probe.patch16
-rw-r--r--target/linux/generic/pending-4.9/400-mtd-add-rootfs-split-support.patch13
-rw-r--r--target/linux/generic/pending-4.9/401-mtd-add-support-for-different-partition-parser-types.patch6
-rw-r--r--target/linux/generic/pending-4.9/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch6
-rw-r--r--target/linux/generic/pending-4.9/404-mtd-add-more-helper-functions.patch6
-rw-r--r--target/linux/generic/pending-4.9/411-mtd-partial_eraseblock_write.patch8
-rw-r--r--target/linux/generic/pending-4.9/412-mtd-partial_eraseblock_unlock.patch2
7 files changed, 29 insertions, 28 deletions
diff --git a/target/linux/generic/pending-4.9/160-mtd-part-add-generic-parsing-of-linux-part-probe.patch b/target/linux/generic/pending-4.9/160-mtd-part-add-generic-parsing-of-linux-part-probe.patch
index 5e9ad8cf07..6c2e2602e1 100644
--- a/target/linux/generic/pending-4.9/160-mtd-part-add-generic-parsing-of-linux-part-probe.patch
+++ b/target/linux/generic/pending-4.9/160-mtd-part-add-generic-parsing-of-linux-part-probe.patch
@@ -112,9 +112,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"
-@@ -855,6 +856,42 @@ void deregister_mtd_parser(struct mtd_pa
+@@ -856,6 +857,42 @@ void deregister_mtd_parser(struct mtd_pa
EXPORT_SYMBOL_GPL(deregister_mtd_parser);
/*
@@ -157,9 +157,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!
*/
-@@ -912,6 +949,13 @@ int parse_mtd_partitions(struct mtd_info
- {
- struct mtd_part_parser *parser;
+@@ -955,6 +992,13 @@ int parse_mtd_partitions(struct mtd_info
+ struct property *prop;
+ const char *compat;
int ret, err = 0;
+ const char *const *types_of = NULL;
+
@@ -169,9 +169,9 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+ types = types_of;
+ }
- if (!types)
- types = default_mtd_part_types;
-@@ -937,6 +981,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) {
+@@ -996,6 +1040,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 cf8a54ff56..ef7a6df3ea 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
@@ -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.
-@@ -678,6 +682,7 @@ int mtd_add_partition(struct mtd_info *p
+@@ -679,6 +683,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);
-@@ -756,6 +761,35 @@ int mtd_del_partition(struct mtd_info *m
+@@ -757,6 +762,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
-@@ -787,6 +821,7 @@ int add_mtd_partitions(struct mtd_info *
+@@ -788,6 +822,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.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 c112453498..66c499d3e7 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 <juhosg@openwrt.org>
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
-@@ -1036,6 +1036,62 @@ void mtd_part_parser_cleanup(struct mtd_
+@@ -1095,6 +1095,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.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 b78ff526ff..9b406d4688 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 <juhosg@openwrt.org>
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
-@@ -761,6 +761,36 @@ int mtd_del_partition(struct mtd_info *m
+@@ -762,6 +762,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
-@@ -769,6 +799,7 @@ EXPORT_SYMBOL_GPL(mtd_del_partition);
+@@ -770,6 +800,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,
-@@ -783,6 +814,12 @@ static void mtd_partition_split(struct m
+@@ -784,6 +815,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 8e9604fb7d..0ec5540d03 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 <juhosg@openwrt.org>
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
-@@ -791,6 +791,17 @@ run_parsers_by_type(struct mtd_part *sla
+@@ -792,6 +792,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
-@@ -1146,6 +1157,24 @@ int mtd_is_partition(const struct mtd_in
+@@ -1205,6 +1216,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.9/411-mtd-partial_eraseblock_write.patch b/target/linux/generic/pending-4.9/411-mtd-partial_eraseblock_write.patch
index 6c03a29842..9a585214ed 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
@@ -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;
-@@ -590,19 +659,22 @@ static struct mtd_part *allocate_partiti
+@@ -591,19 +660,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/412-mtd-partial_eraseblock_unlock.patch b/target/linux/generic/pending-4.9/412-mtd-partial_eraseblock_unlock.patch
index fd6ffc6fa9..2ffff4ecf9 100644
--- a/target/linux/generic/pending-4.9/412-mtd-partial_eraseblock_unlock.patch
+++ b/target/linux/generic/pending-4.9/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);