Devicetree
 help / color / mirror / Atom feed
From: Ricardo Pardini <ricardo@pardini.net>
To: "Alexey Charkov" <alchark@flipper.net>,
	"Srinivas Kandagatla" <srini@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Heiko Stuebner" <heiko@sntech.de>,
	"Rafał Miłecki" <rafal@milecki.pl>,
	"Andrew Lunn" <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@kernel.org>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>, "Andrew Lunn" <andrew@lunn.ch>,
	"Heiner Kallweit" <hkallweit1@gmail.com>,
	"Russell King" <linux@armlinux.org.uk>,
	"Willem de Bruijn" <willemb@google.com>,
	"Simon Horman" <horms@kernel.org>
Cc: Ryan Leung <untilscour@protonmail.com>,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 0/5] net: Derive stable MAC addresses from a unique device ID
Date: Fri, 4 Dec 2026 03:18:02 +0100	[thread overview]
Message-ID: <7fcf8e87-fe69-469a-a116-2eede651f843@pardini.net> (raw)
In-Reply-To: <20261125-rk3576-otp-cpuid-mac-v5-0-b3125c9a5fc8@flipper.net>

On 25/11/2026 20:36, Alexey Charkov wrote:
> Rockchip SoCs are shipped with a unique CPU ID in their internal OTP
> memory, and Rockchip bootloaders use it to give boards which have no
> dedicated storage for a MAC address a stable one anyway: they hash the CPU
> ID and patch the resulting addresses into the device tree they hand over.
> 
> Kernels started without that fixup, e.g. straight from the SPL in Falcon
> mode or by any other loader which does not implement Rockchip's derivation,
> fall back to random MAC addresses which change on every boot.
> 
> Derive the addresses in of_get_mac_address() instead, as the last resort
> after any stored address, from a "unique-id" NVMEM cell referenced by
> the Ethernet controller, so that a Linux image can use the same stable
> addresses regardless of the boot flow.
> [...]
Hi Alexey,

I tested the whole series on v7.4-rc5 on a Seeed reComputer RK3576 Dev Kit
(both GMACs, ethernet0/1; DT for the board is submitted with an upcoming 
v2).

With U-Boot (mainline v2026.07) the fixed-up local-mac-address still wins,
as intended. Without u-boot proper, it gives both GMACs exactly the 
addresses U-Boot would assign, and both links come up. Thus:

Tested-by: Ricardo Pardini <ricardo@pardini.net> # Seeed reComputer RK3576 Dev Kit

I also carried the approach over to RK3588 and RK356x, and it fits them
well:

- the RK3588 OTP cells move into a fixed layout without trouble, the same
  as your RK3576 patch; RK356x already had one
- the "rockchip,cpuid" compatible goes onto the RK3588 (id@7) and RK356x
  (id@a) CPU ID cells as is
- the GMAC "unique-id" references apply the same way. On a Mekotronics
  R58X-Pro (RK3588, gmac0 + gmac1) both GMACs got exactly U-Boot's
  addresses, and so did the single GMAC (gmac1) on a Mixtile Edge 2 (RK3568)
- it also works for PCIe NICs: on a Mixtile Blade 3 (RK3588, not submitted yet), 
  the two RTL8125B behind the PCIe switch get ethernet0/1 aliases and a
  "unique-id" reference each, and r8169 picks the derived addresses up
  through of_get_mac_address() with no driver changes.

So all in all, the approach works and carries over nicely to RK356x/88. I
can send the RK3588 and RK356x DT patches once this lands, unless you'd
rather carry them, just let me know; they'd be:

- arm64: dts: rockchip: Derive GMAC MAC addresses from OTP on RK356x
- arm64: dts: rockchip: Derive GMAC MAC addresses from OTP on RK3588
- arm64: dts: rockchip: Move RK3588 OTP cells into a fixed layout
Plus a few different instances of
- arm64: dts: rockchip: Derive RTL8125 MAC addresses from OTP on Foo

Thanks,
Ricardo

  parent reply	other threads:[~2026-12-04  2:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 19:36 [PATCH v5 0/5] net: Derive stable MAC addresses from a unique device ID Alexey Charkov
2026-11-25 19:36 ` [PATCH v5 1/5] dt-bindings: nvmem: fixed-cell: Add Rockchip CPU ID Alexey Charkov
2026-12-03 18:47   ` Rob Herring (Arm)
2026-11-25 19:36 ` [PATCH v5 2/5] dt-bindings: net: ethernet-controller: Allow a unique ID NVMEM cell Alexey Charkov
2026-12-03 18:47   ` Rob Herring (Arm)
2026-11-25 19:36 ` [PATCH v5 3/5] net: of_net: Derive MAC addresses from a unique device ID Alexey Charkov
2026-11-26  4:02   ` Ryan Leung
2026-12-01  1:30   ` Andrew Lunn
2026-12-01  4:17     ` Alexey Charkov
2026-12-01 13:05       ` Andrew Lunn
2026-12-04  9:45   ` David Laight
2026-11-25 19:36 ` [PATCH v5 4/5] arm64: dts: rockchip: Move RK3576 OTP cells into a fixed layout Alexey Charkov
2026-11-25 19:36 ` [PATCH v5 5/5] arm64: dts: rockchip: Derive GMAC MAC addresses from OTP on RK3576 Alexey Charkov
2026-12-04  2:18 ` Ricardo Pardini [this message]
2026-12-04  8:50   ` [PATCH v5 0/5] net: Derive stable MAC addresses from a unique device ID Alexey Charkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7fcf8e87-fe69-469a-a116-2eede651f843@pardini.net \
    --to=ricardo@pardini.net \
    --cc=alchark@flipper.net \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@kernel.org \
    --cc=heiko@sntech.de \
    --cc=hkallweit1@gmail.com \
    --cc=horms@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rafal@milecki.pl \
    --cc=robh@kernel.org \
    --cc=srini@kernel.org \
    --cc=untilscour@protonmail.com \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox