summaryrefslogtreecommitdiff
path: root/board/cm-bf537u/cm-bf537u.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/cm-bf537u/cm-bf537u.c')
-rw-r--r--board/cm-bf537u/cm-bf537u.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/board/cm-bf537u/cm-bf537u.c b/board/cm-bf537u/cm-bf537u.c
index 4b7e8642c9..a62ddd62b6 100644
--- a/board/cm-bf537u/cm-bf537u.c
+++ b/board/cm-bf537u/cm-bf537u.c
@@ -24,34 +24,37 @@ int checkboard(void)
return 0;
}
-#ifdef CONFIG_BFIN_MAC
-static void board_init_enetaddr(uchar *mac_addr)
+static void board_init_enetaddr(char *var)
{
- puts("Warning: Generating 'random' MAC address\n");
- bfin_gen_rand_mac(mac_addr);
- eth_setenv_enetaddr("ethaddr", mac_addr);
-}
+#ifdef CONFIG_NET_MULTI
+ uchar enetaddr[6];
-int board_eth_init(bd_t *bis)
-{
- return bfin_EMAC_initialize(bis);
-}
+ if (eth_getenv_enetaddr(var, enetaddr))
+ return;
+
+ printf("Warning: %s: generating 'random' MAC address\n", var);
+ bfin_gen_rand_mac(enetaddr);
+ eth_setenv_enetaddr(var, enetaddr);
#endif
+}
-#ifdef CONFIG_SMC911X
+#ifndef CONFIG_BFIN_MAC
+# define bfin_EMAC_initialize(x) 1
+#endif
+#ifndef CONFIG_SMC911X
+# define smc911x_initialize(n, x) 1
+#endif
int board_eth_init(bd_t *bis)
{
- return smc911x_initialize(0, CONFIG_SMC911X_BASE);
+ /* return ok if at least 1 eth device works */
+ return bfin_EMAC_initialize(bis) &
+ smc911x_initialize(0, CONFIG_SMC911X_BASE);
}
-#endif
int misc_init_r(void)
{
-#ifdef CONFIG_BFIN_MAC
- uchar enetaddr[6];
- if (!eth_getenv_enetaddr("ethaddr", enetaddr))
- board_init_enetaddr(enetaddr);
-#endif
+ board_init_enetaddr("ethaddr");
+ board_init_enetaddr("eth1addr");
gpio_cfi_flash_init();