[PATCH 10/16] board: traverse: ten64: fix allocation order of MAC addresses

Mathew McBride matt at traverse.com.au
Fri Jul 21 06:39:25 CEST 2023


On Ten64 boards, the "serial number" is the MAC address of the
first Gigabit Ethernet interface (labelled GE0 on the appliance),
and counted up from there.

The previous logic did not take into account U-Boot's ordering
of the network interfaces. By setting aliases/ethernetX in the device
tree we can ensure the U-Boot 'ethX' is the same as the labelled
port order on the unit, as well as the one adopted by Linux.

Signed-off-by: Mathew McBride <matt at traverse.com.au>
---
 arch/arm/dts/fsl-ls1088a-ten64-u-boot.dtsi | 10 ++++++++++
 board/traverse/ten64/ten64.c               |  4 ++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/arm/dts/fsl-ls1088a-ten64-u-boot.dtsi b/arch/arm/dts/fsl-ls1088a-ten64-u-boot.dtsi
index 89566bf849..4e6700d586 100644
--- a/arch/arm/dts/fsl-ls1088a-ten64-u-boot.dtsi
+++ b/arch/arm/dts/fsl-ls1088a-ten64-u-boot.dtsi
@@ -6,6 +6,16 @@
 /{
 	aliases {
 		spi0 = &qspi;
+		ethernet0 = &dpmac7;
+		ethernet1 = &dpmac8;
+		ethernet2 = &dpmac9;
+		ethernet3 = &dpmac10;
+		ethernet4 = &dpmac3;
+		ethernet5 = &dpmac4;
+		ethernet6 = &dpmac5;
+		ethernet7 = &dpmac6;
+		ethernet8 = &dpmac2;
+		ethernet9 = &dpmac1;
 	};
 };
 
diff --git a/board/traverse/ten64/ten64.c b/board/traverse/ten64/ten64.c
index 39f0d107cd..0febc0baf0 100644
--- a/board/traverse/ten64/ten64.c
+++ b/board/traverse/ten64/ten64.c
@@ -328,8 +328,8 @@ static void ten64_set_macaddrs_from_board_info(struct t64uc_board_info *boardinf
 		this_dpmac_num = allocation_order[intfidx];
 		printf("DPMAC%d: %s\n", this_dpmac_num, ethaddr);
 		snprintf(enetvar, 10,
-			 (this_dpmac_num != 1) ? "eth%daddr" : "ethaddr",
-			 this_dpmac_num - 1);
+			 (intfidx != 0) ? "eth%daddr" : "ethaddr",
+			 intfidx);
 		macaddr++;
 
 		if (!env_get(enetvar))
-- 
2.30.1



More information about the U-Boot mailing list