diff mbox series

[v4,01/16] sandbox: net: Add aliases for ethernet devices

Message ID 20220505171146.557773-2-sean.anderson@seco.com
State Accepted
Commit bedb182e32b38fa4078c0dc14d6822672273d96d
Delegated to: Tom Rini
Headers show
Series Add support for NVMEM API | expand

Commit Message

Sean Anderson May 5, 2022, 5:11 p.m. UTC
Commit f3dd213e15 ("net: introduce helpers to get PHY ofnode from MAC")
changed the ethernet sequence assignment from

uclass 36: ethernet
0   * eth@10002000 @ 05813460, seq 0
1   * eth@10003000 @ 05813550, seq 5
2   * sbe5 @ 05813640, seq 3
3   * eth@10004000 @ 05813730, seq 6
4   * dsa-test-eth @ 05813820, seq 4
5   * lan0 @ 05813a30, seq 2
6   * lan1 @ 05813b50, seq 7

to

uclass 36: ethernet
0   * eth@10002000 @ 03813630, seq 0
1   * eth@10003000 @ 03813720, seq 5
2   * sbe5 @ 03813810, seq 3
3   * eth@10004000 @ 03813900, seq 6
4     phy-test-eth @ 038139f0, seq 7
5   * dsa-test-eth @ 03813ae0, seq 4
6   * lan0 @ 03813cf0, seq 2
7   * lan1 @ 03813e10, seq 8

This caused the mac address assignment to switch around. Avoid this in
the future by assigning aliases for all ethernet devices. This reverts
the sequence to what it was before the aformentioned commit (with
phy-test-eth as seq 8). There is no ethernet1 for whatever reason.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
---

Changes in v4:
- Fix dm_test_alias_highest_id test failing because we changed the
  number of aliases

Changes in v3:
- New

 arch/sandbox/dts/test.dts | 3 +++
 test/dm/test-fdt.c        | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

Comments

Tom Rini June 9, 2022, 7:21 p.m. UTC | #1
On Thu, May 05, 2022 at 01:11:30PM -0400, Sean Anderson wrote:

> Commit f3dd213e15 ("net: introduce helpers to get PHY ofnode from MAC")
> changed the ethernet sequence assignment from
> 
> uclass 36: ethernet
> 0   * eth@10002000 @ 05813460, seq 0
> 1   * eth@10003000 @ 05813550, seq 5
> 2   * sbe5 @ 05813640, seq 3
> 3   * eth@10004000 @ 05813730, seq 6
> 4   * dsa-test-eth @ 05813820, seq 4
> 5   * lan0 @ 05813a30, seq 2
> 6   * lan1 @ 05813b50, seq 7
> 
> to
> 
> uclass 36: ethernet
> 0   * eth@10002000 @ 03813630, seq 0
> 1   * eth@10003000 @ 03813720, seq 5
> 2   * sbe5 @ 03813810, seq 3
> 3   * eth@10004000 @ 03813900, seq 6
> 4     phy-test-eth @ 038139f0, seq 7
> 5   * dsa-test-eth @ 03813ae0, seq 4
> 6   * lan0 @ 03813cf0, seq 2
> 7   * lan1 @ 03813e10, seq 8
> 
> This caused the mac address assignment to switch around. Avoid this in
> the future by assigning aliases for all ethernet devices. This reverts
> the sequence to what it was before the aformentioned commit (with
> phy-test-eth as seq 8). There is no ethernet1 for whatever reason.
> 
> Signed-off-by: Sean Anderson <sean.anderson@seco.com>

For the series and patches 1-15, applied to u-boot/next, thanks!
diff mbox series

Patch

diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index a8a86bc715..c0b1d76cdb 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -28,6 +28,9 @@ 
 		ethernet3 = &eth_3;
 		ethernet4 = &dsa_eth0;
 		ethernet5 = &eth_5;
+		ethernet6 = "/eth@10004000";
+		ethernet7 = &swp_1;
+		ethernet8 = &phy_eth0;
 		gpio1 = &gpio_a;
 		gpio2 = &gpio_b;
 		gpio3 = &gpio_c;
diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c
index e1de066226..f9e8174759 100644
--- a/test/dm/test-fdt.c
+++ b/test/dm/test-fdt.c
@@ -184,7 +184,7 @@  static int dm_test_alias_highest_id(struct unit_test_state *uts)
 	int ret;
 
 	ret = dev_read_alias_highest_id("ethernet");
-	ut_asserteq(5, ret);
+	ut_asserteq(8, ret);
 
 	ret = dev_read_alias_highest_id("gpio");
 	ut_asserteq(3, ret);