aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Gorski <jonas.gorski@gmail.com>2017-06-26 19:01:20 +0200
committerJonas Gorski <jonas.gorski@gmail.com>2018-02-11 23:15:05 +0100
commit85f31afa88c4e3a5fed95149832bdea0ff7ae3b9 (patch)
tree88be4cf29f87892eca238e7acf68fc103e598f3d
parenta41ad1b6f60bdd95c12fbe8ca2d84692360d73d6 (diff)
downloadupstream-85f31afa88c4e3a5fed95149832bdea0ff7ae3b9.tar.gz
upstream-85f31afa88c4e3a5fed95149832bdea0ff7ae3b9.tar.bz2
upstream-85f31afa88c4e3a5fed95149832bdea0ff7ae3b9.zip
brcm63xx: enhance dt partitions support to match upstream more closely
Partitions are supposed to be enclosed in an extra partitions node. Allow the bcm63xxpart parser to cope with that. Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
-rw-r--r--target/linux/brcm63xx/patches-4.4/425-bcm63xxpart_parse_paritions_from_dt.patch28
1 files changed, 19 insertions, 9 deletions
diff --git a/target/linux/brcm63xx/patches-4.4/425-bcm63xxpart_parse_paritions_from_dt.patch b/target/linux/brcm63xx/patches-4.4/425-bcm63xxpart_parse_paritions_from_dt.patch
index d64d42c9dc..ea73690d80 100644
--- a/target/linux/brcm63xx/patches-4.4/425-bcm63xxpart_parse_paritions_from_dt.patch
+++ b/target/linux/brcm63xx/patches-4.4/425-bcm63xxpart_parse_paritions_from_dt.patch
@@ -89,7 +89,7 @@
}
} else {
pr_warn("CFE boot tag CRC invalid (expected %08x, actual %08x)\n",
-@@ -119,23 +108,139 @@ static int bcm63xx_parse_cfe_partitions(
+@@ -119,23 +108,145 @@ static int bcm63xx_parse_cfe_partitions(
kernellen = 0;
rootfslen = 0;
rootfsaddr = 0;
@@ -133,14 +133,18 @@
+ struct mtd_partition **pparts,
+ struct mtd_part_parser_data *data)
+{
-+ struct device_node *dp = mtd_get_of_node(master);
++ struct device_node *dp, *mtd_node = mtd_get_of_node(master);
+ struct device_node *pp;
+ int i, nr_parts = 0;
+ const char *partname;
+ int len;
+
++ dp = of_get_child_by_name(mtd_node, "partitions");
++ if (!dp)
++ dp = mtd_node;
++
+ for_each_child_of_node(dp, pp) {
-+ if (node_has_compatible(pp))
++ if (node_has_compatible(pp) && dp == mtd_node)
+ continue;
+
+ if (!of_get_property(pp, "reg", &len))
@@ -150,7 +154,8 @@
+ if (!partname)
+ partname = of_get_property(pp, "name", &len);
+
-+ if (!strcmp(partname, "linux"))
++ if (!strcmp(partname, "linux") ||
++ of_device_is_compatible(pp, "brcm,bcm963xx-imagetag"))
+ nr_parts += 2;
+
+ nr_parts++;
@@ -166,7 +171,7 @@
+ int a_cells, s_cells;
+ size_t size, offset;
+
-+ if (node_has_compatible(pp))
++ if (node_has_compatible(pp) && dp == mtd_node)
+ continue;
+
+ reg = of_get_property(pp, "reg", &len);
@@ -181,7 +186,8 @@
+ if (!partname)
+ partname = of_get_property(pp, "name", &len);
+
-+ if (!strcmp(partname, "linux"))
++ if (!strcmp(partname, "linux") ||
++ of_device_is_compatible(pp, "brcm,bcm963xx-imagetag"))
+ i += parse_bcmtag(master, *pparts, i, offset, size);
+
+ if (of_get_property(pp, "read-only", &len))
@@ -239,7 +245,7 @@
/* Start building partition list */
parts[curpart].name = "CFE";
-@@ -143,29 +248,7 @@ static int bcm63xx_parse_cfe_partitions(
+@@ -143,29 +254,7 @@ static int bcm63xx_parse_cfe_partitions(
parts[curpart].size = cfelen;
curpart++;
@@ -270,7 +276,7 @@
parts[curpart].name = "nvram";
parts[curpart].offset = master->size - nvramlen;
-@@ -174,25 +257,33 @@ static int bcm63xx_parse_cfe_partitions(
+@@ -174,25 +263,37 @@ static int bcm63xx_parse_cfe_partitions(
/* Global partition "linux" to make easy firmware upgrade */
parts[curpart].name = "linux";
@@ -299,7 +305,11 @@
+ struct mtd_partition **pparts,
+ struct mtd_part_parser_data *data)
+{
-+ if (mtd_get_of_node(master) && of_get_child_count(mtd_get_of_node(master)))
++ struct device_node *np, *mtd_node = mtd_get_of_node(master);
++ np = of_get_child_by_name(mtd_node, "partitions");
++
++ if ((np && of_device_is_compatible(np, "fixed-partitions")) ||
++ (!np && of_get_child_count(mtd_node)))
+ return bcm63xx_parse_cfe_partitions_of(master, pparts, data);
+ else
+ return bcm63xx_parse_cfe_partitions(master, pparts, data);