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>
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);
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;