From: Tim Harvey <tharvey@gateworks.com>
Date: Wed, 8 Apr 2015 19:54:33 +0000 (-0700)
Subject: imx: ventana: assign default ethprime dynamically
X-Git-Tag: v2025.01-rc5-pxa1908~13110^2~43
X-Git-Url: http://git.dujemihanovic.xyz/html/static/git-favicon.png?a=commitdiff_plain;h=e806b2298450827eb064415c11f0fc5ae1b95764;p=u-boot.git

imx: ventana: assign default ethprime dynamically

Gateworks Ventana boards don't all use IMX6 FEC, so lets define default
ethprime based off the first detected device.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---

diff --git a/board/gateworks/gw_ventana/gw_ventana.c b/board/gateworks/gw_ventana/gw_ventana.c
index 303b13a0f8..84d7124e86 100644
--- a/board/gateworks/gw_ventana/gw_ventana.c
+++ b/board/gateworks/gw_ventana/gw_ventana.c
@@ -413,6 +413,15 @@ int board_eth_init(bd_t *bis)
 	usb_eth_initialize(bis);
 #endif
 
+	/* default to the first detected enet dev */
+	if (!getenv("ethprime")) {
+		struct eth_device *dev = eth_get_dev_by_index(0);
+		if (dev) {
+			setenv("ethprime", dev->name);
+			printf("set ethprime to %s\n", getenv("ethprime"));
+		}
+	}
+
 	return 0;
 }
 
diff --git a/include/configs/gw_ventana.h b/include/configs/gw_ventana.h
index 76da53213c..28c78155e7 100644
--- a/include/configs/gw_ventana.h
+++ b/include/configs/gw_ventana.h
@@ -178,7 +178,6 @@
 #define CONFIG_MII
 #define IMX_FEC_BASE             ENET_BASE_ADDR
 #define CONFIG_FEC_XCV_TYPE      RGMII
-#define CONFIG_ETHPRIME          "FEC"
 #define CONFIG_FEC_MXC_PHYADDR   0
 #define CONFIG_PHYLIB
 #define CONFIG_ARP_TIMEOUT       200UL