diff --git a/drivers/nvmem/layouts.c b/drivers/nvmem/layouts.c index 07a34be9669c..409909e3244f 100644 --- a/drivers/nvmem/layouts.c +++ b/drivers/nvmem/layouts.c @@ -156,7 +156,18 @@ static int nvmem_layout_bus_populate(struct nvmem_device *nvmem, struct device_node *of_nvmem_layout_get_container(struct nvmem_device *nvmem) { - return of_get_child_by_name(nvmem->dev.of_node, "nvmem-layout"); + struct device_node *np; + + /* Search for nvmem-layout child */ + np = of_get_child_by_name(nvmem->dev.of_node, "nvmem-layout"); + if (np) + return np; + + /* The nvmem of_node is itself a fixed-layout node */ + if (of_device_is_compatible(nvmem->dev.of_node, "fixed-layout")) + return of_node_get(nvmem->dev.of_node); + + return NULL; } EXPORT_SYMBOL_GPL(of_nvmem_layout_get_container);