[PATCH v5 5/5] arm64: dts: rockchip: Derive GMAC MAC addresses from OTP on RK3576
From: Alexey Charkov
Date: Wed Nov 25 2026 - 14:37:48 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 as their
unique ID, so that the addresses can be derived from the device tree
alone, whatever the bootloader. Each GMAC gets the address of its
"ethernetN" alias, as with the bootloaders. Boards which store a MAC
address of their own can reference it instead.
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 | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm64/boot/dts/rockchip/rk3576.dtsi b/arch/arm64/boot/dts/rockchip/rk3576.dtsi
index 2e83a73ddbb2..d14236c783b5 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>;
+ nvmem-cell-names = "unique-id";
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>;
+ nvmem-cell-names = "unique-id";
power-domains = <&power RK3576_PD_SDGMAC>;
resets = <&cru SRST_A_GMAC1>;
reset-names = "stmmaceth";
@@ -2317,6 +2321,7 @@ otp_cpu_version: cpu-version@5 {
bits = <3 3>;
};
otp_id: id@a {
+ compatible = "rockchip,cpuid";
reg = <0x0a 0x10>;
};
cpub_leakage: cpub-leakage@1e {
--
2.56.0