From nobody Fri Jun 12 11:08:52 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98EB81EFF8D for ; Fri, 15 May 2026 11:57:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778846246; cv=none; b=KSU/0BYiyWV3AdIhn9PRiUDBWInPoOURMn9jtCQZ8d31tOOzbWuqMqmrd/fgMufGhGHszhz+NG6RtFbQXFv3HeqONoRoMLa/Ku3yI1z/coMZ/HhwWgJoY1w8WMuogl8L5UktU3+WslZPUgeHjORMRjnTPuIbeL/6UJ6zZMVQ3qE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778846246; c=relaxed/simple; bh=qv6791fmwYA8Bu9G/4+WRwlbAR6upaKRhwrl1guW0Pc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bHQpQikz1veYVggoyWsPfXLbaJVfHwVYGE2BVhd42/RF3VUy/SyL5gVaLB9TE62KcbeqJTGP55mzDavKHUDFQkf9g7IuOnDkkpAqSUJ5VO4++ccgIgN6N6K9KN0ey1wL8/ukXx8HxQ9zWKCiMoiZ2z9dN4tMbof/eIcMAMEYKwQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=ZoidVDnr; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="ZoidVDnr" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 5B7854E42CAE for ; Fri, 15 May 2026 11:57:22 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 30F7D606FD; Fri, 15 May 2026 11:57:22 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id D0F7611AF8C57; Fri, 15 May 2026 13:57:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1778846241; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=ZULPDCQMZeP6dSm6lPb3NNTuIuvRxhqHOfIGSPpG41Y=; b=ZoidVDnrQR2s+sN4fIiPjgkWD8yiW9/V3gP/WuH4+XnbY+zgGSbTuVL98NamwrX6oxIhtm o3TeXuZ1xjcoP1aoj1pv7F7ueuPBL192uScXHIGU1pf6HSvt6qiMZXLLwGRVthEDFxhnbU ggxVd5QgMlASEx50yFPI2grsuptlkw6/eoNKakYu0GNc52/GIJjL1bLTwqICLCm2LMGBi+ CjjgdQX76fRcGcmXCaHXX3acsNJeqYVjXGbB+XG8XDscTovjzd7QkISFTw2ukt/2xl58gk 9Willk7QU8rf4Fvk4nEf7FgpiLZPW8q9/enll4yE1REhROR4JSePsp9Iio4w5A== From: Mathieu Dubois-Briand Date: Fri, 15 May 2026 13:56:56 +0200 Subject: [PATCH v2 1/2] nvmem: layouts: Add fixed-layout driver Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260515-mathieu-nvmem-fixed-layout-v2-1-8ac215dd4016@bootlin.com> References: <20260515-mathieu-nvmem-fixed-layout-v2-0-8ac215dd4016@bootlin.com> In-Reply-To: <20260515-mathieu-nvmem-fixed-layout-v2-0-8ac215dd4016@bootlin.com> To: Srinivas Kandagatla , Greg Kroah-Hartman Cc: Miquel Raynal , =?utf-8?q?Gr=C3=A9gory_Clement?= , Thomas Petazzoni , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Mathieu Dubois-Briand X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1778846239; l=6953; i=mathieu.dubois-briand@bootlin.com; s=20241219; h=from:subject:message-id; bh=qv6791fmwYA8Bu9G/4+WRwlbAR6upaKRhwrl1guW0Pc=; b=KVeH5ZdSlZDePqs5ItI1ebjRhLulvV+4YvG+JOrxJKwgpAZ9KmPJFCxCBQRvorjEuHvdTON2V HOGtDPQ8hATBEwcXhH2yVDtiboU9OAWf9aV3FzS7jBVLQKVz+gYEawY X-Developer-Key: i=mathieu.dubois-briand@bootlin.com; a=ed25519; pk=1PVTmzPXfKvDwcPUzG0aqdGoKZJA3b9s+3DqRlm0Lww= X-Last-TLS-Session-Version: TLSv1.3 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@vger.kernel.org Signed-off-by: Mathieu Dubois-Briand Reviewed-by: Miquel Raynal --- 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/MAINTAINERS b/MAINTAINERS index 882214b0e7db..c48c4e129736 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -10018,6 +10018,11 @@ F: drivers/base/firmware_loader/ F: rust/kernel/firmware.rs F: include/linux/firmware.h =20 +FIXED-LAYOUT NVMEM LAYOUT DRIVER +M: Mathieu Dubois-Briand +S: Maintained +F: drivers/nvmem/layouts/fixed-layout.c + FLEXTIMER FTM-QUADDEC DRIVER M: Patrick Havelange L: linux-iio@vger.kernel.org diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 311cb2e5a5c0..0ec4924c4bda 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -786,7 +786,7 @@ static int nvmem_validate_keepouts(struct nvmem_device = *nvmem) return 0; } =20 -static int nvmem_add_cells_from_dt(struct nvmem_device *nvmem, struct devi= ce_node *np) +int nvmem_add_cells_from_dt(struct nvmem_device *nvmem, struct device_node= *np) { struct device *dev =3D &nvmem->dev; const __be32 *addr; @@ -840,23 +840,6 @@ static int nvmem_add_cells_from_legacy_of(struct nvmem= _device *nvmem) return nvmem_add_cells_from_dt(nvmem, nvmem->dev.of_node); } =20 -static int nvmem_add_cells_from_fixed_layout(struct nvmem_device *nvmem) -{ - struct device_node *layout_np; - int err =3D 0; - - layout_np =3D of_nvmem_layout_get_container(nvmem); - if (!layout_np) - return 0; - - if (of_device_is_compatible(layout_np, "fixed-layout")) - err =3D nvmem_add_cells_from_dt(nvmem, layout_np); - - of_node_put(layout_np); - - return err; -} - int nvmem_layout_register(struct nvmem_layout *layout) { int ret; @@ -1005,10 +988,6 @@ struct nvmem_device *nvmem_register(const struct nvme= m_config *config) goto err_remove_cells; } =20 - rval =3D nvmem_add_cells_from_fixed_layout(nvmem); - if (rval) - goto err_remove_cells; - dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name); =20 rval =3D device_add(&nvmem->dev); diff --git a/drivers/nvmem/layouts.c b/drivers/nvmem/layouts.c index b90584e1b99e..07a34be9669c 100644 --- a/drivers/nvmem/layouts.c +++ b/drivers/nvmem/layouts.c @@ -125,11 +125,6 @@ static int nvmem_layout_create_device(struct nvmem_dev= ice *nvmem, return 0; } =20 -static const struct of_device_id of_nvmem_layout_skip_table[] =3D { - { .compatible =3D "fixed-layout", }, - {} -}; - static int nvmem_layout_bus_populate(struct nvmem_device *nvmem, struct device_node *layout_dn) { @@ -142,12 +137,6 @@ static int nvmem_layout_bus_populate(struct nvmem_devi= ce *nvmem, return 0; } =20 - /* Fixed layouts are parsed manually somewhere else for now */ - if (of_match_node(of_nvmem_layout_skip_table, layout_dn)) { - pr_debug("%s() - skipping %pOF node\n", __func__, layout_dn); - return 0; - } - if (of_node_check_flag(layout_dn, OF_POPULATED_BUS)) { pr_debug("%s() - skipping %pOF, already populated\n", __func__, layout_dn); diff --git a/drivers/nvmem/layouts/Makefile b/drivers/nvmem/layouts/Makefile index 4940c9db0665..dd6c6c70b1a9 100644 --- a/drivers/nvmem/layouts/Makefile +++ b/drivers/nvmem/layouts/Makefile @@ -3,6 +3,7 @@ # Makefile for nvmem layouts. # =20 +obj-$(CONFIG_NVMEM_LAYOUTS) +=3D fixed-layout.o obj-$(CONFIG_NVMEM_LAYOUT_SL28_VPD) +=3D sl28vpd.o obj-$(CONFIG_NVMEM_LAYOUT_ONIE_TLV) +=3D onie-tlv.o obj-$(CONFIG_NVMEM_LAYOUT_U_BOOT_ENV) +=3D u-boot-env.o diff --git a/drivers/nvmem/layouts/fixed-layout.c b/drivers/nvmem/layouts/f= ixed-layout.c new file mode 100644 index 000000000000..bc7da9a904d4 --- /dev/null +++ b/drivers/nvmem/layouts/fixed-layout.c @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright 2026 Bootlin + * + * Authors: Mathieu Dubois-Briand + */ + +#include +#include + +static int fixed_layout_add_cells(struct nvmem_layout *layout) +{ + struct device_node *np; + + np =3D of_nvmem_layout_get_container(layout->nvmem); + if (!np) + return -ENOENT; + + return nvmem_add_cells_from_dt(layout->nvmem, np); +} + +static int fixed_layout_probe(struct nvmem_layout *layout) +{ + layout->add_cells =3D fixed_layout_add_cells; + + return nvmem_layout_register(layout); +} + +static void fixed_layout_remove(struct nvmem_layout *layout) +{ + nvmem_layout_unregister(layout); +} + +static const struct of_device_id fixed_layout_of_match_table[] =3D { + { .compatible =3D "fixed-layout", }, + {}, +}; + +static struct nvmem_layout_driver fixed_layout_layout =3D { + .driver =3D { + .name =3D "fixed-layout", + .of_match_table =3D fixed_layout_of_match_table, + }, + .probe =3D fixed_layout_probe, + .remove =3D fixed_layout_remove, +}; +module_nvmem_layout_driver(fixed_layout_layout); + +MODULE_AUTHOR("Mathieu Dubois-Briand"); +MODULE_LICENSE("GPL"); +MODULE_DEVICE_TABLE(of, fixed_layout_of_match_table); +MODULE_DESCRIPTION("NVMEM fixed-layout driver"); 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, =20 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); =20 #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_l= ayout *layout) =20 static inline void nvmem_layout_unregister(struct nvmem_layout *layout) {} =20 +static inline int nvmem_add_cells_from_dt(struct nvmem_device *nvmem, + struct device_node *np) +{ + return -EOPNOTSUPP; +} + #endif /* CONFIG_NVMEM */ =20 #if IS_ENABLED(CONFIG_NVMEM) && IS_ENABLED(CONFIG_OF) --=20 2.47.3 From nobody Fri Jun 12 11:08:52 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D75AC3AC0D7 for ; Fri, 15 May 2026 11:57:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778846246; cv=none; b=KZ1GBHMjl9trGDQnG3fDJFjgmuDgMkck1rdShREIkVZDYT1mc+i2mN/QolvQav9CF727mNtwh+1PlHEd76fMAi5qPKh4fq7zkozk1Z5A59ZJ5FLryhNu8mZfn4b6agBOQAbyF4NlOT27LMMVQsfqYHh21TJ9c9281sUiZN1/0tU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778846246; c=relaxed/simple; bh=nx0J1QX5oaXOCykQ07CxVUiQY0PaY0fsVt6IsOUPFtQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hxaHn3C98u3V4DW0qUlOwZybg9f4uom0WJtOXXXVSPejALe6MAeaA9DiKU65sy0eehoC8+efLs3bWZWWtXkpTb43+iCVstr67G958WWfuS4XMsj4lh5cXx60Gk0dvl6OmpDkGfqXzNUKG1ehbezKnBIoNaLmJXjPKtA217mtX4Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=ofACj4MP; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="ofACj4MP" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 7FA234E42CAF; Fri, 15 May 2026 11:57:23 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 570D3606FD; Fri, 15 May 2026 11:57:23 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id E60D911AF8C5C; Fri, 15 May 2026 13:57:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1778846242; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=KWr11r2W+5gIUvnQAWZ5dbd+eVz+6vXjcvqbFYT0Wo8=; b=ofACj4MP9e5VeMy9iJzUnpG5d6Tf84OcahQPR0FHmY7vM3EybAu/Rx/HgQhDclz85voYYa v5U4+EWWtgUuDNmvvXvXTzhTQa58FiJ7dvNT0iKRG3mE3ZGnxTm3rX9uK+nxBFPxj5kjGL AzJd6ASCHjq1MvsTZ00F5+/yUCtNiXda2i8UyEzQcTpH+j+ymTCL3deSRAuhUzb/Was1Cb rwVbBC9+mLNN46ciglKmLKl4ahGxIUNUQP60MlLqHVZSaXnzozB4u4gO2Qqdpflt1zuY27 g8VJ0org0rqmcMUjMTyronMSPaaeqLwZqVP0lEi3btrjDqs7eyTlm6mzv+IfYQ== From: Mathieu Dubois-Briand Date: Fri, 15 May 2026 13:56:57 +0200 Subject: [PATCH v2 2/2] nvmem: layouts: Make the fixed-layout driver optional Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260515-mathieu-nvmem-fixed-layout-v2-2-8ac215dd4016@bootlin.com> References: <20260515-mathieu-nvmem-fixed-layout-v2-0-8ac215dd4016@bootlin.com> In-Reply-To: <20260515-mathieu-nvmem-fixed-layout-v2-0-8ac215dd4016@bootlin.com> To: Srinivas Kandagatla , Greg Kroah-Hartman Cc: Miquel Raynal , =?utf-8?q?Gr=C3=A9gory_Clement?= , Thomas Petazzoni , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Mathieu Dubois-Briand X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1778846239; l=1950; i=mathieu.dubois-briand@bootlin.com; s=20241219; h=from:subject:message-id; bh=nx0J1QX5oaXOCykQ07CxVUiQY0PaY0fsVt6IsOUPFtQ=; b=vJ8C0JgVunY0CqA0AwqdsO34bPgkxulBxzU4qZ0fttgd7pZ8kkaTfi0FWAdTqP3VwKjjofYw5 e9IqAPHjU/KASTN4gm4lr9P9jcz+Xznsph3o/XxzrbGRh3zODLorPSs X-Developer-Key: i=mathieu.dubois-briand@bootlin.com; a=ed25519; pk=1PVTmzPXfKvDwcPUzG0aqdGoKZJA3b9s+3DqRlm0Lww= X-Last-TLS-Session-Version: TLSv1.3 The fixed-layout support is now managed by a separate driver, so we can make this support optional. This aligns with the approach taken for other layout drivers. Signed-off-by: Mathieu Dubois-Briand --- drivers/nvmem/core.c | 1 + drivers/nvmem/layouts/Kconfig | 8 ++++++++ drivers/nvmem/layouts/Makefile | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 0ec4924c4bda..594180d4b889 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -834,6 +834,7 @@ int nvmem_add_cells_from_dt(struct nvmem_device *nvmem,= struct device_node *np) =20 return 0; } +EXPORT_SYMBOL_GPL(nvmem_add_cells_from_dt); =20 static int nvmem_add_cells_from_legacy_of(struct nvmem_device *nvmem) { diff --git a/drivers/nvmem/layouts/Kconfig b/drivers/nvmem/layouts/Kconfig index 5e586dfebe47..f823d56210a3 100644 --- a/drivers/nvmem/layouts/Kconfig +++ b/drivers/nvmem/layouts/Kconfig @@ -8,6 +8,14 @@ if NVMEM_LAYOUTS =20 menu "Layout Types" =20 +config NVMEM_LAYOUT_FIXED_LAYOUT + tristate "Fixed layout support" + help + Say Y here to enable support for NVMEM fixed layout, which provides a + way to describe memory cells with fixed offsets and sizes. + + If unsure, say N. + config NVMEM_LAYOUT_SL28_VPD tristate "Kontron sl28 VPD layout support" select CRC8 diff --git a/drivers/nvmem/layouts/Makefile b/drivers/nvmem/layouts/Makefile index dd6c6c70b1a9..9da790a9dde9 100644 --- a/drivers/nvmem/layouts/Makefile +++ b/drivers/nvmem/layouts/Makefile @@ -3,7 +3,7 @@ # Makefile for nvmem layouts. # =20 -obj-$(CONFIG_NVMEM_LAYOUTS) +=3D fixed-layout.o +obj-$(CONFIG_NVMEM_LAYOUT_FIXED_LAYOUT) +=3D fixed-layout.o obj-$(CONFIG_NVMEM_LAYOUT_SL28_VPD) +=3D sl28vpd.o obj-$(CONFIG_NVMEM_LAYOUT_ONIE_TLV) +=3D onie-tlv.o obj-$(CONFIG_NVMEM_LAYOUT_U_BOOT_ENV) +=3D u-boot-env.o --=20 2.47.3