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

Troy Mitchell troy.mitchell at linux.spacemit.com
Tue Sep 22 01:55:38 PDT 2026


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 at 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 at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 248 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-riscv/attachments/20260922/39e0ea13/attachment.sig>


More information about the linux-riscv mailing list