[PATCH] misc: Add fixed-layout support

Marek Vasut marek.vasut+renesas at mailbox.org
Sat Jan 3 01:17:31 CET 2026


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 at mailbox.org>
---
Cc: Sean Anderson <seanga2 at gmail.com>
Cc: Tom Rini <trini at konsulko.com>
---
 drivers/misc/nvmem.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/nvmem.c b/drivers/misc/nvmem.c
index d0cb0a35b81..33e80858565 100644
--- a/drivers/misc/nvmem.c
+++ b/drivers/misc/nvmem.c
@@ -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;
 
-- 
2.51.0



More information about the U-Boot mailing list