dm: eth: Stick to 'ethact' when 'ethrotate' is 'no' in eth_init()
When 'ethrotate' variable is set to 'no' and 'ethact' variable is already set to an ethernet device, we should stick to 'ethact'. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
a671c4f2be
commit
4cdc2c8cc0
18
net/eth.c
18
net/eth.c
|
@ -337,15 +337,31 @@ U_BOOT_ENV_CALLBACK(ethaddr, on_ethaddr);
|
||||||
|
|
||||||
int eth_init(void)
|
int eth_init(void)
|
||||||
{
|
{
|
||||||
struct udevice *current;
|
char *ethact = getenv("ethact");
|
||||||
|
char *ethrotate = getenv("ethrotate");
|
||||||
|
struct udevice *current = NULL;
|
||||||
struct udevice *old_current;
|
struct udevice *old_current;
|
||||||
int ret = -ENODEV;
|
int ret = -ENODEV;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When 'ethrotate' variable is set to 'no' and 'ethact' variable
|
||||||
|
* is already set to an ethernet device, we should stick to 'ethact'.
|
||||||
|
*/
|
||||||
|
if ((ethrotate != NULL) && (strcmp(ethrotate, "no") == 0)) {
|
||||||
|
if (ethact) {
|
||||||
|
current = eth_get_dev_by_name(ethact);
|
||||||
|
if (!current)
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!current) {
|
||||||
current = eth_get_dev();
|
current = eth_get_dev();
|
||||||
if (!current) {
|
if (!current) {
|
||||||
printf("No ethernet found.\n");
|
printf("No ethernet found.\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
old_current = current;
|
old_current = current;
|
||||||
do {
|
do {
|
||||||
|
|
Loading…
Reference in New Issue