* [PATCH 0/3] nvmem: Add driver for i.MX BBNSM GP register
@ 2026-11-01 20:01 Stefan Wahren
2026-11-01 20:01 ` [PATCH 1/3] dt-bindings: mfd: nxp,bbnsm: Add NVMEM for GP registers Stefan Wahren
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Stefan Wahren @ 2026-11-01 20:01 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Frank Li, Srinivas Kandagatla
Cc: Sascha Hauer, kernel, Fabio Estevam, Jacky Bai, mfd, devicetree,
imx, linux-arm-kernel, Stefan Wahren
The Battery-Backed Non-Secure Module (BBNSM) on i.MX9 SoCs can have
some general purpose registers, which retain their data on power-down.
This driver make these register accessible via NVMEM subsystem.
Stefan Wahren (3):
dt-bindings: mfd: nxp,bbnsm: Add NVMEM for GP registers
nvmem: Add driver for i.MX BBNSM GP register
arm64: dts: imx91_93_common: Enable BBNSM NVMEM
.../devicetree/bindings/mfd/nxp,bbnsm.yaml | 20 +++
.../boot/dts/freescale/imx91_93_common.dtsi | 6 +
drivers/nvmem/Kconfig | 12 ++
drivers/nvmem/Makefile | 2 +
drivers/nvmem/imx-bbnsm.c | 116 ++++++++++++++++++
5 files changed, 156 insertions(+)
create mode 100644 drivers/nvmem/imx-bbnsm.c
--
2.53.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/3] dt-bindings: mfd: nxp,bbnsm: Add NVMEM for GP registers
2026-11-01 20:01 [PATCH 0/3] nvmem: Add driver for i.MX BBNSM GP register Stefan Wahren
@ 2026-11-01 20:01 ` Stefan Wahren
2026-11-01 20:08 ` sashiko-bot
2026-11-02 7:28 ` Krzysztof Kozlowski
2026-11-01 20:01 ` [PATCH 2/3] nvmem: Add driver for i.MX BBNSM GP register Stefan Wahren
2026-11-01 20:01 ` [PATCH 3/3] arm64: dts: imx91_93_common: Enable BBNSM NVMEM Stefan Wahren
2 siblings, 2 replies; 9+ messages in thread
From: Stefan Wahren @ 2026-11-01 20:01 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Frank Li, Srinivas Kandagatla
Cc: Sascha Hauer, kernel, Fabio Estevam, Jacky Bai, mfd, devicetree,
imx, linux-arm-kernel, Stefan Wahren
Document bindings for the optional Battery-Backed Non-Secure Module
general purpose registers available on i.MX9 SoCs.
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
.../devicetree/bindings/mfd/nxp,bbnsm.yaml | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml b/Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml
index b1ade64a1554..4c4b7c3fff2a 100644
--- a/Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml
+++ b/Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml
@@ -31,6 +31,20 @@ properties:
reg:
maxItems: 1
+ nvmem:
+ type: object
+ $ref: /schemas/nvmem/nvmem.yaml#
+
+ properties:
+ compatible:
+ enum:
+ - nxp,imx93-bbnsm-nvmem
+
+ required:
+ - compatible
+
+ additionalProperties: false
+
rtc:
type: object
$ref: /schemas/rtc/rtc.yaml#
@@ -88,6 +102,12 @@ examples:
compatible = "nxp,imx93-bbnsm", "syscon", "simple-mfd";
reg = <0x44440000 0x10000>;
+ nvmem {
+ compatible = "nxp,imx93-bbnsm-nvmem";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ };
+
bbnsm_rtc: rtc {
compatible = "nxp,imx93-bbnsm-rtc";
interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
--
2.53.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3] nvmem: Add driver for i.MX BBNSM GP register
2026-11-01 20:01 [PATCH 0/3] nvmem: Add driver for i.MX BBNSM GP register Stefan Wahren
2026-11-01 20:01 ` [PATCH 1/3] dt-bindings: mfd: nxp,bbnsm: Add NVMEM for GP registers Stefan Wahren
@ 2026-11-01 20:01 ` Stefan Wahren
2026-11-01 20:14 ` sashiko-bot
2026-11-01 20:01 ` [PATCH 3/3] arm64: dts: imx91_93_common: Enable BBNSM NVMEM Stefan Wahren
2 siblings, 1 reply; 9+ messages in thread
From: Stefan Wahren @ 2026-11-01 20:01 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Frank Li, Srinivas Kandagatla
Cc: Sascha Hauer, kernel, Fabio Estevam, Jacky Bai, mfd, devicetree,
imx, linux-arm-kernel, Stefan Wahren
The Battery-Backed Non-Secure Module (BBNSM) on i.MX9 SoCs can have
some general purpose registers, which retain their data on power-down.
This driver make these register accessible via NVMEM subsystem.
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
drivers/nvmem/Kconfig | 12 ++++
drivers/nvmem/Makefile | 2 +
drivers/nvmem/imx-bbnsm.c | 116 ++++++++++++++++++++++++++++++++++++++
3 files changed, 130 insertions(+)
create mode 100644 drivers/nvmem/imx-bbnsm.c
diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig
index d2f5bb236663..d238186b1216 100644
--- a/drivers/nvmem/Kconfig
+++ b/drivers/nvmem/Kconfig
@@ -185,6 +185,18 @@ config NVMEM_BRCM_NVRAM
This driver provides support for Broadcom's NVRAM that can be accessed
using I/O mapping.
+config NVMEM_IMX_BBNSM
+ tristate "i.MX BBNSM general purpose register support"
+ depends on ARCH_MXC || COMPILE_TEST
+ depends on OF
+ select REGMAP_MMIO
+ help
+ This is a driver for the general purpose registers available in the
+ Battery-Backed Non-Secure Module (BBNSM) on i.MX9 SoCs.
+
+ This driver can also be built as a module. If so, the module
+ will be called nvmem-imx-bbnsm.
+
config NVMEM_IMX_IIM
tristate "i.MX IC Identification Module support"
depends on ARCH_MXC || COMPILE_TEST
diff --git a/drivers/nvmem/Makefile b/drivers/nvmem/Makefile
index 5e70bad9f0f9..ec54e83da46a 100644
--- a/drivers/nvmem/Makefile
+++ b/drivers/nvmem/Makefile
@@ -27,6 +27,8 @@ obj-$(CONFIG_NVMEM_BCM_OCOTP) += nvmem-bcm-ocotp.o
nvmem-bcm-ocotp-y := bcm-ocotp.o
obj-$(CONFIG_NVMEM_BRCM_NVRAM) += nvmem_brcm_nvram.o
nvmem_brcm_nvram-y := brcm_nvram.o
+obj-$(CONFIG_NVMEM_IMX_BBNSM) += nvmem-imx-bbnsm.o
+nvmem-imx-bbnsm-y := imx-bbnsm.o
obj-$(CONFIG_NVMEM_IMX_IIM) += nvmem-imx-iim.o
nvmem-imx-iim-y := imx-iim.o
obj-$(CONFIG_NVMEM_IMX_OCOTP) += nvmem-imx-ocotp.o
diff --git a/drivers/nvmem/imx-bbnsm.c b/drivers/nvmem/imx-bbnsm.c
new file mode 100644
index 000000000000..4fe96161834e
--- /dev/null
+++ b/drivers/nvmem/imx-bbnsm.c
@@ -0,0 +1,116 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * i.MX Battery-Backed Non-Secure Module general purpose registers
+ *
+ * Copyright (c) 2026 Stefan Wahren <wahrenst@gmx.net>
+ *
+ * Based on snvs lpgpr driver,
+ * Copyright (c) 2015 Pengutronix, Steffen Trumtrar <kernel@pengutronix.de>
+ * Copyright (c) 2017 Pengutronix, Oleksij Rempel <kernel@pengutronix.de>
+ */
+
+#include <linux/bitfield.h>
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>
+#include <linux/nvmem-provider.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+
+#define BBNSM_FEATURES 0x4
+#define BBNSM_GPR_SZ_SHIFT 2
+#define BBNSM_GPR_SZ_MASK GENMASK(7, BBNSM_GPR_SZ_SHIFT)
+
+#define BBNSM_GPR 0x300
+
+struct imx_bbnsm_priv {
+ struct regmap *regmap;
+ struct nvmem_config cfg;
+};
+
+static int imx_bbnsm_read(void *context, unsigned int offset, void *val,
+ size_t bytes)
+{
+ struct imx_bbnsm_priv *priv = context;
+
+ return regmap_bulk_read(priv->regmap, BBNSM_GPR + offset, val,
+ bytes / 4);
+}
+
+static int imx_bbnsm_write(void *context, unsigned int offset, void *val,
+ size_t bytes)
+{
+ struct imx_bbnsm_priv *priv = context;
+
+ return regmap_bulk_write(priv->regmap, BBNSM_GPR + offset, val,
+ bytes / 4);
+}
+
+static int imx_bbnsm_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct device_node *parent;
+ struct imx_bbnsm_priv *priv;
+ struct nvmem_device *nvmem;
+ u32 gpr_words;
+ u32 features;
+ int ret;
+
+ if (!dev->of_node)
+ return -ENOENT;
+
+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+ if (!priv)
+ return -ENOMEM;
+
+ parent = of_get_parent(dev->of_node);
+ if (!parent)
+ return -ENODEV;
+
+ priv->regmap = syscon_node_to_regmap(parent);
+ of_node_put(parent);
+ if (IS_ERR(priv->regmap))
+ return PTR_ERR(priv->regmap);
+
+ ret = regmap_read(priv->regmap, BBNSM_FEATURES, &features);
+ if (ret)
+ return ret;
+
+ /* Are any general purpose register available? */
+ gpr_words = (features & BBNSM_GPR_SZ_MASK) >> BBNSM_GPR_SZ_SHIFT;
+ if (!gpr_words)
+ return -ENODEV;
+
+ priv->cfg.dev = dev;
+ priv->cfg.name = dev_name(dev);
+ priv->cfg.owner = THIS_MODULE;
+ priv->cfg.priv = priv;
+ priv->cfg.stride = 4;
+ priv->cfg.word_size = 4;
+ priv->cfg.size = gpr_words * sizeof(u32);
+ priv->cfg.reg_read = imx_bbnsm_read;
+ priv->cfg.reg_write = imx_bbnsm_write;
+
+ nvmem = devm_nvmem_register(dev, &priv->cfg);
+
+ return PTR_ERR_OR_ZERO(nvmem);
+}
+
+static const struct of_device_id imx_bbnsm_of_match[] = {
+ { .compatible = "nxp,imx93-bbnsm-nvmem" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, imx_bbnsm_of_match);
+
+static struct platform_driver imx_bbnsm_driver = {
+ .probe = imx_bbnsm_probe,
+ .driver = {
+ .name = "imx-bbnsm-nvmem",
+ .of_match_table = imx_bbnsm_of_match,
+ },
+};
+module_platform_driver(imx_bbnsm_driver);
+
+MODULE_AUTHOR("Stefan Wahren <wahrenst@gmx.net>");
+MODULE_DESCRIPTION("i.MX BBNSM general purpose register NVMEM driver");
+MODULE_LICENSE("GPL");
--
2.53.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3] arm64: dts: imx91_93_common: Enable BBNSM NVMEM
2026-11-01 20:01 [PATCH 0/3] nvmem: Add driver for i.MX BBNSM GP register Stefan Wahren
2026-11-01 20:01 ` [PATCH 1/3] dt-bindings: mfd: nxp,bbnsm: Add NVMEM for GP registers Stefan Wahren
2026-11-01 20:01 ` [PATCH 2/3] nvmem: Add driver for i.MX BBNSM GP register Stefan Wahren
@ 2026-11-01 20:01 ` Stefan Wahren
2026-11-01 20:17 ` sashiko-bot
2026-11-02 7:29 ` Krzysztof Kozlowski
2 siblings, 2 replies; 9+ messages in thread
From: Stefan Wahren @ 2026-11-01 20:01 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Frank Li, Srinivas Kandagatla
Cc: Sascha Hauer, kernel, Fabio Estevam, Jacky Bai, mfd, devicetree,
imx, linux-arm-kernel, Stefan Wahren
Enable the BBNSM NVMEM for all i.MX91/93 boards.
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
arch/arm64/boot/dts/freescale/imx91_93_common.dtsi | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/arm64/boot/dts/freescale/imx91_93_common.dtsi b/arch/arm64/boot/dts/freescale/imx91_93_common.dtsi
index a68ffd04ee08..c8bbf6f1bcf9 100644
--- a/arch/arm64/boot/dts/freescale/imx91_93_common.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx91_93_common.dtsi
@@ -363,6 +363,12 @@ bbnsm: bbnsm@44440000 {
compatible = "nxp,imx93-bbnsm", "syscon", "simple-mfd";
reg = <0x44440000 0x10000>;
+ bbnsm_nvmem: nvmem {
+ compatible = "nxp,imx93-bbnsm-nvmem";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ };
+
bbnsm_rtc: rtc {
compatible = "nxp,imx93-bbnsm-rtc";
interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
--
2.53.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] dt-bindings: mfd: nxp,bbnsm: Add NVMEM for GP registers
2026-11-01 20:01 ` [PATCH 1/3] dt-bindings: mfd: nxp,bbnsm: Add NVMEM for GP registers Stefan Wahren
@ 2026-11-01 20:08 ` sashiko-bot
2026-11-02 7:28 ` Krzysztof Kozlowski
1 sibling, 0 replies; 9+ messages in thread
From: sashiko-bot @ 2026-11-01 20:08 UTC (permalink / raw)
To: Stefan Wahren; +Cc: mfd, devicetree, imx, robh, conor+dt, Frank.Li, lee
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] dt-bindings: mfd: nxp,bbnsm: additionalProperties: false breaks nvmem schema
--
commit 9d4b26f677f71a4d6410c83a13726309dd8d81b5
Author: Stefan Wahren <wahrenst@gmx.net>
dt-bindings: mfd: nxp,bbnsm: Add NVMEM for GP registers
This commit documents the device tree bindings for the optional
Battery-Backed Non-Secure Module general purpose registers available on
i.MX9 SoCs.
> diff --git a/Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml b/Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml
> index b1ade64a15541..4c4b7c3fff2a2 100644
> --- a/Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml
> +++ b/Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml
> @@ -31,6 +31,20 @@ properties:
> reg:
> maxItems: 1
>
> + nvmem:
> + type: object
> + $ref: /schemas/nvmem/nvmem.yaml#
> +
> + properties:
> + compatible:
> + enum:
> + - nxp,imx93-bbnsm-nvmem
> +
> + required:
> + - compatible
> +
> + additionalProperties: false
> +
> rtc:
> type: object
> $ref: /schemas/rtc/rtc.yaml#
> @@ -88,6 +102,12 @@ examples:
> compatible = "nxp,imx93-bbnsm", "syscon", "simple-mfd";
> reg = <0x44440000 0x10000>;
>
> + nvmem {
> + compatible = "nxp,imx93-bbnsm-nvmem";
> + #address-cells = <1>;
> + #size-cells = <1>;
> + };
[Severity: Medium]
Should the nvmem subnode schema use unevaluatedProperties: false instead
of additionalProperties: false?
Because nvmem references /schemas/nvmem/nvmem.yaml# via $ref and only
defines compatible in its local properties block, additionalProperties:
false rejects all properties inherited from nvmem.yaml#.
As a result, running dt_binding_check or dtbs_check fails on
#address-cells and #size-cells in the example above, as well as on any
device tree node using standard NVMEM provider properties.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261101200140.141642-1-wahrenst@gmx.net?part=1
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] nvmem: Add driver for i.MX BBNSM GP register
2026-11-01 20:01 ` [PATCH 2/3] nvmem: Add driver for i.MX BBNSM GP register Stefan Wahren
@ 2026-11-01 20:14 ` sashiko-bot
0 siblings, 0 replies; 9+ messages in thread
From: sashiko-bot @ 2026-11-01 20:14 UTC (permalink / raw)
To: Stefan Wahren; +Cc: mfd, devicetree, imx, robh, conor+dt, Frank.Li, lee
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] nvmem: imx-bbnsm: missing MFD_SYSCON dependency in Kconfig
--
commit 72a81833b2595fcf0c62fe0c32408d53d3b1d63b
Author: Stefan Wahren <wahrenst@gmx.net>
nvmem: Add driver for i.MX BBNSM GP register
This commit adds an NVMEM provider driver to expose the general purpose
registers in the Battery-Backed Non-Secure Module (BBNSM) on i.MX9 SoCs.
> diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig
> index c36c2a4c2a0b7..8d492d05f1602 100644
> --- a/drivers/nvmem/Kconfig
> +++ b/drivers/nvmem/Kconfig
> @@ -185,6 +185,18 @@ config NVMEM_BRCM_NVRAM
> This driver provides support for Broadcom's NVRAM that can be accessed
> using I/O mapping.
>
> +config NVMEM_IMX_BBNSM
> + tristate "i.MX BBNSM general purpose register support"
> + depends on ARCH_MXC || COMPILE_TEST
> + depends on OF
> + select REGMAP_MMIO
[Severity: Low]
Should NVMEM_IMX_BBNSM depend on or select MFD_SYSCON instead of selecting
REGMAP_MMIO?
In drivers/nvmem/imx-bbnsm.c, imx_bbnsm_probe() obtains its regmap via
syscon_node_to_regmap(parent) rather than calling any regmap-mmio API
directly:
priv->regmap = syscon_node_to_regmap(parent);
of_node_put(parent);
if (IS_ERR(priv->regmap))
return PTR_ERR(priv->regmap);
On arm64, ARCH_MXC does not select MFD_SYSCON (unlike 32-bit ARCH_MXC). When
CONFIG_MFD_SYSCON is disabled, syscon_node_to_regmap() in
include/linux/mfd/syscon.h falls back to its inline stub returning
ERR_PTR(-ENOTSUPP), causing imx_bbnsm_probe() to fail unconditionally at
runtime. MFD_SYSCON also already selects REGMAP_MMIO.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261101200140.141642-1-wahrenst@gmx.net?part=2
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] arm64: dts: imx91_93_common: Enable BBNSM NVMEM
2026-11-01 20:01 ` [PATCH 3/3] arm64: dts: imx91_93_common: Enable BBNSM NVMEM Stefan Wahren
@ 2026-11-01 20:17 ` sashiko-bot
2026-11-02 7:29 ` Krzysztof Kozlowski
1 sibling, 0 replies; 9+ messages in thread
From: sashiko-bot @ 2026-11-01 20:17 UTC (permalink / raw)
To: Stefan Wahren; +Cc: mfd, devicetree, imx, robh, conor+dt, Frank.Li, lee
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] arm64: dts: imx91_93_common: invalid #address-cells/#size-cells on bbnsm_nvmem
- [Medium] nvmem: imx-bbnsm: select MFD_SYSCON instead of REGMAP_MMIO in Kconfig
--
commit 0a2632d30940d432e106da0e2de92818ce87b154
Author: Stefan Wahren <wahrenst@gmx.net>
arm64: dts: imx91_93_common: Enable BBNSM NVMEM
This series adds devicetree bindings and an NVMEM driver for the i.MX9
Battery-Backed Non-Secure Module (BBNSM) general purpose registers, and
enables the BBNSM NVMEM node in imx91_93_common.dtsi.
> diff --git a/Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml b/Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml
> index b1ade64a15541..4c4b7c3fff2a2 100644
> --- a/Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml
> +++ b/Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml
> @@ -31,6 +31,20 @@ properties:
> reg:
> maxItems: 1
>
> + nvmem:
> + type: object
> + $ref: /schemas/nvmem/nvmem.yaml#
> +
> + properties:
> + compatible:
> + enum:
> + - nxp,imx93-bbnsm-nvmem
> +
> + required:
> + - compatible
> +
> + additionalProperties: false
> +
> rtc:
> type: object
> $ref: /schemas/rtc/rtc.yaml#
> @@ -88,6 +102,12 @@ examples:
> compatible = "nxp,imx93-bbnsm", "syscon", "simple-mfd";
> reg = <0x44440000 0x10000>;
>
> + nvmem {
> + compatible = "nxp,imx93-bbnsm-nvmem";
> + #address-cells = <1>;
> + #size-cells = <1>;
> + };
> +
> bbnsm_rtc: rtc {
> compatible = "nxp,imx93-bbnsm-rtc";
> interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
> diff --git a/arch/arm64/boot/dts/freescale/imx91_93_common.dtsi b/arch/arm64/boot/dts/freescale/imx91_93_common.dtsi
> index a1a7e6a0571bd..12a505a2c1546 100644
> --- a/arch/arm64/boot/dts/freescale/imx91_93_common.dtsi
> +++ b/arch/arm64/boot/dts/freescale/imx91_93_common.dtsi
> @@ -357,6 +357,12 @@ bbnsm: bbnsm@44440000 {
> compatible = "nxp,imx93-bbnsm", "syscon", "simple-mfd";
> reg = <0x44440000 0x10000>;
>
> + bbnsm_nvmem: nvmem {
> + compatible = "nxp,imx93-bbnsm-nvmem";
> + #address-cells = <1>;
> + #size-cells = <1>;
> + };
[Severity: Medium]
Should the nvmem schema in Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml
use unevaluatedProperties: false instead of additionalProperties: false, and
should #address-cells and #size-cells be dropped from both the binding example
and bbnsm_nvmem in arch/arm64/boot/dts/freescale/imx91_93_common.dtsi?
Because properties.nvmem in Documentation/devicetree/bindings/mfd/nxp,bbnsm.yaml
references /schemas/nvmem/nvmem.yaml# via $ref and specifies
additionalProperties: false with only compatible listed under properties, any
other property inherited from nvmem.yaml (such as #address-cells, #size-cells,
or nvmem-layout) is rejected during dt_binding_check and dtbs_check.
In addition, imx_bbnsm_probe() in drivers/nvmem/imx-bbnsm.c registers the
device without setting add_legacy_fixed_of_cells:
drivers/nvmem/imx-bbnsm.c:imx_bbnsm_probe() {
...
priv->cfg.stride = 4;
priv->cfg.word_size = 4;
priv->cfg.size = gpr_words * sizeof(u32);
priv->cfg.reg_read = imx_bbnsm_read;
priv->cfg.reg_write = imx_bbnsm_write;
nvmem = devm_nvmem_register(dev, &priv->cfg);
}
Since nvmem_register() only parses direct child cell nodes when
config->add_legacy_fixed_of_cells is true (and nxp,bbnsm.yaml does not
reference nvmem-deprecated-cells.yaml), cells defined directly under
bbnsm_nvmem are ignored at runtime, while defining cells inside an
nvmem-layout subnode will trigger dtc avoid_unnecessary_addr_size warnings if
#address-cells and #size-cells remain on the parent bbnsm_nvmem node.
[ ... ]
> diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig
> index c36c2a4c2a0b7..8d492d05f1602 100644
> --- a/drivers/nvmem/Kconfig
> +++ b/drivers/nvmem/Kconfig
> @@ -185,6 +185,18 @@ config NVMEM_BRCM_NVRAM
> This driver provides support for Broadcom's NVRAM that can be accessed
> using I/O mapping.
>
> +config NVMEM_IMX_BBNSM
> + tristate "i.MX BBNSM general purpose register support"
> + depends on ARCH_MXC || COMPILE_TEST
> + depends on OF
> + select REGMAP_MMIO
[Severity: Medium]
Should NVMEM_IMX_BBNSM select MFD_SYSCON (and depend on HAS_IOMEM) instead of
selecting REGMAP_MMIO?
In drivers/nvmem/imx-bbnsm.c, imx_bbnsm_probe() obtains its regmap via
syscon_node_to_regmap(parent):
priv->regmap = syscon_node_to_regmap(parent);
of_node_put(parent);
if (IS_ERR(priv->regmap))
return PTR_ERR(priv->regmap);
If CONFIG_MFD_SYSCON is not enabled, syscon_node_to_regmap() falls back to the
stub in include/linux/mfd/syscon.h that returns ERR_PTR(-ENOTSUPP), causing
imx_bbnsm_probe() to fail at runtime. Selecting MFD_SYSCON (which itself
selects REGMAP_MMIO and depends on HAS_IOMEM) also avoids selecting
REGMAP_MMIO on architectures without HAS_IOMEM under COMPILE_TEST.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261101200140.141642-1-wahrenst@gmx.net?part=3
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] dt-bindings: mfd: nxp,bbnsm: Add NVMEM for GP registers
2026-11-01 20:01 ` [PATCH 1/3] dt-bindings: mfd: nxp,bbnsm: Add NVMEM for GP registers Stefan Wahren
2026-11-01 20:08 ` sashiko-bot
@ 2026-11-02 7:28 ` Krzysztof Kozlowski
1 sibling, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2026-11-02 7:28 UTC (permalink / raw)
To: Stefan Wahren
Cc: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Frank Li, Srinivas Kandagatla, Sascha Hauer, kernel,
Fabio Estevam, Jacky Bai, mfd, devicetree, imx, linux-arm-kernel
On Sun, Nov 01, 2026 at 09:01:38PM +0100, Stefan Wahren wrote:
> + nvmem:
> + type: object
> + $ref: /schemas/nvmem/nvmem.yaml#
> +
> + properties:
> + compatible:
> + enum:
> + - nxp,imx93-bbnsm-nvmem
> +
> + required:
> + - compatible
> +
> + additionalProperties: false
> +
> rtc:
> type: object
> $ref: /schemas/rtc/rtc.yaml#
> @@ -88,6 +102,12 @@ examples:
> compatible = "nxp,imx93-bbnsm", "syscon", "simple-mfd";
> reg = <0x44440000 0x10000>;
>
> + nvmem {
> + compatible = "nxp,imx93-bbnsm-nvmem";
> + #address-cells = <1>;
> + #size-cells = <1>;
I don't think you tested your changes. address/size cells are not
allowed - see your binding.
Anyway, empty node makes almost no sense, so fold the node into the
parent.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] arm64: dts: imx91_93_common: Enable BBNSM NVMEM
2026-11-01 20:01 ` [PATCH 3/3] arm64: dts: imx91_93_common: Enable BBNSM NVMEM Stefan Wahren
2026-11-01 20:17 ` sashiko-bot
@ 2026-11-02 7:29 ` Krzysztof Kozlowski
1 sibling, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2026-11-02 7:29 UTC (permalink / raw)
To: Stefan Wahren
Cc: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Frank Li, Srinivas Kandagatla, Sascha Hauer, kernel,
Fabio Estevam, Jacky Bai, mfd, devicetree, imx, linux-arm-kernel
On Sun, Nov 01, 2026 at 09:01:40PM +0100, Stefan Wahren wrote:
> Enable the BBNSM NVMEM for all i.MX91/93 boards.
>
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> ---
> arch/arm64/boot/dts/freescale/imx91_93_common.dtsi | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/freescale/imx91_93_common.dtsi b/arch/arm64/boot/dts/freescale/imx91_93_common.dtsi
> index a68ffd04ee08..c8bbf6f1bcf9 100644
> --- a/arch/arm64/boot/dts/freescale/imx91_93_common.dtsi
> +++ b/arch/arm64/boot/dts/freescale/imx91_93_common.dtsi
> @@ -363,6 +363,12 @@ bbnsm: bbnsm@44440000 {
> compatible = "nxp,imx93-bbnsm", "syscon", "simple-mfd";
> reg = <0x44440000 0x10000>;
>
> + bbnsm_nvmem: nvmem {
> + compatible = "nxp,imx93-bbnsm-nvmem";
> + #address-cells = <1>;
> + #size-cells = <1>;
Pointless/redunadnt address/size cells. You have here DTC warnings.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-11-02 7:29 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-01 20:01 [PATCH 0/3] nvmem: Add driver for i.MX BBNSM GP register Stefan Wahren
2026-11-01 20:01 ` [PATCH 1/3] dt-bindings: mfd: nxp,bbnsm: Add NVMEM for GP registers Stefan Wahren
2026-11-01 20:08 ` sashiko-bot
2026-11-02 7:28 ` Krzysztof Kozlowski
2026-11-01 20:01 ` [PATCH 2/3] nvmem: Add driver for i.MX BBNSM GP register Stefan Wahren
2026-11-01 20:14 ` sashiko-bot
2026-11-01 20:01 ` [PATCH 3/3] arm64: dts: imx91_93_common: Enable BBNSM NVMEM Stefan Wahren
2026-11-01 20:17 ` sashiko-bot
2026-11-02 7:29 ` Krzysztof Kozlowski
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.