Re: [PATCH 1/1] riscv: dts: spacemit: set ETH MAC from eeprom for OrangePi

From: Troy Mitchell

Date: Tue Sep 22 2026 - 05:05:46 EST


On Sun, Sep 20, 2026 at 06:00:00PM +0800, Chukun Pan wrote:
> The EEPROM on the OrangePi R2S and OrangePi RV2 stores the MAC address.
> Assign it to Ethernet, with eth1 having a MAC offset of 1. Remove the
> Ethernet alias to avoid U-Boot patching incorrect MAC addresses.
>
> [...]
>
> --- a/arch/riscv/boot/dts/spacemit/k1-orangepi-r2s.dts
> +++ b/arch/riscv/boot/dts/spacemit/k1-orangepi-r2s.dts
> @@ -16,8 +16,6 @@ aliases {
> i2c2 = &i2c2;
> i2c8 = &i2c8;
> serial0 = &uart0;
> - ethernet0 = &eth0;
> - ethernet1 = &eth1;
> };
>
> chosen {

Where do the incorrect MAC addresses come from? Linux prefers a valid
DT MAC over NVMEM, allowing a bootloader override. Could we keep the
aliases? Removing them also prevents intentional ethaddr/eth1addr
overrides.

> @@ -66,6 +64,8 @@ &emmc {
> };
>
> &eth0 {
> + nvmem-cells = <&mac_address 0>;
> + nvmem-cell-names = "mac-address";
> phy-handle = <&rgmii0>;
> phy-mode = "rgmii-id";
> pinctrl-names = "default";
> @@ -90,6 +90,8 @@ rgmii0: phy@1 {
> };
>
> &eth1 {
> + nvmem-cells = <&mac_address 1>;
> + nvmem-cell-names = "mac-address";
> phy-handle = <&rgmii1>;
> phy-mode = "rgmii-id";
> pinctrl-names = "default";
> @@ -129,7 +131,7 @@ eeprom@50 {
> nvmem-layout {
> compatible = "onie,tlv-layout";
>
> - mac-address {
> + mac_address: mac-address {
> #nvmem-cell-cells = <1>;
> };
>

Have you tested with AT24 and ONIE TLV built as modules, including
network-root boot? Without a bootloader-provided MAC, Ethernet probe
may defer until these dependencies are available.

--
Troy Mitchell

Attachment: signature.asc
Description: PGP signature