1 From 53980645bb12bd8723ac226805ee171780b24196 Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jonas.gorski@gmail.com>
3 Date: Mon, 26 Jun 2017 13:37:11 +0200
4 Subject: [PATCH 1/4] mtd: add of_match_table parsing for partition parsers
6 Allow partition parsers to be matched by attaching compatible strings to
9 This allows specifying the expected format of flash partitions for
10 matching partition parsers.
17 compatible = "fixed-partitions";
26 reg = <0x10000 0x3e0000>;
28 compatible = "brcm,bcm63xx-imagetag";
32 reg = <0x3e0000 0x10000>;
38 Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
40 drivers/mtd/mtdpart.c | 12 ++++++++----
41 1 file changed, 8 insertions(+), 4 deletions(-)
43 --- a/drivers/mtd/mtdpart.c
44 +++ b/drivers/mtd/mtdpart.c
45 @@ -953,8 +953,7 @@ int add_mtd_partitions(struct mtd_info *
46 add_mtd_device(&slave->mtd);
47 mtd_partition_split(master, slave);
48 mtd_add_partition_attrs(slave);
50 - mtd_parse_part(slave, parts[i].types);
51 + mtd_parse_part(slave, parts[i].types);
53 cur_offset = slave->offset + slave->mtd.size;
55 @@ -1164,7 +1163,9 @@ int parse_mtd_partitions(struct mtd_info
59 - np = of_get_child_by_name(mtd_get_of_node(master), "partitions");
60 + np = mtd_get_of_node(master);
61 + if (!mtd_is_partition(master))
62 + np = of_get_child_by_name(np, "partitions");
63 of_property_for_each_string(np, "compatible", prop, compat) {
64 parser = mtd_part_get_compatible_parser(compat);
66 @@ -1180,8 +1181,12 @@ int parse_mtd_partitions(struct mtd_info
72 + if (mtd_is_partition(master))
75 types = default_mtd_part_types;
78 for ( ; *types; types++) {
79 pr_debug("%s: parsing partitions %s\n", master->name, *types);