summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMarek Vasut <[email protected]>2026-01-03 01:17:31 +0100
committerTom Rini <[email protected]>2026-01-13 09:42:44 -0600
commit6014f87b03d2c54e34aa574dcec375804c030860 (patch)
tree49c39edf5f145291114342cc5560a802243e06c4 /drivers
parent0b97991fa0e706ca4d9ba274ba9d06f43e4ee9ad (diff)
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 <[email protected]>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/misc/nvmem.c7
1 files changed, 6 insertions, 1 deletions
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;