Re: [PATCH v4 3/5] nvmem: rockchip-otp: Derive MAC addresses from the CPU ID
From: Alexey Charkov
Date: Wed Nov 25 2026 - 08:55:27 EST
Hi Ryan,
On Wed, Nov 25, 2026 at 5:49 PM Ryan Leung <untilscour@xxxxxxxxxxxxxx> wrote:
>
> Hi Alexey,
>
> On Tuesday, November 24th, 2026 at 8:04 PM, Alexey Charkov <alchark@xxxxxxxxxxx> wrote:
>
> > Rockchip bootloaders derive stable Ethernet MAC addresses from the CPU
> > ID in the OTP memory and patch them into the device tree they pass on.
> > Kernels started any other way, e.g. straight from the SPL in Falcon
> > mode, end up with random addresses which change on every boot, even
> > though the CPU ID is just as readable from Linux.
> >
> > Implement the derivation for cells marked as "rockchip,cpuid", handing
> > the result to consumers which ask for the cell as "mac-address", such as
> > of_get_mac_address(). Leave the CPU ID unchanged for any other reader,
> > so that the same cell keeps serving the ID itself.
[...]
>
> Perhaps "rockchip,cpuid" could include a mention of "mac" somewhere?
I deliberately avoided that because, at the hardware level, the OTP
cell contains a CPUID, not an address. The special treatment applies
only when the CPUID is used for MAC address derivation - which IMO is
better captured in the binding description. Let's see what the
maintainers have to say though.
> Tested-by: Ryan Leung <untilscour@xxxxxxxxxxxxxx> # RK3528 NanoPi R28S
>
> I tested on FriendlyELEC NanoPi R28S (RK3528) with index of 100 and the MAC address was exactly as expected.
Thanks a lot for testing!
Best regards,
Alexey