* [PATCH 1/1] riscv: dts: spacemit: set ETH MAC from eeprom for OrangePi
@ 2026-09-20 10:00 Chukun Pan
2026-09-21 12:42 ` Yixun Lan
2026-09-22 8:55 ` Troy Mitchell
0 siblings, 2 replies; 6+ messages in thread
From: Chukun Pan @ 2026-09-20 10:00 UTC (permalink / raw)
To: Yixun Lan
Cc: Rob Herring, Paul Walmsley, Albert Ou, Alexandre Ghiti,
Palmer Dabbelt, Conor Dooley, Krzysztof Kozlowski, linux-riscv,
linux-kernel, devicetree, spacemit, Chukun Pan
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.
Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
---
arch/riscv/boot/dts/spacemit/k1-orangepi-r2s.dts | 8 +++++---
arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts | 8 +++++---
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/arch/riscv/boot/dts/spacemit/k1-orangepi-r2s.dts b/arch/riscv/boot/dts/spacemit/k1-orangepi-r2s.dts
index 7125f2882ce8..073cc975135f 100644
--- 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 = ð0;
- ethernet1 = ð1;
};
chosen {
@@ -66,6 +64,8 @@ &emmc {
};
ð0 {
+ 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 {
};
ð1 {
+ 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>;
};
diff --git a/arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts b/arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts
index 837616255464..609c4755775d 100644
--- a/arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts
+++ b/arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts
@@ -15,8 +15,6 @@ / {
aliases {
serial0 = &uart0;
- ethernet0 = ð0;
- ethernet1 = ð1;
i2c2 = &i2c2;
i2c8 = &i2c8;
mmc0 = &emmc;
@@ -93,6 +91,8 @@ &emmc {
};
ð0 {
+ nvmem-cells = <&mac_address 0>;
+ nvmem-cell-names = "mac-address";
phy-handle = <&rgmii0>;
phy-mode = "rgmii-id";
pinctrl-names = "default";
@@ -117,6 +117,8 @@ rgmii0: phy@1 {
};
ð1 {
+ nvmem-cells = <&mac_address 1>;
+ nvmem-cell-names = "mac-address";
phy-handle = <&rgmii1>;
phy-mode = "rgmii-id";
pinctrl-names = "default";
@@ -156,7 +158,7 @@ eeprom@50 {
nvmem-layout {
compatible = "onie,tlv-layout";
- mac-address {
+ mac_address: mac-address {
#nvmem-cell-cells = <1>;
};
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 1/1] riscv: dts: spacemit: set ETH MAC from eeprom for OrangePi
2026-09-20 10:00 [PATCH 1/1] riscv: dts: spacemit: set ETH MAC from eeprom for OrangePi Chukun Pan
@ 2026-09-21 12:42 ` Yixun Lan
2026-09-22 6:50 ` Chukun Pan
2026-09-22 8:55 ` Troy Mitchell
1 sibling, 1 reply; 6+ messages in thread
From: Yixun Lan @ 2026-09-21 12:42 UTC (permalink / raw)
To: Chukun Pan
Cc: Rob Herring, Paul Walmsley, Albert Ou, Alexandre Ghiti,
Palmer Dabbelt, Conor Dooley, Krzysztof Kozlowski, linux-riscv,
linux-kernel, devicetree, spacemit
Hi Chukun,
On 18:00 Sun 20 Sep , 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.
>
Could you point me where the u-boot patching the MAC address?
I'm not fully aware of this problem..
> Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
> ---
> arch/riscv/boot/dts/spacemit/k1-orangepi-r2s.dts | 8 +++++---
> arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts | 8 +++++---
> 2 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/arch/riscv/boot/dts/spacemit/k1-orangepi-r2s.dts b/arch/riscv/boot/dts/spacemit/k1-orangepi-r2s.dts
> index 7125f2882ce8..073cc975135f 100644
> --- 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 = ð0;
> - ethernet1 = ð1;
..
--
Yixun Lan (dlan)
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 1/1] riscv: dts: spacemit: set ETH MAC from eeprom for OrangePi
2026-09-21 12:42 ` Yixun Lan
@ 2026-09-22 6:50 ` Chukun Pan
2026-09-22 7:29 ` Yixun Lan
0 siblings, 1 reply; 6+ messages in thread
From: Chukun Pan @ 2026-09-22 6:50 UTC (permalink / raw)
To: dlan
Cc: alex, amadeus, aou, conor+dt, devicetree, krzk+dt, linux-kernel,
linux-riscv, palmer, pjw, robh, spacemit
Hi,
> Could you point me where the u-boot patching the MAC address?
> I'm not fully aware of this problem..
This is handled by U-Boot's fdt_fixup_ethernet() function:
https://github.com/u-boot/u-boot/blob/main/boot/fdt_support.c#L639
do_bootm_linux()
|
boot_prep_linux()
|
image_setup_linux()
|
image_setup_libfdt()
|
fdt_fixup_ethernet()
Thanks,
Chukun
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 1/1] riscv: dts: spacemit: set ETH MAC from eeprom for OrangePi
2026-09-22 6:50 ` Chukun Pan
@ 2026-09-22 7:29 ` Yixun Lan
2026-09-23 6:40 ` Chukun Pan
0 siblings, 1 reply; 6+ messages in thread
From: Yixun Lan @ 2026-09-22 7:29 UTC (permalink / raw)
To: Chukun Pan
Cc: alex, aou, conor+dt, devicetree, krzk+dt, linux-kernel,
linux-riscv, palmer, pjw, robh, spacemit
Hi Chukun,
On 14:50 Tue 22 Sep , Chukun Pan wrote:
> Hi,
>
> > Could you point me where the u-boot patching the MAC address?
> > I'm not fully aware of this problem..
>
> This is handled by U-Boot's fdt_fixup_ethernet() function:
> https://github.com/u-boot/u-boot/blob/main/boot/fdt_support.c#L639
>
> do_bootm_linux()
> |
> boot_prep_linux()
> |
> image_setup_linux()
> |
> image_setup_libfdt()
> |
> fdt_fixup_ethernet()
>
So checked the code, it's not a direct problem of /alias, but due to the
env variable provided to override the mac address, see
https://github.com/u-boot/u-boot/blob/main/boot/fdt_support.c#L698
tmp = env_get(mac);
if (!tmp)
continue;
In this case, I don't think it's necessary to drop the ethernet alias,
I mean it's totally fine if there is uboot ethaddr env and it wins
--
Yixun Lan (dlan)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] riscv: dts: spacemit: set ETH MAC from eeprom for OrangePi
2026-09-22 7:29 ` Yixun Lan
@ 2026-09-23 6:40 ` Chukun Pan
0 siblings, 0 replies; 6+ messages in thread
From: Chukun Pan @ 2026-09-23 6:40 UTC (permalink / raw)
To: dlan
Cc: alex, amadeus, aou, conor+dt, devicetree, krzk+dt, linux-kernel,
linux-riscv, palmer, pjw, robh, spacemit
Hi,
> So checked the code, it's not a direct problem of /alias, but due to the
> env variable provided to override the mac address, see
> In this case, I don't think it's necessary to drop the ethernet alias,
> I mean it's totally fine if there is uboot ethaddr env and it wins
Once U-Boot overwrites the MAC address in the DT, of_get_mac_address()
will return 0, and of_get_mac_address_nvmem() will not be called.
Then I think this patch is useless.
Thanks,
Chukun
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] riscv: dts: spacemit: set ETH MAC from eeprom for OrangePi
2026-09-20 10:00 [PATCH 1/1] riscv: dts: spacemit: set ETH MAC from eeprom for OrangePi Chukun Pan
2026-09-21 12:42 ` Yixun Lan
@ 2026-09-22 8:55 ` Troy Mitchell
1 sibling, 0 replies; 6+ messages in thread
From: Troy Mitchell @ 2026-09-22 8:55 UTC (permalink / raw)
To: Chukun Pan, Yixun Lan
Cc: Rob Herring, Paul Walmsley, Albert Ou, Alexandre Ghiti,
Palmer Dabbelt, Conor Dooley, Krzysztof Kozlowski, linux-riscv,
linux-kernel, devicetree, spacemit, Troy Mitchell
[-- 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 = ð0;
> - ethernet1 = ð1;
> };
>
> 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 {
> };
>
> ð0 {
> + 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 {
> };
>
> ð1 {
> + 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 --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-09-23 6:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-20 10:00 [PATCH 1/1] riscv: dts: spacemit: set ETH MAC from eeprom for OrangePi Chukun Pan
2026-09-21 12:42 ` Yixun Lan
2026-09-22 6:50 ` Chukun Pan
2026-09-22 7:29 ` Yixun Lan
2026-09-23 6:40 ` Chukun Pan
2026-09-22 8:55 ` Troy Mitchell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®