* [PATCH v2 0/2] nvmem: layouts: Add fixed-layout driver
@ 2026-05-15 11:56 Mathieu Dubois-Briand
2026-05-15 11:56 ` [PATCH v2 1/2] " Mathieu Dubois-Briand
2026-05-15 11:56 ` [PATCH v2 2/2] nvmem: layouts: Make the fixed-layout driver optional Mathieu Dubois-Briand
0 siblings, 2 replies; 7+ messages in thread
From: Mathieu Dubois-Briand @ 2026-05-15 11:56 UTC (permalink / raw)
To: Srinivas Kandagatla, Greg Kroah-Hartman
Cc: Miquel Raynal, Grégory Clement, Thomas Petazzoni,
linux-kernel, stable, Mathieu Dubois-Briand
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
---
Changes in v2:
- Fixed dependency on core layout code with CONFIG_NVMEM_LAYOUTS
- Make fixed layout optional
- Link to v1: https://lore.kernel.org/r/20260505-mathieu-nvmem-fixed-layout-v1-1-7f6ecbce108d@bootlin.com
---
Mathieu Dubois-Briand (2):
nvmem: layouts: Add fixed-layout driver
nvmem: layouts: Make the fixed-layout driver optional
MAINTAINERS | 5 ++++
drivers/nvmem/core.c | 24 ++---------------
drivers/nvmem/layouts.c | 11 --------
drivers/nvmem/layouts/Kconfig | 8 ++++++
drivers/nvmem/layouts/Makefile | 1 +
drivers/nvmem/layouts/fixed-layout.c | 52 ++++++++++++++++++++++++++++++++++++
include/linux/nvmem-provider.h | 7 +++++
7 files changed, 75 insertions(+), 33 deletions(-)
---
base-commit: 7fd2df204f342fc17d1a0bfcd474b24232fb0f32
change-id: 20260504-mathieu-nvmem-fixed-layout-24c6f8500bf6
Best regards,
--
Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH v2 1/2] nvmem: layouts: Add fixed-layout driver 2026-05-15 11:56 [PATCH v2 0/2] nvmem: layouts: Add fixed-layout driver Mathieu Dubois-Briand @ 2026-05-15 11:56 ` Mathieu Dubois-Briand 2026-05-18 7:40 ` Miquel Raynal ` (2 more replies) 2026-05-15 11:56 ` [PATCH v2 2/2] nvmem: layouts: Make the fixed-layout driver optional Mathieu Dubois-Briand 1 sibling, 3 replies; 7+ messages in thread From: Mathieu Dubois-Briand @ 2026-05-15 11:56 UTC (permalink / raw) To: Srinivas Kandagatla, Greg Kroah-Hartman Cc: Miquel Raynal, Grégory Clement, Thomas Petazzoni, linux-kernel, stable, Mathieu Dubois-Briand 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 <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/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 +FIXED-LAYOUT NVMEM LAYOUT DRIVER +M: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> +S: Maintained +F: drivers/nvmem/layouts/fixed-layout.c + FLEXTIMER FTM-QUADDEC DRIVER M: Patrick Havelange <patrick.havelange@essensium.com> 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; } -static int nvmem_add_cells_from_dt(struct nvmem_device *nvmem, struct device_node *np) +int nvmem_add_cells_from_dt(struct nvmem_device *nvmem, struct device_node *np) { struct device *dev = &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); } -static int nvmem_add_cells_from_fixed_layout(struct nvmem_device *nvmem) -{ - struct device_node *layout_np; - int err = 0; - - layout_np = of_nvmem_layout_get_container(nvmem); - if (!layout_np) - return 0; - - if (of_device_is_compatible(layout_np, "fixed-layout")) - err = 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 nvmem_config *config) goto err_remove_cells; } - rval = nvmem_add_cells_from_fixed_layout(nvmem); - if (rval) - goto err_remove_cells; - dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name); rval = 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_device *nvmem, return 0; } -static const struct of_device_id of_nvmem_layout_skip_table[] = { - { .compatible = "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_device *nvmem, return 0; } - /* 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. # +obj-$(CONFIG_NVMEM_LAYOUTS) += fixed-layout.o 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..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 <mathieu.dubois-briand@bootlin.com> + */ + +#include <linux/nvmem-provider.h> +#include <linux/of.h> + +static int fixed_layout_add_cells(struct nvmem_layout *layout) +{ + struct device_node *np; + + np = 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 = 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[] = { + { .compatible = "fixed-layout", }, + {}, +}; + +static struct nvmem_layout_driver fixed_layout_layout = { + .driver = { + .name = "fixed-layout", + .of_match_table = fixed_layout_of_match_table, + }, + .probe = fixed_layout_probe, + .remove = 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, 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); #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 */ #if IS_ENABLED(CONFIG_NVMEM) && IS_ENABLED(CONFIG_OF) -- 2.47.3 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/2] nvmem: layouts: Add fixed-layout driver 2026-05-15 11:56 ` [PATCH v2 1/2] " Mathieu Dubois-Briand @ 2026-05-18 7:40 ` Miquel Raynal 2026-05-19 14:59 ` Srinivas Kandagatla 2026-05-19 15:02 ` Srinivas Kandagatla 2 siblings, 0 replies; 7+ messages in thread From: Miquel Raynal @ 2026-05-18 7:40 UTC (permalink / raw) To: Mathieu Dubois-Briand Cc: Srinivas Kandagatla, Greg Kroah-Hartman, Grégory Clement, Thomas Petazzoni, linux-kernel, stable Hi Mathieu, On 15/05/2026 at 13:56:56 +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. > > Fixes: fc29fd821d9a ("nvmem: core: Rework layouts to become regular devices") > Cc: stable@vger.kernel.org > Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> Thanks! Miquèl ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/2] nvmem: layouts: Add fixed-layout driver 2026-05-15 11:56 ` [PATCH v2 1/2] " Mathieu Dubois-Briand 2026-05-18 7:40 ` Miquel Raynal @ 2026-05-19 14:59 ` Srinivas Kandagatla 2026-05-19 15:02 ` Srinivas Kandagatla 2 siblings, 0 replies; 7+ messages in thread From: Srinivas Kandagatla @ 2026-05-19 14:59 UTC (permalink / raw) To: Mathieu Dubois-Briand, Srinivas Kandagatla, Greg Kroah-Hartman Cc: Miquel Raynal, Grégory Clement, Thomas Petazzoni, linux-kernel, stable 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@vger.kernel.org > 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/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 > > +FIXED-LAYOUT NVMEM LAYOUT DRIVER > +M: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> > +S: Maintained > +F: drivers/nvmem/layouts/fixed-layout.c > + > FLEXTIMER FTM-QUADDEC DRIVER > M: Patrick Havelange <patrick.havelange@essensium.com> > 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; > } > > -static int nvmem_add_cells_from_dt(struct nvmem_device *nvmem, struct device_node *np) > +int nvmem_add_cells_from_dt(struct nvmem_device *nvmem, struct device_node *np) Export this in this patch itself. > { > struct device *dev = &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); > } > > -static int nvmem_add_cells_from_fixed_layout(struct nvmem_device *nvmem) > -{ > - struct device_node *layout_np; > - int err = 0; > - > - layout_np = of_nvmem_layout_get_container(nvmem); > - if (!layout_np) > - return 0; > - > - if (of_device_is_compatible(layout_np, "fixed-layout")) > - err = 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 nvmem_config *config) > goto err_remove_cells; > } > > - rval = nvmem_add_cells_from_fixed_layout(nvmem); > - if (rval) > - goto err_remove_cells; > - > dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name); > > rval = 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_device *nvmem, > return 0; > } > > -static const struct of_device_id of_nvmem_layout_skip_table[] = { > - { .compatible = "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_device *nvmem, > return 0; > } > > - /* 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. > # > > +obj-$(CONFIG_NVMEM_LAYOUTS) += fixed-layout.o > 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..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 <mathieu.dubois-briand@bootlin.com> > + */ > + > +#include <linux/nvmem-provider.h> > +#include <linux/of.h> > + > +static int fixed_layout_add_cells(struct nvmem_layout *layout) > +{ > + struct device_node *np; > + > + np = of_nvmem_layout_get_container(layout->nvmem); > + if (!np) > + return -ENOENT; > + > + return nvmem_add_cells_from_dt(layout->nvmem, np); np is leaking here. > +} > + > +static int fixed_layout_probe(struct nvmem_layout *layout) > +{ > + layout->add_cells = 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[] = { > + { .compatible = "fixed-layout", }, > + {}, > +}; > + > +static struct nvmem_layout_driver fixed_layout_layout = { > + .driver = { > + .name = "fixed-layout", > + .of_match_table = fixed_layout_of_match_table, > + }, > + .probe = fixed_layout_probe, > + .remove = 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, > > 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); > > #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 */ > > #if IS_ENABLED(CONFIG_NVMEM) && IS_ENABLED(CONFIG_OF) > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/2] nvmem: layouts: Add fixed-layout driver 2026-05-15 11:56 ` [PATCH v2 1/2] " Mathieu Dubois-Briand 2026-05-18 7:40 ` Miquel Raynal 2026-05-19 14:59 ` Srinivas Kandagatla @ 2026-05-19 15:02 ` Srinivas Kandagatla 2 siblings, 0 replies; 7+ messages in thread From: Srinivas Kandagatla @ 2026-05-19 15:02 UTC (permalink / raw) To: Mathieu Dubois-Briand, Srinivas Kandagatla, Greg Kroah-Hartman Cc: Miquel Raynal, Grégory Clement, Thomas Petazzoni, linux-kernel, stable 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@vger.kernel.org > 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 +++++ > 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 */ ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 2/2] nvmem: layouts: Make the fixed-layout driver optional 2026-05-15 11:56 [PATCH v2 0/2] nvmem: layouts: Add fixed-layout driver Mathieu Dubois-Briand 2026-05-15 11:56 ` [PATCH v2 1/2] " Mathieu Dubois-Briand @ 2026-05-15 11:56 ` Mathieu Dubois-Briand 2026-05-18 7:41 ` Miquel Raynal 1 sibling, 1 reply; 7+ messages in thread From: Mathieu Dubois-Briand @ 2026-05-15 11:56 UTC (permalink / raw) To: Srinivas Kandagatla, Greg Kroah-Hartman Cc: Miquel Raynal, Grégory Clement, Thomas Petazzoni, linux-kernel, stable, Mathieu Dubois-Briand 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 <mathieu.dubois-briand@bootlin.com> --- 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) return 0; } +EXPORT_SYMBOL_GPL(nvmem_add_cells_from_dt); 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 menu "Layout Types" +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. # -obj-$(CONFIG_NVMEM_LAYOUTS) += fixed-layout.o +obj-$(CONFIG_NVMEM_LAYOUT_FIXED_LAYOUT) += fixed-layout.o 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 -- 2.47.3 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] nvmem: layouts: Make the fixed-layout driver optional 2026-05-15 11:56 ` [PATCH v2 2/2] nvmem: layouts: Make the fixed-layout driver optional Mathieu Dubois-Briand @ 2026-05-18 7:41 ` Miquel Raynal 0 siblings, 0 replies; 7+ messages in thread From: Miquel Raynal @ 2026-05-18 7:41 UTC (permalink / raw) To: Mathieu Dubois-Briand Cc: Srinivas Kandagatla, Greg Kroah-Hartman, Grégory Clement, Thomas Petazzoni, linux-kernel, stable Hi Mathieu, On 15/05/2026 at 13:56:57 +02, Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> wrote: > 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 <mathieu.dubois-briand@bootlin.com> > --- > 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) > > return 0; > } > +EXPORT_SYMBOL_GPL(nvmem_add_cells_from_dt); > > 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 > > menu "Layout Types" > > +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. This will break existing default configurations, and most of them rely on the fixed layout. I believe this entry should default to =y. Thanks, Miquèl ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-05-19 15:02 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-05-15 11:56 [PATCH v2 0/2] nvmem: layouts: Add fixed-layout driver Mathieu Dubois-Briand 2026-05-15 11:56 ` [PATCH v2 1/2] " Mathieu Dubois-Briand 2026-05-18 7:40 ` Miquel Raynal 2026-05-19 14:59 ` Srinivas Kandagatla 2026-05-19 15:02 ` Srinivas Kandagatla 2026-05-15 11:56 ` [PATCH v2 2/2] nvmem: layouts: Make the fixed-layout driver optional Mathieu Dubois-Briand 2026-05-18 7:41 ` Miquel Raynal
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox