All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] nvmem: patches for 6.19
@ 2025-11-14 11:06 srini
  2025-11-14 11:06 ` [PATCH 1/8] dt-bindings: nvmem: qfprom: Add sa8775p compatible srini
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: srini @ 2025-11-14 11:06 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, Srinivas Kandagatla

From: Srinivas Kandagatla <srini@kernel.org>

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

-- 
2.51.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/8] dt-bindings: nvmem: qfprom: Add sa8775p compatible
  2025-11-14 11:06 [PATCH 0/8] nvmem: patches for 6.19 srini
@ 2025-11-14 11:06 ` srini
  2025-11-14 11:06 ` [PATCH 2/8] dt-bindings: nvmem: Support MediaTek MT8189 evb board efuse srini
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: srini @ 2025-11-14 11:06 UTC (permalink / raw)
  To: gregkh
  Cc: linux-kernel, Akhil P Oommen, Krzysztof Kozlowski,
	Srinivas Kandagatla, Srinivas Kandagatla

From: Akhil P Oommen <akhilpo@oss.qualcomm.com>

Document compatible string for the QFPROM on Lemans platform.

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Acked-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
Signed-off-by: Akhil P Oommen <akhilpo@oss.qualcomm.com>
Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
---
 Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml b/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml
index 3f6dc6a3a9f1..7d1612acca48 100644
--- a/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml
+++ b/Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml
@@ -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
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/8] dt-bindings: nvmem: Support MediaTek MT8189 evb board efuse
  2025-11-14 11:06 [PATCH 0/8] nvmem: patches for 6.19 srini
  2025-11-14 11:06 ` [PATCH 1/8] dt-bindings: nvmem: qfprom: Add sa8775p compatible srini
@ 2025-11-14 11:06 ` srini
  2025-11-14 11:06 ` [PATCH 3/8] nvmem: Add driver for the eeprom in qnap-mcu controllers srini
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: srini @ 2025-11-14 11:06 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, Jack Hsu, Conor Dooley, Srinivas Kandagatla

From: Jack Hsu <jh.hsu@mediatek.com>

add compatible string for mt8189 evb board dts node of efuse

Signed-off-by: Jack Hsu <jh.hsu@mediatek.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
---
 Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml b/Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml
index 4dc0d42df3e6..9d52caaf3e5c 100644
--- a/Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml
+++ b/Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml
@@ -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
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/8] nvmem: Add driver for the eeprom in qnap-mcu controllers
  2025-11-14 11:06 [PATCH 0/8] nvmem: patches for 6.19 srini
  2025-11-14 11:06 ` [PATCH 1/8] dt-bindings: nvmem: qfprom: Add sa8775p compatible srini
  2025-11-14 11:06 ` [PATCH 2/8] dt-bindings: nvmem: Support MediaTek MT8189 evb board efuse srini
@ 2025-11-14 11:06 ` srini
  2025-11-26 13:42   ` Andy Shevchenko
  2025-11-14 11:06 ` [PATCH 4/8] nvmem: layouts: u-boot-env: add optional "env-size" property srini
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 10+ messages in thread
From: srini @ 2025-11-14 11:06 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, Heiko Stuebner, Srinivas Kandagatla

From: Heiko Stuebner <heiko@sntech.de>

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.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Srinivas Kandagatla <srini@kernel.org>
Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
---
 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

diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig
index e0d88d3199c1..bf47a982cf62 100644
--- a/drivers/nvmem/Kconfig
+++ b/drivers/nvmem/Kconfig
@@ -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
diff --git a/drivers/nvmem/Makefile b/drivers/nvmem/Makefile
index 70a4464dcb1e..7252b8ec88d4 100644
--- a/drivers/nvmem/Makefile
+++ b/drivers/nvmem/Makefile
@@ -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
diff --git a/drivers/nvmem/qnap-mcu-eeprom.c b/drivers/nvmem/qnap-mcu-eeprom.c
new file mode 100644
index 000000000000..0b919895b3b2
--- /dev/null
+++ b/drivers/nvmem/qnap-mcu-eeprom.c
@@ -0,0 +1,111 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * ee1004 - driver for DDR4 SPD EEPROMs
+ *
+ * Copyright (C) 2017-2019 Jean Delvare
+ *
+ * Based on the at24 driver:
+ * Copyright (C) 2005-2007 David Brownell
+ * Copyright (C) 2008 Wolfram Sang, Pengutronix
+ */
+
+#include <linux/mfd/qnap-mcu.h>
+#include <linux/module.h>
+#include <linux/nvmem-provider.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+
+/* Determined by trial and error until read anomalies appeared */
+#define QNAP_MCU_EEPROM_SIZE		256
+#define QNAP_MCU_EEPROM_BLOCK_SIZE	32
+
+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;
+
+	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;
+}
+
+static int qnap_mcu_eeprom_read(void *priv, unsigned int offset, void *val, size_t bytes)
+{
+	struct qnap_mcu *mcu = priv;
+	int pos = 0, ret;
+	u8 *buf = val;
+
+	if (unlikely(!bytes))
+		return 0;
+
+	while (bytes > 0) {
+		size_t to_read = (bytes > QNAP_MCU_EEPROM_BLOCK_SIZE) ?
+						QNAP_MCU_EEPROM_BLOCK_SIZE : bytes;
+
+		ret = qnap_mcu_eeprom_read_block(mcu, offset + pos, &buf[pos], to_read);
+		if (ret < 0)
+			return ret;
+
+		pos += to_read;
+		bytes -= to_read;
+	}
+
+	return 0;
+}
+
+static int qnap_mcu_eeprom_probe(struct platform_device *pdev)
+{
+	struct qnap_mcu *mcu = dev_get_drvdata(pdev->dev.parent);
+	struct nvmem_config nvcfg = {};
+	struct nvmem_device *ndev;
+
+	nvcfg.dev = &pdev->dev;
+	nvcfg.of_node = pdev->dev.parent->of_node;
+	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,
+	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;
+}
+
+static struct platform_driver qnap_mcu_eeprom_driver = {
+	.probe = qnap_mcu_eeprom_probe,
+	.driver = {
+		.name = "qnap-mcu-eeprom",
+	},
+};
+module_platform_driver(qnap_mcu_eeprom_driver);
+
+MODULE_AUTHOR("Heiko Stuebner <heiko@sntech.de>");
+MODULE_DESCRIPTION("QNAP MCU EEPROM driver");
+MODULE_LICENSE("GPL");
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/8] nvmem: layouts: u-boot-env: add optional "env-size" property
  2025-11-14 11:06 [PATCH 0/8] nvmem: patches for 6.19 srini
                   ` (2 preceding siblings ...)
  2025-11-14 11:06 ` [PATCH 3/8] nvmem: Add driver for the eeprom in qnap-mcu controllers srini
@ 2025-11-14 11:06 ` srini
  2025-11-14 11:06 ` [PATCH 5/8] dt-bindings: nvmem: mediatek: efuse: Add compatible for MT8189 SoC srini
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: srini @ 2025-11-14 11:06 UTC (permalink / raw)
  To: gregkh
  Cc: linux-kernel, Jascha Sundaresan, Rob Herring (Arm),
	Srinivas Kandagatla

From: Jascha Sundaresan <flizarthanon@gmail.com>

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

Signed-off-by: Jascha Sundaresan <flizarthanon@gmail.com>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
---
 .../devicetree/bindings/nvmem/layouts/u-boot,env.yaml      | 7 +++++++
 drivers/nvmem/layouts/u-boot-env.c                         | 4 +++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/nvmem/layouts/u-boot,env.yaml b/Documentation/devicetree/bindings/nvmem/layouts/u-boot,env.yaml
index 56a8f55d4a09..e9e75c38bd11 100644
--- a/Documentation/devicetree/bindings/nvmem/layouts/u-boot,env.yaml
+++ b/Documentation/devicetree/bindings/nvmem/layouts/u-boot,env.yaml
@@ -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 {
                 };
diff --git a/drivers/nvmem/layouts/u-boot-env.c b/drivers/nvmem/layouts/u-boot-env.c
index a27eeb08146f..ab32bf1291af 100644
--- a/drivers/nvmem/layouts/u-boot-env.c
+++ b/drivers/nvmem/layouts/u-boot-env.c
@@ -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) {
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 5/8] dt-bindings: nvmem: mediatek: efuse: Add compatible for MT8189 SoC
  2025-11-14 11:06 [PATCH 0/8] nvmem: patches for 6.19 srini
                   ` (3 preceding siblings ...)
  2025-11-14 11:06 ` [PATCH 4/8] nvmem: layouts: u-boot-env: add optional "env-size" property srini
@ 2025-11-14 11:06 ` srini
  2025-11-14 11:06 ` [PATCH 6/8] dt-bindings: nvmem: don't check node names srini
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: srini @ 2025-11-14 11:06 UTC (permalink / raw)
  To: gregkh
  Cc: linux-kernel, Louis-Alexis Eyraud, AngeloGioacchino Del Regno,
	Conor Dooley, Srinivas Kandagatla

From: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>

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

Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
---
 Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml b/Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml
index 9d52caaf3e5c..c9bf34ee0efb 100644
--- a/Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml
+++ b/Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml
@@ -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
 
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 6/8] dt-bindings: nvmem: don't check node names
  2025-11-14 11:06 [PATCH 0/8] nvmem: patches for 6.19 srini
                   ` (4 preceding siblings ...)
  2025-11-14 11:06 ` [PATCH 5/8] dt-bindings: nvmem: mediatek: efuse: Add compatible for MT8189 SoC srini
@ 2025-11-14 11:06 ` srini
  2025-11-14 11:06 ` [PATCH 7/8] dt-bindings: nvmem: imx-ocotp: Add support for i.MX94 srini
  2025-11-14 11:06 ` [PATCH 8/8] nvmem: imx-ocotp-ele: Add i.MX94 OCOTP support srini
  7 siblings, 0 replies; 10+ messages in thread
From: srini @ 2025-11-14 11:06 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, Wolfram Sang, Conor Dooley, Srinivas Kandagatla

From: Wolfram Sang <wsa+renesas@sang-engineering.com>

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

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
---
 Documentation/devicetree/bindings/nvmem/st,stm32-romem.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/nvmem/st,stm32-romem.yaml b/Documentation/devicetree/bindings/nvmem/st,stm32-romem.yaml
index 3b2aa605a551..ab4cdc4e3614 100644
--- a/Documentation/devicetree/bindings/nvmem/st,stm32-romem.yaml
+++ b/Documentation/devicetree/bindings/nvmem/st,stm32-romem.yaml
@@ -31,7 +31,7 @@ properties:
     maxItems: 1
 
 patternProperties:
-  "^.*@[0-9a-f]+$":
+  "@[0-9a-f]+$":
     type: object
     $ref: layouts/fixed-cell.yaml
     unevaluatedProperties: false
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 7/8] dt-bindings: nvmem: imx-ocotp: Add support for i.MX94
  2025-11-14 11:06 [PATCH 0/8] nvmem: patches for 6.19 srini
                   ` (5 preceding siblings ...)
  2025-11-14 11:06 ` [PATCH 6/8] dt-bindings: nvmem: don't check node names srini
@ 2025-11-14 11:06 ` srini
  2025-11-14 11:06 ` [PATCH 8/8] nvmem: imx-ocotp-ele: Add i.MX94 OCOTP support srini
  7 siblings, 0 replies; 10+ messages in thread
From: srini @ 2025-11-14 11:06 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, Alice Guo, Conor Dooley, Srinivas Kandagatla

From: Alice Guo <alice.guo@nxp.com>

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

Signed-off-by: Alice Guo <alice.guo@nxp.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
---
 Documentation/devicetree/bindings/nvmem/imx-ocotp.yaml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/nvmem/imx-ocotp.yaml b/Documentation/devicetree/bindings/nvmem/imx-ocotp.yaml
index b2cb76cf9053..a8076d0e2737 100644
--- a/Documentation/devicetree/bindings/nvmem/imx-ocotp.yaml
+++ b/Documentation/devicetree/bindings/nvmem/imx-ocotp.yaml
@@ -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:
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 8/8] nvmem: imx-ocotp-ele: Add i.MX94 OCOTP support
  2025-11-14 11:06 [PATCH 0/8] nvmem: patches for 6.19 srini
                   ` (6 preceding siblings ...)
  2025-11-14 11:06 ` [PATCH 7/8] dt-bindings: nvmem: imx-ocotp: Add support for i.MX94 srini
@ 2025-11-14 11:06 ` srini
  7 siblings, 0 replies; 10+ messages in thread
From: srini @ 2025-11-14 11:06 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, Alice Guo, Peng Fan, Frank Li, Srinivas Kandagatla

From: Alice Guo <alice.guo@nxp.com>

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.

Signed-off-by: Alice Guo <alice.guo@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
---
 drivers/nvmem/imx-ocotp-ele.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/nvmem/imx-ocotp-ele.c b/drivers/nvmem/imx-ocotp-ele.c
index 7807ec0e2d18..7cf7e809a8f5 100644
--- a/drivers/nvmem/imx-ocotp-ele.c
+++ b/drivers/nvmem/imx-ocotp-ele.c
@@ -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, },
 	{},
 };
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/8] nvmem: Add driver for the eeprom in qnap-mcu controllers
  2025-11-14 11:06 ` [PATCH 3/8] nvmem: Add driver for the eeprom in qnap-mcu controllers srini
@ 2025-11-26 13:42   ` Andy Shevchenko
  0 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2025-11-26 13:42 UTC (permalink / raw)
  To: srini; +Cc: gregkh, linux-kernel, Heiko Stuebner

On Fri, Nov 14, 2025 at 11:06:31AM +0000, srini@kernel.org 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

> +#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

...

> +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.

> +	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;
> +}

...

> +static int qnap_mcu_eeprom_probe(struct platform_device *pdev)
> +{

	struct device *parent = pdev->dev.parent;

> +	struct qnap_mcu *mcu = dev_get_drvdata(pdev->dev.parent);

	struct qnap_mcu *mcu = dev_get_drvdata(parent);

> +	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)

> +	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,
> +	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(...);

> +}

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-11-26 13:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-14 11:06 [PATCH 0/8] nvmem: patches for 6.19 srini
2025-11-14 11:06 ` [PATCH 1/8] dt-bindings: nvmem: qfprom: Add sa8775p compatible srini
2025-11-14 11:06 ` [PATCH 2/8] dt-bindings: nvmem: Support MediaTek MT8189 evb board efuse srini
2025-11-14 11:06 ` [PATCH 3/8] nvmem: Add driver for the eeprom in qnap-mcu controllers srini
2025-11-26 13:42   ` Andy Shevchenko
2025-11-14 11:06 ` [PATCH 4/8] nvmem: layouts: u-boot-env: add optional "env-size" property srini
2025-11-14 11:06 ` [PATCH 5/8] dt-bindings: nvmem: mediatek: efuse: Add compatible for MT8189 SoC srini
2025-11-14 11:06 ` [PATCH 6/8] dt-bindings: nvmem: don't check node names srini
2025-11-14 11:06 ` [PATCH 7/8] dt-bindings: nvmem: imx-ocotp: Add support for i.MX94 srini
2025-11-14 11:06 ` [PATCH 8/8] nvmem: imx-ocotp-ele: Add i.MX94 OCOTP support srini

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.