nvmem: layouts: Support fixed-layout as the nvmem device node itself

of_nvmem_layout_get_container() only looks for a child node named
"nvmem-layout" to locate the cell definitions. This does not cover
providers whose device tree node is itself the fixed-layout container,
such as an eMMC boot partition block device whose fwnode points directly
at a "fixed-layout" compatible partitions node.

When no "nvmem-layout" child is present, fall back to returning the nvmem
device node itself if it is compatible with "fixed-layout", so that its
cells are parsed by nvmem_add_cells_from_fixed_layout().

Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
Link: https://patch.msgid.link/20261002101352.1084447-6-srini@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Loic Poulain 2026-10-02 11:13:48 +01:00 committed by Greg Kroah-Hartman
parent 586df7d0a3
commit 008e08b1ee

View File

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