summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorJoe Hershberger <joe.hershberger@ni.com>2015-03-22 17:09:17 -0500
committerSimon Glass <sjg@chromium.org>2015-04-18 11:11:13 -0600
commit6536b9bb769fe764f4793a1b37a2619391bb2482 (patch)
treec37a0e61c47ef3be23ba0d6f9dadec73f6d21816 /net
parente58780dcb7b8656ebc2dd6ba6d0da728bc65bf40 (diff)
downloadu-boot-imx-6536b9bb769fe764f4793a1b37a2619391bb2482.zip
u-boot-imx-6536b9bb769fe764f4793a1b37a2619391bb2482.tar.gz
u-boot-imx-6536b9bb769fe764f4793a1b37a2619391bb2482.tar.bz2
dm: eth: Add support for ethprime env var
The ethprime env var is used to indicate the starting device if none is specified in ethact. Also support aliases specified in the ethprime var. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'net')
-rw-r--r--net/eth.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/net/eth.c b/net/eth.c
index a2e6f34..b6c2af3 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -360,6 +360,18 @@ int eth_initialize(void)
printf("No ethernet found.\n");
bootstage_error(BOOTSTAGE_ID_NET_ETH_START);
} else {
+ char *ethprime = getenv("ethprime");
+ struct udevice *prime_dev = NULL;
+
+ if (ethprime)
+ prime_dev = eth_get_dev_by_name(ethprime);
+ if (prime_dev) {
+ eth_set_dev(prime_dev);
+ eth_current_changed();
+ } else {
+ eth_set_dev(NULL);
+ }
+
bootstage_mark(BOOTSTAGE_ID_NET_ETH_INIT);
do {
if (num_devices)
@@ -367,6 +379,9 @@ int eth_initialize(void)
printf("eth%d: %s", dev->seq, dev->name);
+ if (ethprime && dev == prime_dev)
+ printf(" [PRIME]");
+
eth_write_hwaddr(dev);
uclass_next_device(&dev);
@@ -915,8 +930,20 @@ void eth_set_current(void)
act = getenv("ethact");
env_changed_id = env_id;
}
- if (act != NULL)
+
+ if (act == NULL) {
+ char *ethprime = getenv("ethprime");
+ void *dev = NULL;
+
+ if (ethprime)
+ dev = eth_get_dev_by_name(ethprime);
+ if (dev)
+ eth_set_dev(dev);
+ else
+ eth_set_dev(NULL);
+ } else {
eth_set_dev(eth_get_dev_by_name(act));
+ }
eth_current_changed();
}