Re: [PATCH v2 1/2] nvmem: layouts: Add fixed-layout driver
From: Srinivas Kandagatla
Date: Tue May 19 2026 - 11:09:43 EST
On 5/15/26 12:56 PM, Mathieu Dubois-Briand wrote:
> Current implementation isn't working well when device tree nodes have a
> phandle on a fixed-layout nvmem node. As the fixed layout is handled in
> nvmem core, no driver is ever associated with the layout, and the device
> consumer driver probe is deferred indefinitely.
>
> Remove the specific handling of fixed-layout and add a layout driver.
> This makes the fixed-layout similar to all other layouts, fixing the
> whole issue.
>
> Fixes: fc29fd821d9a ("nvmem: core: Rework layouts to become regular devices")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@xxxxxxxxxxx>
> ---
> MAINTAINERS | 5 ++++
> drivers/nvmem/core.c | 23 +---------------
> drivers/nvmem/layouts.c | 11 --------
> drivers/nvmem/layouts/Makefile | 1 +
> drivers/nvmem/layouts/fixed-layout.c | 52 ++++++++++++++++++++++++++++++++++++
> include/linux/nvmem-provider.h | 7 +++++
> diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h
> index f3b13da78aac..e7eaa9a89b8b 100644
> --- a/include/linux/nvmem-provider.h
> +++ b/include/linux/nvmem-provider.h
> @@ -176,6 +176,7 @@ int nvmem_add_one_cell(struct nvmem_device *nvmem,
>
> int nvmem_layout_register(struct nvmem_layout *layout);
> void nvmem_layout_unregister(struct nvmem_layout *layout);
> +int nvmem_add_cells_from_dt(struct nvmem_device *nvmem, struct device_node *np);
This is not a provider level api, so this api should not belong in this
file to start with. move it to internals.h something that is inside the
drivers/nvmem
>
> #define nvmem_layout_driver_register(drv) \
> __nvmem_layout_driver_register(drv, THIS_MODULE)
> @@ -214,6 +215,12 @@ static inline int nvmem_layout_register(struct nvmem_layout *layout)
>
> static inline void nvmem_layout_unregister(struct nvmem_layout *layout) {}
>
> +static inline int nvmem_add_cells_from_dt(struct nvmem_device *nvmem,
> + struct device_node *np)
> +{
> + return -EOPNOTSUPP;
> +}
> +
> #endif /* CONFIG_NVMEM */