Skip to contentSkip to conversation

nvmem: patches for 6.19

PATCH In review [email protected] 2 participants 10 messages Nov 14, 2025 – Nov 26, 2025

Subsystems (6)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

cover nvmem: patches for 6.19

From: Srinivas Kandagatla <[email protected]>

Hi Greg,

Here are few nvmem patches for 6.19, Could you please queue these for 6.19.

Patches include
- new qnap-mcu nvmem provider
- new i.MX94 OCOTP support
- dt binding for sa8775p, MT8189.
- update dt-binding for u-boo-env.
- bindings tidy up.
Thanks,
Srini

Akhil P Oommen (1):
dt-bindings: nvmem: qfprom: Add sa8775p compatible

Alice Guo (2):
dt-bindings: nvmem: imx-ocotp: Add support for i.MX94
nvmem: imx-ocotp-ele: Add i.MX94 OCOTP support

Heiko Stuebner (1):
nvmem: Add driver for the eeprom in qnap-mcu controllers

Jack Hsu (1):
dt-bindings: nvmem: Support MediaTek MT8189 evb board efuse

Jascha Sundaresan (1):
nvmem: layouts: u-boot-env: add optional "env-size" property

Louis-Alexis Eyraud (1):
dt-bindings: nvmem: mediatek: efuse: Add compatible for MT8189 SoC

Wolfram Sang (1):
dt-bindings: nvmem: don't check node names

 .../devicetree/bindings/nvmem/imx-ocotp.yaml  |   4 +-
 .../bindings/nvmem/layouts/u-boot,env.yaml    |   7 ++
 .../bindings/nvmem/mediatek,efuse.yaml        |   5 +-
 .../bindings/nvmem/qcom,qfprom.yaml           |   1 +
 .../bindings/nvmem/st,stm32-romem.yaml        |   2 +-
 drivers/nvmem/Kconfig                         |   9 ++
 drivers/nvmem/Makefile                        |   2 +
 drivers/nvmem/imx-ocotp-ele.c                 |  20 ++++
 drivers/nvmem/layouts/u-boot-env.c            |   4 +-
 drivers/nvmem/qnap-mcu-eeprom.c               | 111 ++++++++++++++++++
 10 files changed, 161 insertions(+), 4 deletions(-)
 create mode 100644 drivers/nvmem/qnap-mcu-eeprom.c
Signature · 1 line
2.51.0
author maintainer
#1 lore raw

PATCH 1/8 dt-bindings: nvmem: qfprom: Add sa8775p compatible

From: Akhil P Oommen <[email protected]>

Document compatible string for the QFPROM on Lemans platform.

---
 Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml +1 -0
index 3f6dc6a3a9f1..7d1612acca48 100644
@@ -39,6 +39,7 @@ properties:
           - qcom,qcs404-qfprom
           - qcom,qcs615-qfprom
           - qcom,qcs8300-qfprom
+          - qcom,sa8775p-qfprom
           - qcom,sar2130p-qfprom
           - qcom,sc7180-qfprom
           - qcom,sc7280-qfprom
Signature · 1 line
2.51.0
author maintainer
#2 lore raw

PATCH 2/8 dt-bindings: nvmem: Support MediaTek MT8189 evb board efuse

In reply to [email protected]

From: Jack Hsu <[email protected]>

add compatible string for mt8189 evb board dts node of efuse

---
 Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml +1 -0
index 4dc0d42df3e6..9d52caaf3e5c 100644
@@ -48,6 +48,7 @@ properties:
               - mediatek,mt7988-efuse
               - mediatek,mt8173-efuse
               - mediatek,mt8183-efuse
+              - mediatek,mt8189-efuse
               - mediatek,mt8192-efuse
               - mediatek,mt8195-efuse
               - mediatek,mt8516-efuse
Signature · 1 line
2.51.0
author maintainer
#3 lore raw

PATCH 3/8 nvmem: Add driver for the eeprom in qnap-mcu controllers

In reply to [email protected]

From: Heiko Stuebner <[email protected]>

The qnap-mcu also has an eeprom connected to it, that contains some specific product-information like the mac addresses for the network interfaces.

Add a nvmem driver for it.

---
 drivers/nvmem/Kconfig           |   9 +++
 drivers/nvmem/Makefile          |   2 +
 drivers/nvmem/qnap-mcu-eeprom.c | 111 ++++++++++++++++++++++++++++++++
 3 files changed, 122 insertions(+)
 create mode 100644 drivers/nvmem/qnap-mcu-eeprom.c
drivers/nvmem/Kconfig +9 -0
index e0d88d3199c1..bf47a982cf62 100644
@@ -285,6 +285,15 @@ config NVMEM_QCOM_SEC_QFPROM
           This driver can also be built as a module. If so, the module will be called
           nvmem_sec_qfprom.
 
+config NVMEM_QNAP_MCU_EEPROM
+	tristate "QNAP MCU EEPROM Support"
+	depends on MFD_QNAP_MCU
+	help
+	  Say y here to enable support for accessing the EEPROM attached to
+	  QNAP MCU devices. This EEPROM contains additional runtime device
+	  information, like MAC addresses for ethernet devices that do not
+	  contain their own mac storage.
+
 config NVMEM_RAVE_SP_EEPROM
 	tristate "Rave SP EEPROM Support"
 	depends on RAVE_SP_CORE
drivers/nvmem/Makefile +2 -0
index 70a4464dcb1e..7252b8ec88d4 100644
@@ -56,6 +56,8 @@ obj-$(CONFIG_NVMEM_QCOM_QFPROM)		+= nvmem_qfprom.o
 nvmem_qfprom-y				:= qfprom.o
 obj-$(CONFIG_NVMEM_QCOM_SEC_QFPROM)	+= nvmem_sec_qfprom.o
 nvmem_sec_qfprom-y			:= sec-qfprom.o
+obj-$(CONFIG_NVMEM_QNAP_MCU_EEPROM)	+= nvmem-qnap-mcu-eeprom.o
+nvmem-qnap-mcu-eeprom-y			:= qnap-mcu-eeprom.o
 obj-$(CONFIG_NVMEM_RAVE_SP_EEPROM)	+= nvmem-rave-sp-eeprom.o
 nvmem-rave-sp-eeprom-y			:= rave-sp-eeprom.o
 obj-$(CONFIG_NVMEM_RCAR_EFUSE)		+= nvmem-rcar-efuse.o
drivers/nvmem/qnap-mcu-eeprom.c new file +111 -0

111 lines not on this page · raw message

Signature · 1 line
2.51.0
#4 lore raw

Re: [PATCH 3/8] nvmem: Add driver for the eeprom in qnap-mcu controllers

Quoted 6 lines · On Fri, Nov 14, 2025 at 11:06:31AM +0000, [email protected] wrote:

The qnap-mcu also has an eeprom connected to it, that contains some specific product-information like the mac addresses for the network interfaces.

Add a nvmem driver for it.

I have no problem with current code, but below some hints in case you want to improve it.

...

+ device.h
+ err.h

drivers/nvmem/qnap-mcu-eeprom.c line 16

Quoted 5 lines
drivers/nvmem/qnap-mcu-eeprom.c new file +5 -0
+#include <linux/mfd/qnap-mcu.h>
+#include <linux/module.h>
+#include <linux/nvmem-provider.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>

+ string.h
+ types.h

...

drivers/nvmem/qnap-mcu-eeprom.c line 31

Quoted 10 lines
drivers/nvmem/qnap-mcu-eeprom.c new file +10 -0
+static int qnap_mcu_eeprom_read_block(struct qnap_mcu *mcu, unsigned int offset,
+				      void *val, size_t bytes)
+{
+	const u8 cmd[] = { 0xf7, 0xa1, offset, bytes };
+	u8 *reply;
+	int ret = 0;
+
+	reply = kzalloc(bytes + sizeof(cmd), GFP_KERNEL);
+	if (!reply)
+		return -ENOMEM;

Using __free() from cleanup.h actually fits here and makes code easier to read.

Quoted 16 lines
drivers/nvmem/qnap-mcu-eeprom.c new file +16 -0
+	ret = qnap_mcu_exec(mcu, cmd, sizeof(cmd), reply, bytes + sizeof(cmd));
+	if (ret)
+		goto out;
+
+	/* First bytes must mirror the sent command */
+	if (memcmp(cmd, reply, sizeof(cmd))) {
+		ret = -EIO;
+		goto out;
+	}
+
+	memcpy(val, reply + sizeof(cmd), bytes);
+
+out:
+	kfree(reply);
+	return ret;
+}

...

drivers/nvmem/qnap-mcu-eeprom.c line 75

Quoted 2 lines
drivers/nvmem/qnap-mcu-eeprom.c new file +2 -0
+static int qnap_mcu_eeprom_probe(struct platform_device *pdev)
+{
	struct device *parent = pdev->dev.parent;

drivers/nvmem/qnap-mcu-eeprom.c line 76

Quoted 1 line
drivers/nvmem/qnap-mcu-eeprom.c new file +1 -0
+	struct qnap_mcu *mcu = dev_get_drvdata(pdev->dev.parent);
	struct qnap_mcu *mcu = dev_get_drvdata(parent);

drivers/nvmem/qnap-mcu-eeprom.c line 81

Quoted 6 lines
drivers/nvmem/qnap-mcu-eeprom.c new file +5 -0
+	struct nvmem_config nvcfg = {};
+	struct nvmem_device *ndev;
+
+	nvcfg.dev = &pdev->dev;
 
+	nvcfg.of_node = pdev->dev.parent->of_node;
	nvcfg.of_node = dev_of_node(parent);

(will need to include of.h, but ideally nvmem can be switched to fwnode)

Quoted 8 lines
drivers/nvmem/qnap-mcu-eeprom.c new file +8 -0
+	nvcfg.name = dev_name(&pdev->dev);
+	nvcfg.id = NVMEM_DEVID_NONE;
+	nvcfg.owner = THIS_MODULE;
+	nvcfg.type = NVMEM_TYPE_EEPROM;
+	nvcfg.read_only = true;
+	nvcfg.root_only = false;
+	nvcfg.reg_read = qnap_mcu_eeprom_read;
+	nvcfg.size = QNAP_MCU_EEPROM_SIZE,

drivers/nvmem/qnap-mcu-eeprom.c line 98

Quoted 10 lines
drivers/nvmem/qnap-mcu-eeprom.c new file +9 -0
+	nvcfg.word_size = 1,
+	nvcfg.stride = 1,
+	nvcfg.priv = mcu,
+
+	ndev = devm_nvmem_register(&pdev->dev, &nvcfg);
 
+	if (IS_ERR(ndev))
+		return PTR_ERR(ndev);
+
+	return 0;
	retrun PTR_ERR_OR_ZERO(...);
Quoted 1 line

+}

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author maintainer
#5 lore raw

PATCH 4/8 nvmem: layouts: u-boot-env: add optional "env-size" property

In reply to [email protected]

From: Jascha Sundaresan <[email protected]>

Some devices reserve a larger NVMEM region for the U-Boot environment than the actual environment data length used by U-Boot itself. The CRC32 in the U-Boot header is calculated over the smaller data length, causing CRC validation to fail when Linux reads the full partition.

Allow an optional device tree property "env-size" to specify the environment data size to use for CRC computation.

v2: add missing $ref line to DT binding

---
 .../devicetree/bindings/nvmem/layouts/u-boot,env.yaml      | 7 +++++++
 drivers/nvmem/layouts/u-boot-env.c                         | 4 +++-
 2 files changed, 10 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/nvmem/layouts/u-boot,env.yaml +7 -0
index 56a8f55d4a09..e9e75c38bd11 100644
@@ -46,6 +46,12 @@ properties:
     type: object
     description: Command to use for automatic booting
 
+  env-size:
+    description:
+      Size in bytes of the environment data used by U-Boot for CRC
+      calculation. If omitted, the full NVMEM region size is used.
+    $ref: /schemas/types.yaml#/definitions/uint32
+
   ethaddr:
     type: object
     description: Ethernet interfaces base MAC address.
@@ -104,6 +110,7 @@ examples:
 
             partition-u-boot-env {
                 compatible = "brcm,env";
+                env-size = <0x20000>;
 
                 ethaddr {
                 };
drivers/nvmem/layouts/u-boot-env.c +3 -1
index a27eeb08146f..ab32bf1291af 100644
@@ -99,10 +99,12 @@ int u_boot_env_parse(struct device *dev, struct nvmem_device *nvmem,
 	uint32_t crc32;
 	uint32_t calc;
 	uint8_t *buf;
+	u32 env_size;
 	int bytes;
 	int err;
 
-	dev_size = nvmem_dev_size(nvmem);
+	dev_size = device_property_read_u32(dev, "env-size", &env_size) ?
+		nvmem_dev_size(nvmem) : (size_t)env_size;
 
 	buf = kzalloc(dev_size, GFP_KERNEL);
 	if (!buf) {
Signature · 1 line
2.51.0
author maintainer
#6 lore raw

PATCH 5/8 dt-bindings: nvmem: mediatek: efuse: Add compatible for MT8189 SoC

In reply to [email protected]

From: Louis-Alexis Eyraud <[email protected]>

Add compatible string for the eFuse layout on MT8189 SoC, that is compatible with MT8186.

---
 Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml +3 -1
index 9d52caaf3e5c..c9bf34ee0efb 100644
@@ -25,7 +25,9 @@ properties:
   compatible:
     oneOf:
       - items:
-          - const: mediatek,mt8188-efuse
+          - enum:
+              - mediatek,mt8188-efuse
+              - mediatek,mt8189-efuse
           - const: mediatek,mt8186-efuse
       - const: mediatek,mt8186-efuse
 
Signature · 1 line
2.51.0
author maintainer
#7 lore raw

PATCH 6/8 dt-bindings: nvmem: don't check node names

In reply to [email protected]

From: Wolfram Sang <[email protected]>

Node names are already and properly checked by the core schema. No need to do it again.

---
 Documentation/devicetree/bindings/nvmem/st,stm32-romem.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/nvmem/st,stm32-romem.yaml +1 -1
index 3b2aa605a551..ab4cdc4e3614 100644
@@ -31,7 +31,7 @@ properties:
     maxItems: 1
 
 patternProperties:
-  "^.*@[0-9a-f]+$":
+  "@[0-9a-f]+$":
     type: object
     $ref: layouts/fixed-cell.yaml
     unevaluatedProperties: false
Signature · 1 line
2.51.0
author maintainer
#8 lore raw

PATCH 7/8 dt-bindings: nvmem: imx-ocotp: Add support for i.MX94

In reply to [email protected]

From: Alice Guo <[email protected]>

Add the compatible string "fsl,imx94-ocotp" to the imx-ocotp device tree binding documentation to support the i.MX94.

---
 Documentation/devicetree/bindings/nvmem/imx-ocotp.yaml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/nvmem/imx-ocotp.yaml +3 -1
index b2cb76cf9053..a8076d0e2737 100644
@@ -14,7 +14,8 @@ maintainers:
 description: |
   This binding represents the on-chip eFuse OTP controller found on
   i.MX6Q/D, i.MX6DL/S, i.MX6SL, i.MX6SX, i.MX6UL, i.MX6ULL/ULZ, i.MX6SLL,
-  i.MX7D/S, i.MX7ULP, i.MX8MQ, i.MX8MM, i.MX8MN i.MX8MP and i.MX93/5 SoCs.
+  i.MX7D/S, i.MX7ULP, i.MX8MQ, i.MX8MM, i.MX8MN i.MX8MP, i.MX93, i.MX94,
+  and i.MX95.
 
 allOf:
   - $ref: nvmem.yaml#
@@ -36,6 +37,7 @@ properties:
               - fsl,imx8mq-ocotp
               - fsl,imx8mm-ocotp
               - fsl,imx93-ocotp
+              - fsl,imx94-ocotp
               - fsl,imx95-ocotp
           - const: syscon
       - items:
Signature · 1 line
2.51.0
author maintainer
#9 lore raw

PATCH 8/8 nvmem: imx-ocotp-ele: Add i.MX94 OCOTP support

In reply to [email protected]

From: Alice Guo <[email protected]>

Add OCOTP device type for i.MX94, including register offset, total size, and fuse layout. This enables NVMEM access to the eFuse of i.MX94.

---
 drivers/nvmem/imx-ocotp-ele.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/nvmem/imx-ocotp-ele.c +20 -0
index 7807ec0e2d18..7cf7e809a8f5 100644
@@ -186,6 +186,25 @@ static const struct ocotp_devtype_data imx93_ocotp_data = {
 	},
 };
 
+static const struct ocotp_devtype_data imx94_ocotp_data = {
+	.reg_off = 0x8000,
+	.reg_read = imx_ocotp_reg_read,
+	.size = 3296, /* 103 Banks */
+	.num_entry = 10,
+	.entry = {
+		{ 0, 1, FUSE_FSB | FUSE_ECC },
+		{ 7, 1, FUSE_FSB | FUSE_ECC },
+		{ 9, 3, FUSE_FSB | FUSE_ECC },
+		{ 12, 24, FUSE_FSB },
+		{ 36, 2, FUSE_FSB  | FUSE_ECC },
+		{ 38, 14, FUSE_FSB },
+		{ 59, 1, FUSE_ELE },
+		{ 525, 2, FUSE_FSB | FUSE_ECC },
+		{ 528, 7, FUSE_FSB },
+		{ 536, 280, FUSE_FSB },
+	},
+};
+
 static const struct ocotp_devtype_data imx95_ocotp_data = {
 	.reg_off = 0x8000,
 	.reg_read = imx_ocotp_reg_read,
@@ -209,6 +228,7 @@ static const struct ocotp_devtype_data imx95_ocotp_data = {
 
 static const struct of_device_id imx_ele_ocotp_dt_ids[] = {
 	{ .compatible = "fsl,imx93-ocotp", .data = &imx93_ocotp_data, },
+	{ .compatible = "fsl,imx94-ocotp", .data = &imx94_ocotp_data, },
 	{ .compatible = "fsl,imx95-ocotp", .data = &imx95_ocotp_data, },
 	{},
 };
Signature · 1 line
2.51.0