[PATCH v5 1/5] dt-bindings: nvmem: fixed-cell: Add Rockchip CPU ID
From: Alexey Charkov
Date: Wed Nov 25 2026 - 14:37:09 EST
Rockchip SoCs ship with a unique CPU ID programmed into their OTP memory,
and compatible bootloaders derive Ethernet MAC addresses from it, so that
boards with no dedicated storage for one still get a stable address.
Whether a board ends up with those addresses then depends on the
bootloader patching them into the device tree.
Describe the CPU ID cell with a compatible which also defines that
derivation for Ethernet controllers referencing the cell as their unique
ID, so that the addresses are available to anything which reads the
device tree, whatever the boot flow. Index the addresses by the
controller's "ethernetN" alias, which is how the bootloaders assign
them. Keep the compatible vendor-wide, as only the location of the CPU
ID differs between SoCs, and that is given by the reg property already.
Plain "mac-base" does not fit: the CPU ID is not a MAC address in either
of the formats it allows, and may require different processing vs. adding
an offset to the base.
Signed-off-by: Alexey Charkov <alchark@xxxxxxxxxxx>
---
.../bindings/nvmem/layouts/fixed-cell.yaml | 24 ++++++++++++++++++++++
.../bindings/nvmem/layouts/fixed-layout.yaml | 5 +++++
2 files changed, 29 insertions(+)
diff --git a/Documentation/devicetree/bindings/nvmem/layouts/fixed-cell.yaml b/Documentation/devicetree/bindings/nvmem/layouts/fixed-cell.yaml
index 38e3ad50ff4f..3acf306612ad 100644
--- a/Documentation/devicetree/bindings/nvmem/layouts/fixed-cell.yaml
+++ b/Documentation/devicetree/bindings/nvmem/layouts/fixed-cell.yaml
@@ -19,6 +19,17 @@ properties:
addresses.
It can be stored in a plain binary format (cell length 6) or as an
ASCII text like "00:11:22:33:44:55" (cell length 17).
+ - const: rockchip,cpuid
+ description: >
+ Cell with the unique CPU ID of a Rockchip SoC (cell length 16).
+ An Ethernet controller referencing it as its "unique-id" NVMEM cell
+ derives its MAC address from it. The base of such addresses consists
+ of the first six octets of the SHA-256 digest of the 32-character
+ string of lowercase hexadecimal digits representing the 16 CPU ID
+ bytes in stored order, without separators or a terminator. In the
+ first octet, the multicast bit (bit 0) is then cleared and the
+ locally administered bit (bit 1) set. The number N of the
+ controller's "ethernetN" alias is XORed into the last octet.
reg:
maxItems: 1
@@ -48,6 +59,19 @@ allOf:
const: 1
required:
- "#nvmem-cell-cells"
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: rockchip,cpuid
+ required: [ compatible ]
+ then:
+ properties:
+ reg:
+ items:
+ - items:
+ - description: Offset of the CPU ID
+ - const: 16
required:
- reg
diff --git a/Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.yaml b/Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.yaml
index b01567f99284..a1935bb49282 100644
--- a/Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.yaml
+++ b/Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.yaml
@@ -56,6 +56,11 @@ examples:
#nvmem-cell-cells = <1>;
};
+ id@200 {
+ compatible = "rockchip,cpuid";
+ reg = <0x200 0x10>;
+ };
+
calibration@4000 {
reg = <0x4000 0x100>;
};
--
2.56.0