|
@@ -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);
|