]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
misc: Add fixed-layout support
authorMarek Vasut <marek.vasut+renesas@mailbox.org>
Sat, 3 Jan 2026 00:17:31 +0000 (01:17 +0100)
committerTom Rini <trini@konsulko.com>
Tue, 13 Jan 2026 15:42:44 +0000 (09:42 -0600)
The "fixed-layout" nvmem controller subnode used to be optional wrapper
around nvmem controller cells subnodes. The "fixed-layout" node is now
mandatory in most cases, but in order to support both recent and legacy
DTs, both variants have to be supported.

Implement support for the "fixed-layout" node in the most trivial manner,
check whether the nvmem cell supernode is compatible with "fixed-layout"
and if it is, proceed one level above it to find the nvmem controller.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
drivers/misc/nvmem.c

index d0cb0a35b816246133410e60da2c66469b696eb0..33e8085856579d01c12822fa11cee84ff486f270 100644 (file)
@@ -102,6 +102,7 @@ int nvmem_cell_get_by_index(struct udevice *dev, int index,
        fdt_size_t size = FDT_SIZE_T_NONE;
        int ret;
        struct ofnode_phandle_args args;
+       ofnode par;
 
        dev_dbg(dev, "%s: index=%d\n", __func__, index);
 
@@ -110,7 +111,11 @@ int nvmem_cell_get_by_index(struct udevice *dev, int index,
        if (ret)
                return ret;
 
-       ret = nvmem_get_device(ofnode_get_parent(args.node), cell);
+       par = ofnode_get_parent(args.node);
+       if (ofnode_device_is_compatible(par, "fixed-layout"))
+               par = ofnode_get_parent(par);
+
+       ret = nvmem_get_device(par, cell);
        if (ret)
                return ret;