summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorPatrice Chotard <[email protected]>2022-03-21 09:13:37 +0100
committerTom Rini <[email protected]>2022-04-11 11:39:19 -0400
commit7ab3364c6d1c17b8ee6da523d5729b0248ba63bf (patch)
tree379d3b041b956519d85b1fd81bd81eff666e35be /drivers
parentc86a4de8df611b58ec41ae6c42c6fec58e5ab54f (diff)
mtd: Update the way partitions are parsed
In case mtd_info's dev field is not populated (raw nand's case), use the flash_node new field which reference the DT flash node where can be found "partitions" node with "fixed-partitions" compatible. Signed-off-by: Patrice Chotard <[email protected]> Cc: Farhan Ali <[email protected]> Cc: Heinrich Schuchardt <[email protected]> Cc: Jagan Teki <[email protected]> Cc: Marek Behun <[email protected]> Cc: Miquel Raynal <[email protected]> Cc: Simon Glass <[email protected]> Cc: Wolfgang Denk <[email protected]>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/mtdpart.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 4119ea4ff6b..d077897e4a7 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -887,10 +887,14 @@ int add_mtd_partitions_of(struct mtd_info *master)
ofnode parts, child;
int i = 0;
- if (!master->dev)
+ if (!master->dev && !ofnode_valid(master->flash_node))
return 0;
- parts = ofnode_find_subnode(mtd_get_ofnode(master), "partitions");
+ if (master->dev)
+ parts = ofnode_find_subnode(mtd_get_ofnode(master), "partitions");
+ else
+ parts = ofnode_find_subnode(master->flash_node, "partitions");
+
if (!ofnode_valid(parts) || !ofnode_is_available(parts) ||
!ofnode_device_is_compatible(parts, "fixed-partitions"))
return 0;