Re: [PATCH] nvmem: layouts: Add fixed-layout driver

Miquel Raynal
2026-05-05T09:14:41Z

Hi Mathieu,

On 05/05/2026 at 10:42:10 +02, Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> 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.

I guess this deserves a Fixes tag as well as a stable backport.

> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
> ---
> 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 +++++
> 6 files changed, 66 insertions(+), 33 deletions(-)
>

[...]

> diff --git a/drivers/nvmem/layouts/Makefile b/drivers/nvmem/layouts/Makefile
> index 4940c9db0665..fbc195aa382c 100644
> --- a/drivers/nvmem/layouts/Makefile
> +++ b/drivers/nvmem/layouts/Makefile
> @@ -3,6 +3,7 @@
> # Makefile for nvmem layouts.
> #
>
> +obj-y += fixed-layout.o

This implies that you cannot remove that driver. I'm fine with it, but
maybe since this is now almost costless, we could have a Kconfig entry
that defaults to =y? This is not a blocker, I have no strong
opinion. Srinivas?

> obj-$(CONFIG_NVMEM_LAYOUT_SL28_VPD) += sl28vpd.o
> obj-$(CONFIG_NVMEM_LAYOUT_ONIE_TLV) += onie-tlv.o
> obj-$(CONFIG_NVMEM_LAYOUT_U_BOOT_ENV) += u-boot-env.o
> diff --git a/drivers/nvmem/layouts/fixed-layout.c b/drivers/nvmem/layouts/fixed-layout.c
> new file mode 100644
> index 000000000000..e5078d72a6fc
> --- /dev/null
> +++ b/drivers/nvmem/layouts/fixed-layout.c
> @@ -0,0 +1,52 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Copyright 2025 Bootlin

Can probably be bumped :-)

> + *
> + * Authors: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
> + */
> +
> +#include <linux/nvmem-provider.h>
> +#include <linux/of.h>

Thanks,
Miquèl