diff options
author | Tom Rini <trini@konsulko.com> | 2021-06-18 11:18:56 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-06-18 11:18:56 -0400 |
commit | 97c8cb524c19f054036efd2b4429273bd503e39c (patch) | |
tree | 3cdea4854ba0e8755aff49c43579eb2756ff3349 /net/eth-uclass.c | |
parent | a298d4fbcdba1b38e48ea2af0fc5386cab2070da (diff) | |
parent | 54c321f9deeba309989f0828e4d0427cbfbefcd3 (diff) |
Merge branch 'network_master' of https://source.denx.de/u-boot/custodians/u-boot-net
Diffstat (limited to 'net/eth-uclass.c')
-rw-r--r-- | net/eth-uclass.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/net/eth-uclass.c b/net/eth-uclass.c index 34ca731d1e3..5146bd6666c 100644 --- a/net/eth-uclass.c +++ b/net/eth-uclass.c @@ -69,8 +69,11 @@ void eth_set_current_to_next(void) /* * Typically this will simply return the active device. * In the case where the most recent active device was unset, this will attempt - * to return the first device. If that device doesn't exist or fails to probe, - * this function will return NULL. + * to return the device with sequence id 0 (which can be configured by the + * device tree). If this fails, fall back to just getting the first device. + * The latter is non-deterministic and depends on the order of the probing. + * If that device doesn't exist or fails to probe, this function will return + * NULL. */ struct udevice *eth_get_dev(void) { @@ -80,9 +83,13 @@ struct udevice *eth_get_dev(void) if (!uc_priv) return NULL; - if (!uc_priv->current) - eth_errno = uclass_first_device(UCLASS_ETH, - &uc_priv->current); + if (!uc_priv->current) { + eth_errno = uclass_get_device_by_seq(UCLASS_ETH, 0, + &uc_priv->current); + if (eth_errno) + eth_errno = uclass_first_device(UCLASS_ETH, + &uc_priv->current); + } return uc_priv->current; } @@ -598,8 +605,8 @@ static int eth_pre_remove(struct udevice *dev) return 0; } -UCLASS_DRIVER(eth) = { - .name = "eth", +UCLASS_DRIVER(ethernet) = { + .name = "ethernet", .id = UCLASS_ETH, .post_bind = eth_post_bind, .pre_unbind = eth_pre_unbind, |