From: Marek Vasut Date: Sat, 3 Jan 2026 00:17:31 +0000 (+0100) Subject: misc: Add fixed-layout support X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6014f87b03d2c54e34aa574dcec375804c030860;p=thirdparty%2Fu-boot.git misc: Add fixed-layout support 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 --- 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;