aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/patches-4.1
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/generic/patches-4.1')
-rw-r--r--target/linux/generic/patches-4.1/140-mtd-part-add-generic-parsing-of-linux-part-probe.patch175
-rw-r--r--target/linux/generic/patches-4.1/400-mtd-add-rootfs-split-support.patch15
-rw-r--r--target/linux/generic/patches-4.1/401-mtd-add-support-for-different-partition-parser-types.patch4
-rw-r--r--target/linux/generic/patches-4.1/402-mtd-use-typed-mtd-parsers-for-rootfs-and-firmware-split.patch6
-rw-r--r--target/linux/generic/patches-4.1/404-mtd-add-more-helper-functions.patch6
-rw-r--r--target/linux/generic/patches-4.1/405-mtd-old-firmware-uimage-splitter.patch4
-rw-r--r--target/linux/generic/patches-4.1/406-mtd-old-rootfs-squashfs-splitter.patch4
-rw-r--r--target/linux/generic/patches-4.1/411-mtd-partial_eraseblock_write.patch8
-rw-r--r--target/linux/generic/patches-4.1/412-mtd-partial_eraseblock_unlock.patch2
9 files changed, 200 insertions, 24 deletions
diff --git a/target/linux/generic/patches-4.1/140-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
new file mode 100644
index 0000000000..18ec833f70
--- /dev/null
+++ b/target/linux/generic/patches-4.1/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
+@@ -112,45 +112,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;
+@@ -310,10 +274,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 <linux/kconfig.h>
+
+@@ -719,6 +720,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!
+ */
+@@ -754,6 +789,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;
+@@ -772,6 +814,7 @@ int parse_mtd_partitions(struct mtd_info
+ break;
+ }
+ }
++ kfree(types_of);
+ return ret;
+ }
+
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 <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/kconfig.h>
@@ -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 <juhosg@openwrt.org>
--- 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 <juhosg@openwrt.org>
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);