imx: ventana: assign default ethprime dynamically
authorTim Harvey <tharvey@gateworks.com>
Wed, 8 Apr 2015 19:54:33 +0000 (12:54 -0700)
committerStefano Babic <sbabic@denx.de>
Wed, 22 Apr 2015 12:39:06 +0000 (14:39 +0200)
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>
board/gateworks/gw_ventana/gw_ventana.c
include/configs/gw_ventana.h

index 303b13a0f89cfa22dd25948a3ef98b614a85e7f4..84d7124e86f6a0a00b08e8904afa4c29a8c5d831 100644 (file)
@@ -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;
 }
 
index 76da53213c8d51edd23a65bbe59e09ed14001759..28c78155e70784905ac4c25d973ae0d8790e2ab0 100644 (file)
 #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