/* Pull of_node from the master device node */
mtd_node = mtd_get_of_node(master); if (!mtd_node) return 0;
if (!master->parent) { /* Master */
ofpart_node = of_get_child_by_name(mtd_node, "partitions"); if (!ofpart_node) { /* * We might get here even when ofpart isn't used at all (e.g., * when using another parser), so don't be louder than * KERN_DEBUG
*/
pr_debug("%s: 'partitions' subnode not found on %pOF. Trying to parse direct subnodes as partitions.\n",
master->name, mtd_node);
ofpart_node = mtd_node;
dedicated = false;
}
} else { /* Partition */
ofpart_node = mtd_node;
}
of_id = of_match_node(parse_ofpart_match_table, ofpart_node); if (dedicated && !of_id) { /* The 'partitions' subnode might be used by another parser */ return 0;
}
quirks = of_id ? of_id->data : NULL;
/* First count the subnodes */
nr_parts = 0;
for_each_child_of_node(ofpart_node, pp) { if (!dedicated && node_has_compatible(pp)) continue;
nr_parts++;
}
if (nr_parts == 0) return 0;
parts = kcalloc(nr_parts, sizeof(*parts), GFP_KERNEL); if (!parts) return -ENOMEM;
i = 0;
for_each_child_of_node(ofpart_node, pp) { const __be32 *reg; int len; int a_cells, s_cells;
if (!dedicated && node_has_compatible(pp)) continue;
a_cells = of_n_addr_cells(pp);
s_cells = of_n_size_cells(pp); if (!dedicated && s_cells == 0) { /* * This is a ugly workaround to not create * regression on devices that are still creating * partitions as direct children of the nand controller. * This can happen in case the nand controller node has * #size-cells equal to 0 and the firmware (e.g. * U-Boot) just add the partitions there assuming * 32-bit addressing. * * If you get this warning your firmware and/or DTS * should be really fixed. * * This is working only for devices smaller than 4GiB.
*/
pr_warn("%s: ofpart partition %pOF (%pOF) #size-cells is wrongly set to <0>, assuming <1> for parsing partitions.\n",
master->name, pp, mtd_node);
s_cells = 1;
} if (len / 4 != a_cells + s_cells) {
pr_debug("%s: ofpart partition %pOF (%pOF) error parsing reg property.\n",
master->name, pp,
mtd_node); goto ofpart_fail;
}
for (i = 0; i < nr_parts; i++) {
parts[i].offset = be32_to_cpu(part->offset);
parts[i].size = be32_to_cpu(part->len) & ~1; /* bit 0 set signifies read only partition */ if (be32_to_cpu(part->len) & 1)
parts[i].mask_flags = MTD_WRITEABLE;
if (names && (plen > 0)) { int len = strlen(names) + 1;
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Parser for MTD partitioning information in device tree");
MODULE_AUTHOR("Vitaly Wool, David Gibson"); /* * When MTD core cannot find the requested parser, it tries to load the module * with the same name. Since we provide the ofoldpart parser, we should have * the corresponding alias.
*/
MODULE_ALIAS("fixed-partitions");
MODULE_ALIAS("ofoldpart");
Messung V0.5
¤ Dauer der Verarbeitung: 0.0 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.