]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mtd: Update the way partitions are parsed
authorPatrice Chotard <patrice.chotard@foss.st.com>
Mon, 21 Mar 2022 08:13:37 +0000 (09:13 +0100)
committerTom Rini <trini@konsulko.com>
Mon, 11 Apr 2022 15:39:19 +0000 (11:39 -0400)
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 <patrice.chotard@foss.st.com>
Cc: Farhan Ali <farhan.ali@broadcom.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Marek Behun <marek.behun@nic.cz>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Wolfgang Denk <wd@denx.de>
drivers/mtd/mtdpart.c

index 4119ea4ff6b058b88d03815b638a7710fa594d0a..d077897e4a757b847bd65e2b38fc1a43a93fb76e 100644 (file)
@@ -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;