[PATCH v3 5/5] arm64: dts: rockchip: Derive GMAC MAC addresses from OTP on RK3576

From: Alexey Charkov

Date: Mon Nov 23 2026 - 10:36:12 EST


RK3576 boards without dedicated storage for a MAC address only get a
stable one if the bootloader derives it from the CPU ID and patches it
into the device tree, which not every boot flow does.

Mark the CPU ID cell as such and reference it from both GMACs, so that
the addresses can be derived from the device tree alone, whatever the
bootloader. Boards which store a MAC address of their own can override
the reference with a cell of their choosing.

Note that the GMACs then depend on the OTP memory being accessible, as
the thermal sensors already do for their trim values.

Signed-off-by: Alexey Charkov <alchark@xxxxxxxxxxx>
---
arch/arm64/boot/dts/rockchip/rk3576.dtsi | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3576.dtsi b/arch/arm64/boot/dts/rockchip/rk3576.dtsi
index 6f9fd73d24d6..1f9441394a8c 100644
--- a/arch/arm64/boot/dts/rockchip/rk3576.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3576.dtsi
@@ -2070,6 +2070,8 @@ gmac0: ethernet@2a220000 {
interrupts = <GIC_SPI 293 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 298 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "macirq", "eth_wake_irq";
+ nvmem-cells = <&otp_id 0>;
+ nvmem-cell-names = "mac-address";
power-domains = <&power RK3576_PD_SDGMAC>;
resets = <&cru SRST_A_GMAC0>;
reset-names = "stmmaceth";
@@ -2118,6 +2120,8 @@ gmac1: ethernet@2a230000 {
interrupts = <GIC_SPI 301 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 306 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "macirq", "eth_wake_irq";
+ nvmem-cells = <&otp_id 1>;
+ nvmem-cell-names = "mac-address";
power-domains = <&power RK3576_PD_SDGMAC>;
resets = <&cru SRST_A_GMAC1>;
reset-names = "stmmaceth";
@@ -2317,7 +2321,9 @@ otp_cpu_version: cpu-version@5 {
bits = <3 3>;
};
otp_id: id@a {
+ compatible = "rockchip,cpuid";
reg = <0x0a 0x10>;
+ #nvmem-cell-cells = <1>;
};
cpub_leakage: cpub-leakage@1e {
reg = <0x1e 0x1>;

--
2.56.0