Devicetree
 help / color / mirror / Atom feed
* [PATCH 0/3] Add read-only SpacemiT K3 eFuse support
@ 2026-11-06  6:05 Jiayu Du
  2026-11-06  6:05 ` [PATCH 1/3] dt-bindings: nvmem: Add SpacemiT K3 eFuse controller Jiayu Du
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Jiayu Du @ 2026-11-06  6:05 UTC (permalink / raw)
  To: srini
  Cc: robh, krzk+dt, conor+dt, dlan, troy.mitchell, pjw, palmer, aou,
	alex, p.zabel, devicetree, linux-riscv, spacemit, linux-kernel,
	Jiayu Du

This series adds read-only NVMEM access to bank 0 and bank 7 of the
SpacemiT K3 eFuse controller. These banks contain temperature calibration
parameters and other configuration data.

The driver reads the shadow registers of bank 0 and bank 7 once during
initialization and keeps a copy in memory. Later NVMEM reads return data
from this copy without accessing the registers again. Reads outside the
two bank ranges return zeros.

Tested on a SpacemiT K3 COM260 Kit by reading both banks through the
NVMEM sysfs interface. The data was unchanged across a reset and a full
power cycle. Reads crossing a bank boundary returned the expected bank
bytes and zeros in the keepout region.

Jiayu Du (3):
  dt-bindings: nvmem: Add SpacemiT K3 eFuse controller
  nvmem: Add read-only SpacemiT K3 eFuse support
  riscv: dts: spacemit: Add K3 eFuse and temperature trim cells

 .../bindings/nvmem/spacemit,k3-efuse.yaml     |  63 ++++++++
 MAINTAINERS                                   |   6 +
 arch/riscv/boot/dts/spacemit/k3.dtsi          |  25 +++
 drivers/nvmem/Kconfig                         |  14 ++
 drivers/nvmem/Makefile                        |   1 +
 drivers/nvmem/spacemit-k3-efuse.c             | 151 ++++++++++++++++++
 6 files changed, 260 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/nvmem/spacemit,k3-efuse.yaml
 create mode 100644 drivers/nvmem/spacemit-k3-efuse.c


base-commit: d6bcfc94eb4da6e089c5473970cd96727292fd97
-- 
2.43.0


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

* [PATCH 1/3] dt-bindings: nvmem: Add SpacemiT K3 eFuse controller
  2026-11-06  6:05 [PATCH 0/3] Add read-only SpacemiT K3 eFuse support Jiayu Du
@ 2026-11-06  6:05 ` Jiayu Du
  2026-11-06 17:37   ` Conor Dooley
  2026-11-06  6:05 ` [PATCH 2/3] nvmem: Add read-only SpacemiT K3 eFuse support Jiayu Du
  2026-11-06  6:05 ` [PATCH 3/3] riscv: dts: spacemit: Add K3 eFuse and temperature trim cells Jiayu Du
  2 siblings, 1 reply; 13+ messages in thread
From: Jiayu Du @ 2026-11-06  6:05 UTC (permalink / raw)
  To: srini
  Cc: robh, krzk+dt, conor+dt, dlan, troy.mitchell, pjw, palmer, aou,
	alex, p.zabel, devicetree, linux-riscv, spacemit, linux-kernel,
	Jiayu Du

Describe the SpacemiT K3 eFuse controller and its readable bank 0 and
bank 7 shadow windows, which contain temperature calibration parameters
and other configuration data.

Define the AES_WTM clock and reset, little-endian data and
controller-relative NVMEM offsets. Use fixed-layout cells for the
temperature calibration parameters.

Signed-off-by: Jiayu Du <duge1256@gmail.com>
---
 .../bindings/nvmem/spacemit,k3-efuse.yaml     | 63 +++++++++++++++++++
 MAINTAINERS                                   |  5 ++
 2 files changed, 68 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/nvmem/spacemit,k3-efuse.yaml

diff --git a/Documentation/devicetree/bindings/nvmem/spacemit,k3-efuse.yaml b/Documentation/devicetree/bindings/nvmem/spacemit,k3-efuse.yaml
new file mode 100644
index 000000000000..93f4301c8289
--- /dev/null
+++ b/Documentation/devicetree/bindings/nvmem/spacemit,k3-efuse.yaml
@@ -0,0 +1,63 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/nvmem/spacemit,k3-efuse.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: SpacemiT K3 eFuse controller
+
+maintainers:
+  - Jiayu Du <duge1256@gmail.com>
+
+description:
+  The K3 eFuse controller provides configuration and calibration data through
+  shadow registers. NVMEM uses little-endian data and controller-relative
+  offsets. Read access is limited to bank 0 (0x104-0x123) and bank 7 (0x190-0x1af).
+
+allOf:
+  - $ref: nvmem.yaml#
+
+properties:
+  compatible:
+    const: spacemit,k3-efuse
+
+  reg:
+    maxItems: 1
+    description: The 0x400-byte eFuse controller register block.
+
+  clocks:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - resets
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/spacemit,k3-clocks.h>
+    #include <dt-bindings/reset/spacemit,k3-resets.h>
+
+    efuse@f0702800 {
+        compatible = "spacemit,k3-efuse";
+        reg = <0xf0702800 0x400>;
+        clocks = <&syscon_apmu CLK_APMU_AES_WTM>;
+        resets = <&syscon_apmu RESET_APMU_AES_WTM>;
+
+        nvmem-layout {
+            compatible = "fixed-layout";
+            #address-cells = <1>;
+            #size-cells = <1>;
+
+            temperature-trim@19a {
+                reg = <0x19a 0x2>;
+                bits = <4 8>;
+            };
+        };
+    };
diff --git a/MAINTAINERS b/MAINTAINERS
index 46c416cadacd..0a9eb764ffee 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -26525,6 +26525,11 @@ S:	Maintained
 F:	Documentation/devicetree/bindings/sound/spacemit,k1-i2s.yaml
 F:	sound/soc/spacemit/k1_i2s.c
 
+SPACEMIT K3 EFUSE DRIVER
+M:	Jiayu Du <duge1256@gmail.com>
+S:	Maintained
+F:	Documentation/devicetree/bindings/nvmem/spacemit,k3-efuse.yaml
+
 SPACEMIT RESET CONTROLLER DRIVER
 M:	Guodong Xu <docular.xu@gmail.com>
 L:	linux-riscv@lists.infradead.org
-- 
2.43.0


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

* [PATCH 2/3] nvmem: Add read-only SpacemiT K3 eFuse support
  2026-11-06  6:05 [PATCH 0/3] Add read-only SpacemiT K3 eFuse support Jiayu Du
  2026-11-06  6:05 ` [PATCH 1/3] dt-bindings: nvmem: Add SpacemiT K3 eFuse controller Jiayu Du
@ 2026-11-06  6:05 ` Jiayu Du
  2026-11-06 12:15   ` Troy Mitchell
  2026-11-07  4:22   ` Yao Zi
  2026-11-06  6:05 ` [PATCH 3/3] riscv: dts: spacemit: Add K3 eFuse and temperature trim cells Jiayu Du
  2 siblings, 2 replies; 13+ messages in thread
From: Jiayu Du @ 2026-11-06  6:05 UTC (permalink / raw)
  To: srini
  Cc: robh, krzk+dt, conor+dt, dlan, troy.mitchell, pjw, palmer, aou,
	alex, p.zabel, devicetree, linux-riscv, spacemit, linux-kernel,
	Jiayu Du

Add read-only NVMEM access to bank 0 and bank 7 of the SpacemiT K3 eFuse
controller. These banks contain temperature calibration parameters and
other configuration data.

Snapshot the shadow registers with aligned 32-bit reads and expose the
data in little-endian order at controller-relative offsets. Serve reads
from the snapshot and use keepouts for the remaining register ranges.
Keep the AES_WTM clock enabled and its shared reset deasserted while the
provider is registered.

Signed-off-by: Jiayu Du <duge1256@gmail.com>
---
 MAINTAINERS                       |   1 +
 drivers/nvmem/Kconfig             |  14 +++
 drivers/nvmem/Makefile            |   1 +
 drivers/nvmem/spacemit-k3-efuse.c | 151 ++++++++++++++++++++++++++++++
 4 files changed, 167 insertions(+)
 create mode 100644 drivers/nvmem/spacemit-k3-efuse.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 0a9eb764ffee..e0af83ecee37 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -26529,6 +26529,7 @@ SPACEMIT K3 EFUSE DRIVER
 M:	Jiayu Du <duge1256@gmail.com>
 S:	Maintained
 F:	Documentation/devicetree/bindings/nvmem/spacemit,k3-efuse.yaml
+F:	drivers/nvmem/spacemit-k3-efuse.c
 
 SPACEMIT RESET CONTROLLER DRIVER
 M:	Guodong Xu <docular.xu@gmail.com>
diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig
index d2f5bb236663..28d6c59fbd74 100644
--- a/drivers/nvmem/Kconfig
+++ b/drivers/nvmem/Kconfig
@@ -476,6 +476,20 @@ config NVMEM_SNVS_LPGPR
 	  This driver can also be built as a module. If so, the module
 	  will be called nvmem-snvs-lpgpr.
 
+config NVMEM_SPACEMIT_K3_EFUSE
+	tristate "SpacemiT K3 eFuse support"
+	depends on ARCH_SPACEMIT || COMPILE_TEST
+	depends on OF && HAS_IOMEM
+	depends on COMMON_CLK && RESET_CONTROLLER
+	help
+	  Say Y here to read configuration and calibration data from the
+	  SpacemiT K3 eFuse shadow banks. The boot firmware must have loaded
+	  the shadow registers before Linux starts. Programming and reloading
+	  the fuses are not supported.
+
+	  This driver can also be built as a module. If so, the module will
+	  be called spacemit-k3-efuse.
+
 config NVMEM_SPMI_SDAM
 	tristate "SPMI SDAM Support"
 	depends on SPMI
diff --git a/drivers/nvmem/Makefile b/drivers/nvmem/Makefile
index 5e70bad9f0f9..d29716957faf 100644
--- a/drivers/nvmem/Makefile
+++ b/drivers/nvmem/Makefile
@@ -81,6 +81,7 @@ obj-$(CONFIG_NVMEM_SC27XX_EFUSE)	+= nvmem-sc27xx-efuse.o
 nvmem-sc27xx-efuse-y			:= sc27xx-efuse.o
 obj-$(CONFIG_NVMEM_SNVS_LPGPR)		+= nvmem_snvs_lpgpr.o
 nvmem_snvs_lpgpr-y			:= snvs_lpgpr.o
+obj-$(CONFIG_NVMEM_SPACEMIT_K3_EFUSE)	+= spacemit-k3-efuse.o
 obj-$(CONFIG_NVMEM_SPMI_SDAM)		+= nvmem_qcom-spmi-sdam.o
 nvmem_qcom-spmi-sdam-y			+= qcom-spmi-sdam.o
 obj-$(CONFIG_NVMEM_SPRD_EFUSE)		+= nvmem_sprd_efuse.o
diff --git a/drivers/nvmem/spacemit-k3-efuse.c b/drivers/nvmem/spacemit-k3-efuse.c
new file mode 100644
index 000000000000..d106053beae8
--- /dev/null
+++ b/drivers/nvmem/spacemit-k3-efuse.c
@@ -0,0 +1,151 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * SpacemiT K3 read-only eFuse driver
+ *
+ * Copyright (c) 2026 Spacemit Co. Ltd.
+ */
+
+#include <linux/array_size.h>
+#include <linux/clk.h>
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/errno.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/nvmem-provider.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/reset.h>
+#include <linux/slab.h>
+#include <linux/string.h>
+#include <linux/unaligned.h>
+
+#define K3_EFUSE_REG_SIZE		0x400
+#define K3_EFUSE_BANK_SIZE		0x20
+#define K3_EFUSE_BANK0_OFFSET	0x104
+#define K3_EFUSE_BANK7_OFFSET	0x190
+
+static const unsigned int k3_efuse_bank_offsets[] = {
+	K3_EFUSE_BANK0_OFFSET,
+	K3_EFUSE_BANK7_OFFSET,
+};
+
+static const struct nvmem_keepout k3_efuse_keepouts[] = {
+	{
+		.start = 0,
+		.end = K3_EFUSE_BANK0_OFFSET,
+	}, {
+		.start = K3_EFUSE_BANK0_OFFSET + K3_EFUSE_BANK_SIZE,
+		.end = K3_EFUSE_BANK7_OFFSET,
+	}, {
+		.start = K3_EFUSE_BANK7_OFFSET + K3_EFUSE_BANK_SIZE,
+		.end = K3_EFUSE_REG_SIZE,
+	},
+};
+
+struct k3_efuse {
+	u8 data[ARRAY_SIZE(k3_efuse_bank_offsets)][K3_EFUSE_BANK_SIZE];
+};
+
+static int k3_efuse_read(void *context, unsigned int offset, void *val,
+			 size_t bytes)
+{
+	struct k3_efuse *efuse = context;
+	unsigned int bank, index;
+
+	for (bank = 0; bank < ARRAY_SIZE(k3_efuse_bank_offsets); bank++) {
+		if (offset < k3_efuse_bank_offsets[bank])
+			continue;
+
+		index = offset - k3_efuse_bank_offsets[bank];
+		if (index >= K3_EFUSE_BANK_SIZE || bytes > K3_EFUSE_BANK_SIZE - index)
+			continue;
+
+		memcpy(val, efuse->data[bank] + index, bytes);
+		return 0;
+	}
+
+	return -EINVAL;
+}
+
+static int k3_efuse_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct nvmem_config config = {
+		.dev = dev,
+		.name = dev_name(dev),
+		.id = NVMEM_DEVID_NONE,
+		.owner = THIS_MODULE,
+		.type = NVMEM_TYPE_OTP,
+		.read_only = true,
+		.root_only = true,
+		.reg_read = k3_efuse_read,
+		.word_size = 1,
+		.stride = 1,
+		.size = K3_EFUSE_REG_SIZE,
+		.keepout = k3_efuse_keepouts,
+		.nkeepout = ARRAY_SIZE(k3_efuse_keepouts),
+	};
+	struct reset_control *reset;
+	struct nvmem_device *nvmem;
+	struct k3_efuse *efuse;
+	struct resource *res;
+	void __iomem *base;
+	struct clk *clk;
+	unsigned int bank, i;
+
+	base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
+	if (IS_ERR(base))
+		return PTR_ERR(base);
+
+	if (resource_size(res) != K3_EFUSE_REG_SIZE ||
+	    res->start % sizeof(u32))
+		return dev_err_probe(dev, -EINVAL, "Invalid register window\n");
+
+	efuse = devm_kzalloc(dev, sizeof(*efuse), GFP_KERNEL);
+	if (!efuse)
+		return -ENOMEM;
+
+	clk = devm_clk_get_enabled(dev, NULL);
+	if (IS_ERR(clk))
+		return dev_err_probe(dev, PTR_ERR(clk), "Failed to enable clock\n");
+
+	reset = devm_reset_control_get_shared_deasserted(dev, NULL);
+	if (IS_ERR(reset))
+		return dev_err_probe(dev, PTR_ERR(reset), "Failed to deassert reset\n");
+
+	for (bank = 0; bank < ARRAY_SIZE(k3_efuse_bank_offsets); bank++) {
+		for (i = 0; i < K3_EFUSE_BANK_SIZE; i += sizeof(u32)) {
+			u32 val = readl(base + k3_efuse_bank_offsets[bank] + i);
+
+			put_unaligned_le32(val, efuse->data[bank] + i);
+		}
+	}
+
+	config.priv = efuse;
+
+	nvmem = devm_nvmem_register(dev, &config);
+	if (IS_ERR(nvmem))
+		return dev_err_probe(dev, PTR_ERR(nvmem), "Failed to register NVMEM\n");
+
+	return 0;
+}
+
+static const struct of_device_id k3_efuse_of_match[] = {
+	{ .compatible = "spacemit,k3-efuse" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, k3_efuse_of_match);
+
+static struct platform_driver k3_efuse_driver = {
+	.probe = k3_efuse_probe,
+	.driver = {
+		.name = "spacemit-k3-efuse",
+		.of_match_table = k3_efuse_of_match,
+	},
+};
+module_platform_driver(k3_efuse_driver);
+
+MODULE_AUTHOR("Jiayu Du <duge1256@gmail.com>");
+MODULE_DESCRIPTION("SpacemiT K3 read-only eFuse driver");
+MODULE_LICENSE("GPL");
-- 
2.43.0


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

* [PATCH 3/3] riscv: dts: spacemit: Add K3 eFuse and temperature trim cells
  2026-11-06  6:05 [PATCH 0/3] Add read-only SpacemiT K3 eFuse support Jiayu Du
  2026-11-06  6:05 ` [PATCH 1/3] dt-bindings: nvmem: Add SpacemiT K3 eFuse controller Jiayu Du
  2026-11-06  6:05 ` [PATCH 2/3] nvmem: Add read-only SpacemiT K3 eFuse support Jiayu Du
@ 2026-11-06  6:05 ` Jiayu Du
  2026-11-06 22:13   ` Aurelien Jarno
  2 siblings, 1 reply; 13+ messages in thread
From: Jiayu Du @ 2026-11-06  6:05 UTC (permalink / raw)
  To: srini
  Cc: robh, krzk+dt, conor+dt, dlan, troy.mitchell, pjw, palmer, aou,
	alex, p.zabel, devicetree, linux-riscv, spacemit, linux-kernel,
	Jiayu Du

Add the K3 eFuse controller with its AES_WTM clock and reset. Describe
fixed-layout cells for the temperature calibration parameters stored in
bank 0 and bank 7, using controller-relative offsets.

Leave the controller disabled for board-level enablement.

Signed-off-by: Jiayu Du <duge1256@gmail.com>
---
 arch/riscv/boot/dts/spacemit/k3.dtsi | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/arch/riscv/boot/dts/spacemit/k3.dtsi b/arch/riscv/boot/dts/spacemit/k3.dtsi
index e89d2cc5ca8c..51861fdc6a21 100644
--- a/arch/riscv/boot/dts/spacemit/k3.dtsi
+++ b/arch/riscv/boot/dts/spacemit/k3.dtsi
@@ -1439,6 +1439,31 @@ saplic: interrupt-controller@e0804000 {
 
 		/* sec_i2c3: 0xf0614000, not available from Linux */
 
+		efuse: efuse@f0702800 {
+			compatible = "spacemit,k3-efuse";
+			reg = <0x0 0xf0702800 0x0 0x400>;
+			clocks = <&syscon_apmu CLK_APMU_AES_WTM>;
+			resets = <&syscon_apmu RESET_APMU_AES_WTM>;
+
+			status = "disabled";
+
+			nvmem-layout {
+				compatible = "fixed-layout";
+				#address-cells = <1>;
+				#size-cells = <1>;
+
+				soc_rtemp_trim1: temperature-trim@120 {
+					reg = <0x120 0x1>;
+					bits = <0 8>;
+				};
+
+				soc_rtemp_trim: temperature-trim@19a {
+					reg = <0x19a 0x2>;
+					bits = <4 8>;
+				};
+			};
+		};
+
 		mimsic: interrupt-controller@f1000000 {
 			compatible = "spacemit,k3-imsics", "riscv,imsics";
 			reg = <0x0 0xf1000000 0x0 0x10000>;
-- 
2.43.0


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

* Re: [PATCH 2/3] nvmem: Add read-only SpacemiT K3 eFuse support
  2026-11-06  6:05 ` [PATCH 2/3] nvmem: Add read-only SpacemiT K3 eFuse support Jiayu Du
@ 2026-11-06 12:15   ` Troy Mitchell
  2026-11-13 13:49     ` Jiayu Du
  2026-11-07  4:22   ` Yao Zi
  1 sibling, 1 reply; 13+ messages in thread
From: Troy Mitchell @ 2026-11-06 12:15 UTC (permalink / raw)
  To: Jiayu Du
  Cc: srini, robh, krzk+dt, conor+dt, dlan, troy.mitchell, pjw, palmer,
	aou, alex, p.zabel, devicetree, linux-riscv, spacemit,
	linux-kernel, Jiayu Du

[-- Attachment #1: Type: text/plain, Size: 2355 bytes --]

On Fri, 6 Nov 2026 14:05:24 +0800, Jiayu Du wrote:
> Add read-only NVMEM access to bank 0 and bank 7 of the SpacemiT K3
> eFuse controller. These banks contain temperature calibration
> parameters and other configuration data.
The rest of the window holds the root key and the SSK, which is why
only these two banks are exposed. Please say so here and in a comment
above k3_efuse_keepouts.

> Snapshot the shadow registers with aligned 32-bit reads and expose the
> data in little-endian order at controller-relative offsets. Serve
> reads from the snapshot and use keepouts for the remaining register
> ranges. Keep the AES_WTM clock enabled and its shared reset deasserted
> while the provider is registered.
Why keep the clock on? Reads are served from the snapshot and nothing
touches the hardware after probe.

Tested on CoM260:
- clock on only around the snapshot: probe and unbind/bind work, the
  clock stays off (AES_CLK_RES_CTRL 0x00c30050), same bank 0/7 data.
- this patch: unbind gates the clock and asserts the reset
  (0x00c30070 -> 0x00c30040), rebind reads the same data.
- this patch: 3s of WTM_RST or of clock gating leaves the shadow
  values and FUSE_READY unchanged.

[...]
>
> +	depends on COMMON_CLK && RESET_CONTROLLER
Not needed, both APIs have stubs.

[...]
>
> +#define K3_EFUSE_REG_SIZE		0x400
> +#define K3_EFUSE_BANK_SIZE		0x20
> +#define K3_EFUSE_BANK0_OFFSET	0x104
> +#define K3_EFUSE_BANK7_OFFSET	0x190
Nit: the last two are not aligned with the others.

[...]
>
> +	if (resource_size(res) != K3_EFUSE_REG_SIZE ||
> +	    res->start % sizeof(u32))
No need to validate DT here. Drop it and use
devm_platform_ioremap_resource().

[...]
>
> +	reset = devm_reset_control_get_shared_deasserted(dev, NULL);
This asserts the reset on unbind, rmmod and probe failure. The fuse
data survives, but WTM_RST resets the whole GEU (FUSE_SCLK_DIV_CNTR
went back to its boot value). The driver does not need the block after
the snapshot, so use devm_reset_control_get_shared() and only
deassert it.

[...]
>
> +		for (i = 0; i < K3_EFUSE_BANK_SIZE; i += sizeof(u32)) {
[...]
> +			put_unaligned_le32(val, efuse->data[bank] + i);
Please poll FUSE_READY (GEU_FUSE_STATUS bit 1, offset 0x184) before
taking the snapshot, and fail the probe if it never sets.

-- 
Troy Mitchell

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]

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

* Re: [PATCH 1/3] dt-bindings: nvmem: Add SpacemiT K3 eFuse controller
  2026-11-06  6:05 ` [PATCH 1/3] dt-bindings: nvmem: Add SpacemiT K3 eFuse controller Jiayu Du
@ 2026-11-06 17:37   ` Conor Dooley
  0 siblings, 0 replies; 13+ messages in thread
From: Conor Dooley @ 2026-11-06 17:37 UTC (permalink / raw)
  To: Jiayu Du
  Cc: srini, robh, krzk+dt, conor+dt, dlan, troy.mitchell, pjw, palmer,
	aou, alex, p.zabel, devicetree, linux-riscv, spacemit,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 75 bytes --]

Acked-by: Conor Dooley <conor.dooley@microchip.com>
pw-bot: not-applicable

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH 3/3] riscv: dts: spacemit: Add K3 eFuse and temperature trim cells
  2026-11-06  6:05 ` [PATCH 3/3] riscv: dts: spacemit: Add K3 eFuse and temperature trim cells Jiayu Du
@ 2026-11-06 22:13   ` Aurelien Jarno
  2026-11-13 12:24     ` Jiayu Du
  0 siblings, 1 reply; 13+ messages in thread
From: Aurelien Jarno @ 2026-11-06 22:13 UTC (permalink / raw)
  To: Jiayu Du
  Cc: srini, robh, krzk+dt, conor+dt, dlan, troy.mitchell, pjw, palmer,
	aou, alex, p.zabel, devicetree, linux-riscv, spacemit,
	linux-kernel

Hi,

On 2026-11-06 14:05, Jiayu Du wrote:
> Add the K3 eFuse controller with its AES_WTM clock and reset. Describe
> fixed-layout cells for the temperature calibration parameters stored in
> bank 0 and bank 7, using controller-relative offsets.
> 
> Leave the controller disabled for board-level enablement.

What is the reason for enabling it at the board-level? AFAIU, this is 
part of the SoC and does not require any board level hardware. Therefore 
I believe it should just be enabled by default.

> Signed-off-by: Jiayu Du <duge1256@gmail.com>
> ---
>  arch/riscv/boot/dts/spacemit/k3.dtsi | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/arch/riscv/boot/dts/spacemit/k3.dtsi b/arch/riscv/boot/dts/spacemit/k3.dtsi
> index e89d2cc5ca8c..51861fdc6a21 100644
> --- a/arch/riscv/boot/dts/spacemit/k3.dtsi
> +++ b/arch/riscv/boot/dts/spacemit/k3.dtsi
> @@ -1439,6 +1439,31 @@ saplic: interrupt-controller@e0804000 {
>  
>  		/* sec_i2c3: 0xf0614000, not available from Linux */
>  
> +		efuse: efuse@f0702800 {
> +			compatible = "spacemit,k3-efuse";
> +			reg = <0x0 0xf0702800 0x0 0x400>;
> +			clocks = <&syscon_apmu CLK_APMU_AES_WTM>;
> +			resets = <&syscon_apmu RESET_APMU_AES_WTM>;
> +
> +			status = "disabled";
> +
> +			nvmem-layout {
> +				compatible = "fixed-layout";
> +				#address-cells = <1>;
> +				#size-cells = <1>;
> +
> +				soc_rtemp_trim1: temperature-trim@120 {
> +					reg = <0x120 0x1>;
> +					bits = <0 8>;
> +				};
> +
> +				soc_rtemp_trim: temperature-trim@19a {
> +					reg = <0x19a 0x2>;
> +					bits = <4 8>;
> +				};

I have tried this patchset, and while I can see non-zero data in the 
/sys/bus/nvmem/devices/f0702800.efuse, both temperature calibration data 
appear as 0. Is that expected?

Regards
Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                     http://aurel32.net

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

* Re: [PATCH 2/3] nvmem: Add read-only SpacemiT K3 eFuse support
  2026-11-06  6:05 ` [PATCH 2/3] nvmem: Add read-only SpacemiT K3 eFuse support Jiayu Du
  2026-11-06 12:15   ` Troy Mitchell
@ 2026-11-07  4:22   ` Yao Zi
  2026-11-09 15:19     ` Troy Mitchell
  2026-11-13 13:13     ` Jiayu Du
  1 sibling, 2 replies; 13+ messages in thread
From: Yao Zi @ 2026-11-07  4:22 UTC (permalink / raw)
  To: Jiayu Du, srini
  Cc: robh, krzk+dt, conor+dt, dlan, troy.mitchell, pjw, palmer, aou,
	alex, p.zabel, devicetree, linux-riscv, spacemit, linux-kernel,
	Yao Zi

On Fri, Nov 06, 2026 at 02:05:24PM +0800, Jiayu Du wrote:
> Add read-only NVMEM access to bank 0 and bank 7 of the SpacemiT K3 eFuse
> controller. These banks contain temperature calibration parameters and
> other configuration data.
> 
> Snapshot the shadow registers with aligned 32-bit reads and expose the
> data in little-endian order at controller-relative offsets. Serve reads
> from the snapshot and use keepouts for the remaining register ranges.
> Keep the AES_WTM clock enabled and its shared reset deasserted while the
> provider is registered.
> 
> Signed-off-by: Jiayu Du <duge1256@gmail.com>
> ---
>  MAINTAINERS                       |   1 +
>  drivers/nvmem/Kconfig             |  14 +++
>  drivers/nvmem/Makefile            |   1 +
>  drivers/nvmem/spacemit-k3-efuse.c | 151 ++++++++++++++++++++++++++++++
>  4 files changed, 167 insertions(+)
>  create mode 100644 drivers/nvmem/spacemit-k3-efuse.c

...

> diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig
> index d2f5bb236663..28d6c59fbd74 100644
> --- a/drivers/nvmem/Kconfig
> +++ b/drivers/nvmem/Kconfig
> @@ -476,6 +476,20 @@ config NVMEM_SNVS_LPGPR
>  	  This driver can also be built as a module. If so, the module
>  	  will be called nvmem-snvs-lpgpr.
>  
> +config NVMEM_SPACEMIT_K3_EFUSE
> +	tristate "SpacemiT K3 eFuse support"
> +	depends on ARCH_SPACEMIT || COMPILE_TEST
> +	depends on OF && HAS_IOMEM
> +	depends on COMMON_CLK && RESET_CONTROLLER
> +	help
> +	  Say Y here to read configuration and calibration data from the
> +	  SpacemiT K3 eFuse shadow banks. The boot firmware must have loaded
> +	  the shadow registers before Linux starts. Programming and reloading
> +	  the fuses are not supported.

I didn't read K3's TRM, but is there a reason to depend on the
bootloader to do so? We should depend on the state set up by bootloaders
as less as possible, I think.

> +	  This driver can also be built as a module. If so, the module will
> +	  be called spacemit-k3-efuse.
> +

...

> diff --git a/drivers/nvmem/spacemit-k3-efuse.c b/drivers/nvmem/spacemit-k3-efuse.c
> new file mode 100644
> index 000000000000..d106053beae8
> --- /dev/null
> +++ b/drivers/nvmem/spacemit-k3-efuse.c

...

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

...

> +	for (bank = 0; bank < ARRAY_SIZE(k3_efuse_bank_offsets); bank++) {
> +		for (i = 0; i < K3_EFUSE_BANK_SIZE; i += sizeof(u32)) {
> +			u32 val = readl(base + k3_efuse_bank_offsets[bank] + i);
> +
> +			put_unaligned_le32(val, efuse->data[bank] + i);

Does memcpy_fromio() works for the device? Otherwise, you could define
efuse->data as an array of u32 instead of u8, so it keeps aligned and
you could do a simple assignment here. Reading from efuse->data is
always ok since memcpy() is used.

> +		}
> +	}

Regards,
Yao Zi

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

* Re: [PATCH 2/3] nvmem: Add read-only SpacemiT K3 eFuse support
  2026-11-07  4:22   ` Yao Zi
@ 2026-11-09 15:19     ` Troy Mitchell
  2026-11-13 13:13     ` Jiayu Du
  1 sibling, 0 replies; 13+ messages in thread
From: Troy Mitchell @ 2026-11-09 15:19 UTC (permalink / raw)
  To: Yao Zi, Jiayu Du, srini
  Cc: robh, krzk+dt, conor+dt, dlan, troy.mitchell, pjw, palmer, aou,
	alex, p.zabel, devicetree, linux-riscv, spacemit, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2129 bytes --]

On Sat Nov 7, 2026 at 4:22 AM GMT, Yao Zi wrote:
> On Fri, Nov 06, 2026 at 02:05:24PM +0800, Jiayu Du wrote:
>> Add read-only NVMEM access to bank 0 and bank 7 of the SpacemiT K3 eFuse
>> controller. These banks contain temperature calibration parameters and
>> other configuration data.
>> 
>> Snapshot the shadow registers with aligned 32-bit reads and expose the
>> data in little-endian order at controller-relative offsets. Serve reads
>> from the snapshot and use keepouts for the remaining register ranges.
>> Keep the AES_WTM clock enabled and its shared reset deasserted while the
>> provider is registered.
>> 
>> Signed-off-by: Jiayu Du <duge1256@gmail.com>
>> ---
>>  MAINTAINERS                       |   1 +
>>  drivers/nvmem/Kconfig             |  14 +++
>>  drivers/nvmem/Makefile            |   1 +
>>  drivers/nvmem/spacemit-k3-efuse.c | 151 ++++++++++++++++++++++++++++++
>>  4 files changed, 167 insertions(+)
>>  create mode 100644 drivers/nvmem/spacemit-k3-efuse.c
>
> ...
>
>> diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig
>> index d2f5bb236663..28d6c59fbd74 100644
>> --- a/drivers/nvmem/Kconfig
>> +++ b/drivers/nvmem/Kconfig
>> @@ -476,6 +476,20 @@ config NVMEM_SNVS_LPGPR
>>  	  This driver can also be built as a module. If so, the module
>>  	  will be called nvmem-snvs-lpgpr.
>>  
>> +config NVMEM_SPACEMIT_K3_EFUSE
>> +	tristate "SpacemiT K3 eFuse support"
>> +	depends on ARCH_SPACEMIT || COMPILE_TEST
>> +	depends on OF && HAS_IOMEM
>> +	depends on COMMON_CLK && RESET_CONTROLLER
>> +	help
>> +	  Say Y here to read configuration and calibration data from the
>> +	  SpacemiT K3 eFuse shadow banks. The boot firmware must have loaded
>> +	  the shadow registers before Linux starts. Programming and reloading
>> +	  the fuses are not supported.
>
> I didn't read K3's TRM, but is there a reason to depend on the
> bootloader to do so? We should depend on the state set up by bootloaders
> as less as possible, I think.
The GEU hardware loads the shadow after reset. So YES, we don't need to
rely on bootloader.

-- 
Troy Mitchell


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]

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

* Re: [PATCH 3/3] riscv: dts: spacemit: Add K3 eFuse and temperature trim cells
  2026-11-06 22:13   ` Aurelien Jarno
@ 2026-11-13 12:24     ` Jiayu Du
  2026-11-17 21:23       ` Aurelien Jarno
  0 siblings, 1 reply; 13+ messages in thread
From: Jiayu Du @ 2026-11-13 12:24 UTC (permalink / raw)
  To: Aurelien Jarno
  Cc: srini, robh, krzk+dt, conor+dt, dlan, troy.mitchell, pjw, palmer,
	aou, alex, p.zabel, devicetree, linux-riscv, spacemit,
	linux-kernel

On Fri, Nov 06, 2026 at 11:13:10PM +0100, Aurelien Jarno wrote:
> Hi,
> 
> On 2026-11-06 14:05, Jiayu Du wrote:
> > Add the K3 eFuse controller with its AES_WTM clock and reset. Describe
> > fixed-layout cells for the temperature calibration parameters stored in
> > bank 0 and bank 7, using controller-relative offsets.
> > 
> > Leave the controller disabled for board-level enablement.
> 
> What is the reason for enabling it at the board-level? AFAIU, this is 
> part of the SoC and does not require any board level hardware. Therefore 
> I believe it should just be enabled by default.

Agreed, there is no board-specific dependency. I'll fix it.

> 
> > Signed-off-by: Jiayu Du <duge1256@gmail.com>
> > ---
> >  arch/riscv/boot/dts/spacemit/k3.dtsi | 25 +++++++++++++++++++++++++
> >  1 file changed, 25 insertions(+)

...

> > +				#size-cells = <1>;
> > +
> > +				soc_rtemp_trim1: temperature-trim@120 {
> > +					reg = <0x120 0x1>;
> > +					bits = <0 8>;
> > +				};
> > +
> > +				soc_rtemp_trim: temperature-trim@19a {
> > +					reg = <0x19a 0x2>;
> > +					bits = <4 8>;
> > +				};
> 
> I have tried this patchset, and while I can see non-zero data in the 
> /sys/bus/nvmem/devices/f0702800.efuse, both temperature calibration data 
> appear as 0. Is that expected?

I see the same on my COM260 Kit: both banks contain non-zero data, but
the two trim fields are zero. The factory 6.18.3 kernel gives the same
bank data and temperature calibration data. 

The thermal driver change in [1] reads the bank 7 trim first, tries bank
0 if it is below 8, and uses 0xd8 if both values are below 8. This handles
the zero-value case. I don't have an explanation for the zero trim values
themselves.

[1] https://git.openruyi.cn/OERV-BSP/kernel-spacemit-k3/commit/334d70cf990d4e9a9899bdfb758e47732ba5d519

Regards,
Jiayu Du

> 
> -- 
> Aurelien Jarno                          GPG: 4096R/1DDD8C9B
> aurelien@aurel32.net                     http://aurel32.net

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

* Re: [PATCH 2/3] nvmem: Add read-only SpacemiT K3 eFuse support
  2026-11-07  4:22   ` Yao Zi
  2026-11-09 15:19     ` Troy Mitchell
@ 2026-11-13 13:13     ` Jiayu Du
  1 sibling, 0 replies; 13+ messages in thread
From: Jiayu Du @ 2026-11-13 13:13 UTC (permalink / raw)
  To: Yao Zi
  Cc: srini, robh, krzk+dt, conor+dt, dlan, troy.mitchell, pjw, palmer,
	aou, alex, p.zabel, devicetree, linux-riscv, spacemit,
	linux-kernel

On Sat, Nov 07, 2026 at 04:22:32AM +0000, Yao Zi wrote:
> On Fri, Nov 06, 2026 at 02:05:24PM +0800, Jiayu Du wrote:
> > Add read-only NVMEM access to bank 0 and bank 7 of the SpacemiT K3 eFuse
> > controller. These banks contain temperature calibration parameters and
> > other configuration data.
> > 
> > Snapshot the shadow registers with aligned 32-bit reads and expose the
> > data in little-endian order at controller-relative offsets. Serve reads
> > from the snapshot and use keepouts for the remaining register ranges.
> > Keep the AES_WTM clock enabled and its shared reset deasserted while the
> > provider is registered.
> > 
> > Signed-off-by: Jiayu Du <duge1256@gmail.com>
> > ---
> >  MAINTAINERS                       |   1 +
> >  drivers/nvmem/Kconfig             |  14 +++
> >  drivers/nvmem/Makefile            |   1 +
> >  drivers/nvmem/spacemit-k3-efuse.c | 151 ++++++++++++++++++++++++++++++
> >  4 files changed, 167 insertions(+)
> >  create mode 100644 drivers/nvmem/spacemit-k3-efuse.c
> 
> ...
> 
> > diff --git a/drivers/nvmem/Kconfig b/drivers/nvmem/Kconfig
> > index d2f5bb236663..28d6c59fbd74 100644
> > --- a/drivers/nvmem/Kconfig
> > +++ b/drivers/nvmem/Kconfig
> > @@ -476,6 +476,20 @@ config NVMEM_SNVS_LPGPR
> >  	  This driver can also be built as a module. If so, the module
> >  	  will be called nvmem-snvs-lpgpr.
> >  
> > +config NVMEM_SPACEMIT_K3_EFUSE
> > +	tristate "SpacemiT K3 eFuse support"
> > +	depends on ARCH_SPACEMIT || COMPILE_TEST
> > +	depends on OF && HAS_IOMEM
> > +	depends on COMMON_CLK && RESET_CONTROLLER
> > +	help
> > +	  Say Y here to read configuration and calibration data from the
> > +	  SpacemiT K3 eFuse shadow banks. The boot firmware must have loaded
> > +	  the shadow registers before Linux starts. Programming and reloading
> > +	  the fuses are not supported.
> 
> I didn't read K3's TRM, but is there a reason to depend on the
> bootloader to do so? We should depend on the state set up by bootloaders
> as less as possible, I think.

The Kconfig wording was incorrect: GEU loads the shadow registers in
hardware when it leaves reset. I will remove that requirement from the
help text. For the READY check requested by Troy, I will also trigger a
software reload in probe, since READY is only set after a software reload.


> > +	  This driver can also be built as a module. If so, the module will
> > +	  be called spacemit-k3-efuse.
> > +
> 
> ...
> 
> > diff --git a/drivers/nvmem/spacemit-k3-efuse.c b/drivers/nvmem/spacemit-k3-efuse.c
> > new file mode 100644
> > index 000000000000..d106053beae8
> > --- /dev/null
> > +++ b/drivers/nvmem/spacemit-k3-efuse.c
> 
> ...
> 
> > +static int k3_efuse_probe(struct platform_device *pdev)
> > +{
> 
> ...
> 
> > +	for (bank = 0; bank < ARRAY_SIZE(k3_efuse_bank_offsets); bank++) {
> > +		for (i = 0; i < K3_EFUSE_BANK_SIZE; i += sizeof(u32)) {
> > +			u32 val = readl(base + k3_efuse_bank_offsets[bank] + i);
> > +
> > +			put_unaligned_le32(val, efuse->data[bank] + i);
> 
> Does memcpy_fromio() works for the device? Otherwise, you could define
> efuse->data as an array of u32 instead of u8, so it keeps aligned and
> you could do a simple assignment here. Reading from efuse->data is
> always ok since memcpy() is used.

I will use your aligned-array alternative to preserve 32-bit MMIO reads.
The cache will be an __le32 array filled with cpu_to_le32(readl(...));
the read callback will keep using memcpy() with byte offsets.

Best regards,
Jiayu Du

> 
> > +		}
> > +	}
> 
> Regards,
> Yao Zi

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

* Re: [PATCH 2/3] nvmem: Add read-only SpacemiT K3 eFuse support
  2026-11-06 12:15   ` Troy Mitchell
@ 2026-11-13 13:49     ` Jiayu Du
  0 siblings, 0 replies; 13+ messages in thread
From: Jiayu Du @ 2026-11-13 13:49 UTC (permalink / raw)
  To: Troy Mitchell
  Cc: srini, robh, krzk+dt, conor+dt, dlan, pjw, palmer, aou, alex,
	p.zabel, devicetree, linux-riscv, spacemit, linux-kernel

On Fri, Nov 06, 2026 at 12:15:54PM +0000, Troy Mitchell wrote:
> On Fri, 6 Nov 2026 14:05:24 +0800, Jiayu Du wrote:
> > Add read-only NVMEM access to bank 0 and bank 7 of the SpacemiT K3
> > eFuse controller. These banks contain temperature calibration
> > parameters and other configuration data.
> The rest of the window holds the root key and the SSK, which is why
> only these two banks are exposed. Please say so here and in a comment
> above k3_efuse_keepouts.

I will add this explanation to the commit message and above
k3_efuse_keepouts.

> 
> > Snapshot the shadow registers with aligned 32-bit reads and expose the
> > data in little-endian order at controller-relative offsets. Serve
> > reads from the snapshot and use keepouts for the remaining register
> > ranges. Keep the AES_WTM clock enabled and its shared reset deasserted
> > while the provider is registered.
> Why keep the clock on? Reads are served from the snapshot and nothing
> touches the hardware after probe.
> 
> Tested on CoM260:
> - clock on only around the snapshot: probe and unbind/bind work, the
>   clock stays off (AES_CLK_RES_CTRL 0x00c30050), same bank 0/7 data.
> - this patch: unbind gates the clock and asserts the reset
>   (0x00c30070 -> 0x00c30040), rebind reads the same data.
> - this patch: 3s of WTM_RST or of clock gating leaves the shadow
>   values and FUSE_READY unchanged.

I will disable the clock after taking the snapshot, before registering
NVMEM. It only needs to be enabled while accessing the hardware in probe.

> 
> [...]
> >
> > +	depends on COMMON_CLK && RESET_CONTROLLER
> Not needed, both APIs have stubs.

I will remove these dependencies.

> 
> [...]
> >
> > +#define K3_EFUSE_REG_SIZE		0x400
> > +#define K3_EFUSE_BANK_SIZE		0x20
> > +#define K3_EFUSE_BANK0_OFFSET	0x104
> > +#define K3_EFUSE_BANK7_OFFSET	0x190
> Nit: the last two are not aligned with the others.

I will align them with the other definitions.

> 
> [...]
> >
> > +	if (resource_size(res) != K3_EFUSE_REG_SIZE ||
> > +	    res->start % sizeof(u32))
> No need to validate DT here. Drop it and use
> devm_platform_ioremap_resource().

I will drop the resource checks and use devm_platform_ioremap_resource().

> 
> [...]
> >
> > +	reset = devm_reset_control_get_shared_deasserted(dev, NULL);
> This asserts the reset on unbind, rmmod and probe failure. The fuse
> data survives, but WTM_RST resets the whole GEU (FUSE_SCLK_DIV_CNTR
> went back to its boot value). The driver does not need the block after
> the snapshot, so use devm_reset_control_get_shared() and only
> deassert it.

I will use devm_reset_control_get_shared() followed by an explicit
reset_control_deassert(), leaving the shared reset deasserted on teardown.

> 
> [...]
> >
> > +		for (i = 0; i < K3_EFUSE_BANK_SIZE; i += sizeof(u32)) {
> [...]
> > +			put_unaligned_le32(val, efuse->data[bank] + i);
> Please poll FUSE_READY (GEU_FUSE_STATUS bit 1, offset 0x184) before
> taking the snapshot, and fail the probe if it never sets.

As you clarified, the automatic shadow load at power-on does not set
FUSE_READY; it is only set after a software-triggered reload. I will
trigger a reload through GEU_CONFIG bit 22 before polling READY, and
fail probe if the poll times out.

I tested this sequence on my COM260 Kit: probe succeeds and both banks
match the data read with v1.

Thanks,
Jiayu Du



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

* Re: [PATCH 3/3] riscv: dts: spacemit: Add K3 eFuse and temperature trim cells
  2026-11-13 12:24     ` Jiayu Du
@ 2026-11-17 21:23       ` Aurelien Jarno
  0 siblings, 0 replies; 13+ messages in thread
From: Aurelien Jarno @ 2026-11-17 21:23 UTC (permalink / raw)
  To: Jiayu Du
  Cc: srini, robh, krzk+dt, conor+dt, dlan, troy.mitchell, pjw, palmer,
	aou, alex, p.zabel, devicetree, linux-riscv, spacemit,
	linux-kernel

Hi,

On 2026-11-13 20:24, Jiayu Du wrote:
> On Fri, Nov 06, 2026 at 11:13:10PM +0100, Aurelien Jarno wrote:
> > Hi,
> > 
> > On 2026-11-06 14:05, Jiayu Du wrote:
> > > Add the K3 eFuse controller with its AES_WTM clock and reset. Describe
> > > fixed-layout cells for the temperature calibration parameters stored in
> > > bank 0 and bank 7, using controller-relative offsets.
> > > 
> > > Leave the controller disabled for board-level enablement.
> > 
> > What is the reason for enabling it at the board-level? AFAIU, this is 
> > part of the SoC and does not require any board level hardware. Therefore 
> > I believe it should just be enabled by default.
> 
> Agreed, there is no board-specific dependency. I'll fix it.
> 
> > 
> > > Signed-off-by: Jiayu Du <duge1256@gmail.com>
> > > ---
> > >  arch/riscv/boot/dts/spacemit/k3.dtsi | 25 +++++++++++++++++++++++++
> > >  1 file changed, 25 insertions(+)
> 
> ...
> 
> > > +				#size-cells = <1>;
> > > +
> > > +				soc_rtemp_trim1: temperature-trim@120 {
> > > +					reg = <0x120 0x1>;
> > > +					bits = <0 8>;
> > > +				};
> > > +
> > > +				soc_rtemp_trim: temperature-trim@19a {
> > > +					reg = <0x19a 0x2>;
> > > +					bits = <4 8>;
> > > +				};
> > 
> > I have tried this patchset, and while I can see non-zero data in the 
> > /sys/bus/nvmem/devices/f0702800.efuse, both temperature calibration data 
> > appear as 0. Is that expected?
> 
> I see the same on my COM260 Kit: both banks contain non-zero data, but
> the two trim fields are zero. The factory 6.18.3 kernel gives the same
> bank data and temperature calibration data. 
> 
> The thermal driver change in [1] reads the bank 7 trim first, tries bank
> 0 if it is below 8, and uses 0xd8 if both values are below 8. This handles
> the zero-value case. I don't have an explanation for the zero trim values
> themselves.

Thanks for the explanations, that make sense. I guess that first 
versions of the K3 were not temperature calibrated, so the value is 0.

Regards
Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                     http://aurel32.net

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

end of thread, other threads:[~2026-11-17 21:23 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-06  6:05 [PATCH 0/3] Add read-only SpacemiT K3 eFuse support Jiayu Du
2026-11-06  6:05 ` [PATCH 1/3] dt-bindings: nvmem: Add SpacemiT K3 eFuse controller Jiayu Du
2026-11-06 17:37   ` Conor Dooley
2026-11-06  6:05 ` [PATCH 2/3] nvmem: Add read-only SpacemiT K3 eFuse support Jiayu Du
2026-11-06 12:15   ` Troy Mitchell
2026-11-13 13:49     ` Jiayu Du
2026-11-07  4:22   ` Yao Zi
2026-11-09 15:19     ` Troy Mitchell
2026-11-13 13:13     ` Jiayu Du
2026-11-06  6:05 ` [PATCH 3/3] riscv: dts: spacemit: Add K3 eFuse and temperature trim cells Jiayu Du
2026-11-06 22:13   ` Aurelien Jarno
2026-11-13 12:24     ` Jiayu Du
2026-11-17 21:23       ` Aurelien Jarno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox