Skip to contentSkip to conversation

nvmem: aspeed: Add read-only AST2600 OTP support

PATCH New Prasanth Kumar Padarthi 1 participant 3 messages Nov 27

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v4 cover nvmem: aspeed: Add read-only AST2600 OTP support

Hi,

Expose permitted AST2600 OTP data through root-only, read-only NVMEM for BMC bring-up diagnostics comparing raw offsets with reference reads. The series also describes the SBC's NVMEM-provider role in its binding.

Changes since v3:
- Drop linux/mod_devicetable.h as requested by Uwe Kleine-Koenig; linux/platform_device.h already provides the required declaration.
- The binding patch is unchanged.

The previous v3 series passed ARM W=1 and B650D4U/A3 read validation on upstream-based 7.4-rc1: repeated reads, pair boundaries, 40 concurrent reads and comparison of a 12-byte range with a vendor-derived reference. These hardware results are from v3, before the include-only change.

For v4, ARM W=1 driver-object compilation passed. Strict checkpatch reported zero errors, warnings or checks for the binding patch, and zero errors/checks with one new-file/MAINTAINERS warning for the driver patch. The existing ASPEED MAINTAINERS matcher covers the driver.

Previous revision and review:
https://lore.kernel.org/all/[email protected]/

ASPEED hardware clarification:
https://lore.kernel.org/linux-aspeed/KL1PR0601MB3986A356BD06F98D0FF9AD5E80792@KL1PR0601MB3986.apcprd06.prod.outlook.com/

AI assistance was used for driver revisions, validation tooling and patch text. Hardware tests were run by the submitter.

Prasanth Kumar Padarthi (2):
dt-bindings: arm: aspeed: sbc: Describe OTP NVMEM provider
nvmem: aspeed: Add read-only AST2600 OTP support

base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4

#1 lore raw

PATCH v4 1/2 dt-bindings: arm: aspeed: sbc: Describe OTP NVMEM provider

The AST2600 secure boot controller also provides access to its OTP data region. Reference the NVMEM provider schema and use unevaluatedProperties so common NVMEM properties are accepted while unknown properties remain rejected. Cell offsets address OTP data rather than controller registers.

---
Validation: dt-doc-validate and the selected dt_binding_check target passed. The binding target used dtschema 2026.4 with a local diagnostic lookup fix for trailing # in schema IDs. No validation rules were disabled. Two unrelated TI type diagnostics remain; no SBC diagnostics were emitted. The valid example passed, and an unknown-property negative control failed as expected.

 .../devicetree/bindings/arm/aspeed/aspeed,sbc.yaml     | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/arm/aspeed/aspeed,sbc.yaml +8 -2
index b8c5cac..d8e19c2 100644
@@ -13,7 +13,12 @@ maintainers:
 
 description: |
   The ASPEED SoCs have a register bank for interacting with the secure boot
-  controller.
+  controller. The controller also provides access to the OTP data region
+  through NVMEM. NVMEM cell offsets are byte offsets within the OTP data
+  region, not offsets within the controller register bank.
+
+allOf:
+  - $ref: /schemas/nvmem/nvmem.yaml#
 
 properties:
   compatible:
@@ -27,11 +32,12 @@ required:
   - compatible
   - reg
 
-additionalProperties: false
+unevaluatedProperties: false
 
 examples:
   - |
     sbc: secure-boot-controller@1e6f2000 {
             compatible = "aspeed,ast2600-sbc";
             reg = <0x1e6f2000 0x1000>;
+            read-only;
     };
Signature · 1 line
2.47.3
#2 lore raw

PATCH v4 2/2 nvmem: aspeed: Add read-only AST2600 OTP support

In reply to Prasanth Kumar Padarthi

AST2600's secure boot controller provides an 8-KiB OTP data region through paired-word commands rather than memory-mapped storage. Expose permitted words through NVMEM for privileged userspace bring-up diagnostics, which compare raw OTP offsets with reference reads; no named cells are required by this consumer.

Earlier firmware may leave the OTP macro in programming mode, so Linux must establish read mode before using it. Programming protection does not prevent reads, but the configured secure prefix and SEC54 restrict the readable region. SEC54 can increase until ARM reset, so a probe-time snapshot alone cannot describe every later read restriction.

SEC00 relocking does not cancel a running command. Since there is no documented safe retry after a timeout, stop issuing commands rather than risk overlapping an outstanding operation. Normal reads take less than 1 us; the 100-ms bound is deliberately generous, not a specified maximum.

The read sequence is adapted from ASPEED's downstream driver.

---
Changes since v3:
- Drop linux/mod_devicetable.h as requested by Uwe; platform_device.h already provides the required declaration.

v4 validation:
- ARM driver-object compilation with W=1 passed.
- Strict patch checkpatch: zero errors, zero checks, one new-file/ MAINTAINERS warning. The existing ASPEED matcher covers the driver.

Earlier v3 validation, before this include-only change:
Tested on ASRock Rack B650D4U (AST2600 A3), Linux 7.4-rc1:
- ARM zImage build with W=1 completed.
- Repeated 12-byte reads and cross-pair/final-pair comparisons passed.
- Four concurrent readers completed 40 matching reads.
- Bytes 8172..8183 matched the saved ASPEED-derived reference fingerprint. The kernel was RAM-booted with the working OpenBMC DTB and initramfs.

Host-model checks passed 4096 protection combinations, 200 copying cases and 24 timeout cases, including unlock-failure cleanup. Strict source checkpatch passed. The existing ASPEED MAINTAINERS matcher covers the file.

 drivers/nvmem/Kconfig            |  13 ++
 drivers/nvmem/Makefile           |   1 +
 drivers/nvmem/nvmem-aspeed-otp.c | 298 +++++++++++++++++++++++++++++++
 3 files changed, 312 insertions(+)
 create mode 100644 drivers/nvmem/nvmem-aspeed-otp.c
drivers/nvmem/Kconfig +13 -0
index d2f5bb2..65f6a88 100644
@@ -164,6 +164,19 @@ config NVMEM_APPLE_SPMI
 	  This driver can also be built as a module. If so, the module
 	  will be called apple-nvmem-spmi.
 
+config NVMEM_ASPEED_OTP
+	tristate "ASPEED OTP support"
+	depends on ARCH_ASPEED || COMPILE_TEST
+	depends on HAS_IOMEM
+	help
+	  Say Y here to enable read-only access to the OTP data region
+	  on ASPEED AST2600 BMCs through the NVMEM interface.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called nvmem-aspeed-otp.
+
+	  If unsure, say N.
+
 config NVMEM_BCM_OCOTP
 	tristate "Broadcom On-Chip OTP Controller support"
 	depends on ARCH_BCM_IPROC || COMPILE_TEST
drivers/nvmem/Makefile +1 -0
index 5e70bad..ca62940 100644
@@ -23,6 +23,7 @@ obj-$(CONFIG_NVMEM_APPLE_EFUSES)	+= nvmem-apple-efuses.o
 nvmem-apple-efuses-y 			:= apple-efuses.o
 obj-$(CONFIG_NVMEM_APPLE_SPMI)		+= apple_nvmem_spmi.o
 apple_nvmem_spmi-y			:= apple-spmi-nvmem.o
+obj-$(CONFIG_NVMEM_ASPEED_OTP)	+= nvmem-aspeed-otp.o
 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
drivers/nvmem/nvmem-aspeed-otp.c new file +298 -0

298 lines not on this page · raw message

Signature · 1 line
2.47.3