1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 16:52:14 +02:00

common: fdt_support: add support for "partitions" subnode to fdt_fixup_mtdparts()

Listing MTD partitions directly in the flash mode has been deprecated
for a while for kernel Device Trees. Look for a node "partitions" in the
found flash nodes and use it instead of the flash node itself for the
partition list when it exists, so Device Trees following the current
best practices can be fixed up.

Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Matthias Schiffer
2022-02-03 15:14:47 +01:00
committed by Tom Rini
parent 80d4c02b93
commit 36fee2f762

View File

@@ -988,7 +988,7 @@ void fdt_fixup_mtdparts(void *blob, const struct node_info *node_info,
{
struct mtd_device *dev;
int i, idx;
int noff;
int noff, parts;
bool inited = false;
for (i = 0; i < node_info_size; i++) {
@@ -1014,7 +1014,12 @@ void fdt_fixup_mtdparts(void *blob, const struct node_info *node_info,
dev = device_find(node_info[i].type, idx++);
if (dev) {
if (fdt_node_set_part_info(blob, noff, dev))
parts = fdt_subnode_offset(blob, noff,
"partitions");
if (parts < 0)
parts = noff;
if (fdt_node_set_part_info(blob, parts, dev))
return; /* return on error */
}
}