All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Troy Mitchell" <troy.mitchell@linux.spacemit.com>
To: "Chukun Pan" <amadeus@jmu.edu.cn>, "Yixun Lan" <dlan@kernel.org>
Cc: "Rob Herring" <robh@kernel.org>, "Paul Walmsley" <pjw@kernel.org>,
	"Albert Ou" <aou@eecs.berkeley.edu>,
	"Alexandre Ghiti" <alex@ghiti.fr>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	<linux-riscv@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
	<devicetree@vger.kernel.org>, <spacemit@lists.linux.dev>,
	"Troy Mitchell" <troy.mitchell@linux.spacemit.com>
Subject: Re: [PATCH 1/1] riscv: dts: spacemit: set ETH MAC from eeprom for OrangePi
Date: Tue, 22 Sep 2026 16:55:38 +0800	[thread overview]
Message-ID: <DLLPWUHF8WRQ.13YQTP32MG59Z@linux.spacemit.com> (raw)
In-Reply-To: <20260920100000.3888256-1-amadeus@jmu.edu.cn>


[-- Attachment #1.1: Type: text/plain, Size: 1664 bytes --]

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 #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 248 bytes --]

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

WARNING: multiple messages have this Message-ID (diff)
From: "Troy Mitchell" <troy.mitchell@linux.spacemit.com>
To: "Chukun Pan" <amadeus@jmu.edu.cn>, "Yixun Lan" <dlan@kernel.org>
Cc: "Rob Herring" <robh@kernel.org>, "Paul Walmsley" <pjw@kernel.org>,
	"Albert Ou" <aou@eecs.berkeley.edu>,
	"Alexandre Ghiti" <alex@ghiti.fr>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	<linux-riscv@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
	<devicetree@vger.kernel.org>, <spacemit@lists.linux.dev>,
	"Troy Mitchell" <troy.mitchell@linux.spacemit.com>
Subject: Re: [PATCH 1/1] riscv: dts: spacemit: set ETH MAC from eeprom for OrangePi
Date: Tue, 22 Sep 2026 16:55:38 +0800	[thread overview]
Message-ID: <DLLPWUHF8WRQ.13YQTP32MG59Z@linux.spacemit.com> (raw)
In-Reply-To: <20260920100000.3888256-1-amadeus@jmu.edu.cn>

[-- Attachment #1: Type: text/plain, Size: 1664 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 248 bytes --]

  parent reply	other threads:[~2026-09-22  8:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-20 10:00 [PATCH 1/1] riscv: dts: spacemit: set ETH MAC from eeprom for OrangePi Chukun Pan
2026-09-20 10:00 ` Chukun Pan
2026-09-20 10:05 ` sashiko-bot
2026-09-21 12:42 ` Yixun Lan
2026-09-21 12:42   ` Yixun Lan
2026-09-22  6:50   ` Chukun Pan
2026-09-22  6:50     ` Chukun Pan
2026-09-22  7:29     ` Yixun Lan
2026-09-22  7:29       ` Yixun Lan
2026-09-23  6:40       ` Chukun Pan
2026-09-23  6:40         ` Chukun Pan
2026-09-24  1:23         ` Troy Mitchell
2026-09-24  1:23           ` Troy Mitchell
2026-09-22  8:55 ` Troy Mitchell [this message]
2026-09-22  8:55   ` Troy Mitchell

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=DLLPWUHF8WRQ.13YQTP32MG59Z@linux.spacemit.com \
    --to=troy.mitchell@linux.spacemit.com \
    --cc=alex@ghiti.fr \
    --cc=amadeus@jmu.edu.cn \
    --cc=aou@eecs.berkeley.edu \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlan@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=robh@kernel.org \
    --cc=spacemit@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.