All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 5/7] Blackfin: cm-bf537e/cm-bf537u/tcm-bf537: update network settings
Date: Mon, 23 May 2011 23:30:58 -0400	[thread overview]
Message-ID: <1306207860-5124-6-git-send-email-vapier@gentoo.org> (raw)
In-Reply-To: <1306207860-5124-1-git-send-email-vapier@gentoo.org>

From: Harald Krapfenbauer <harald.krapfenbauer@bluetechnix.com>

These boards can have an addon card plugged onto them, so enable
support for it.

Signed-off-by: Harald Krapfenbauer <harald.krapfenbauer@bluetechnix.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 board/cm-bf537e/cm-bf537e.c |   34 ++++++++++++++++++++++------------
 board/cm-bf537u/cm-bf537u.c |   39 +++++++++++++++++++++------------------
 board/tcm-bf537/tcm-bf537.c |   34 ++++++++++++++++++++++------------
 include/configs/cm-bf537e.h |    3 +++
 include/configs/cm-bf537u.h |    8 ++++----
 include/configs/tcm-bf537.h |    4 +++-
 6 files changed, 75 insertions(+), 47 deletions(-)

diff --git a/board/cm-bf537e/cm-bf537e.c b/board/cm-bf537e/cm-bf537e.c
index 1e350dc..38dbc6e 100644
--- a/board/cm-bf537e/cm-bf537e.c
+++ b/board/cm-bf537e/cm-bf537e.c
@@ -24,27 +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];
+
+	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
 }
 
+#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 bfin_EMAC_initialize(bis);
+	/* 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();
 
diff --git a/board/cm-bf537u/cm-bf537u.c b/board/cm-bf537u/cm-bf537u.c
index 4b7e864..a62ddd6 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();
 
diff --git a/board/tcm-bf537/tcm-bf537.c b/board/tcm-bf537/tcm-bf537.c
index 04d6bdb..004e0d9 100644
--- a/board/tcm-bf537/tcm-bf537.c
+++ b/board/tcm-bf537/tcm-bf537.c
@@ -24,27 +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];
+
+	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
 }
 
+#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 bfin_EMAC_initialize(bis);
+	/* 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();
 
diff --git a/include/configs/cm-bf537e.h b/include/configs/cm-bf537e.h
index 934b74b..4eff9c9 100644
--- a/include/configs/cm-bf537e.h
+++ b/include/configs/cm-bf537e.h
@@ -65,6 +65,9 @@
 #ifndef __ADSPBF534__
 #define ADI_CMDS_NETWORK	1
 #define CONFIG_BFIN_MAC
+#define CONFIG_SMC911X		1
+#define CONFIG_SMC911X_BASE	0x20308000
+#define CONFIG_SMC911X_16_BIT
 #define CONFIG_NETCONSOLE	1
 #define CONFIG_NET_MULTI	1
 #endif
diff --git a/include/configs/cm-bf537u.h b/include/configs/cm-bf537u.h
index c274c20..ccb3b47 100644
--- a/include/configs/cm-bf537u.h
+++ b/include/configs/cm-bf537u.h
@@ -63,11 +63,11 @@
  */
 #ifndef __ADSPBF534__
 #define ADI_CMDS_NETWORK	1
-#define CONFIG_NET_MULTI
-/* The next 3 lines are for use with SMSC on EXT-BF5xx-USB-ETH2 */
-#define CONFIG_SMC911X	1
-#define CONFIG_SMC911X_BASE	0x24000000
+#define CONFIG_SMC911X		1
+#define CONFIG_SMC911X_BASE	0x20308000
 #define CONFIG_SMC911X_16_BIT
+#define CONFIG_NETCONSOLE	1
+#define CONFIG_NET_MULTI	1
 #endif
 #define CONFIG_HOSTNAME		cm-bf537u
 /* Uncomment next line to use fixed MAC address */
diff --git a/include/configs/tcm-bf537.h b/include/configs/tcm-bf537.h
index 8ded175..0807589 100644
--- a/include/configs/tcm-bf537.h
+++ b/include/configs/tcm-bf537.h
@@ -62,10 +62,12 @@
 /*
  * Network Settings
  */
-/* TCM-BF537E has no PHY on it, but EXT-BF5xx-USB/Ethernet board has */
 #ifndef __ADSPBF534__
 #define ADI_CMDS_NETWORK	1
 #define CONFIG_BFIN_MAC
+#define CONFIG_SMC911X		1
+#define CONFIG_SMC911X_BASE	0x20308000
+#define CONFIG_SMC911X_16_BIT
 #define CONFIG_NETCONSOLE	1
 #define CONFIG_NET_MULTI	1
 #endif
-- 
1.7.5.rc3

  parent reply	other threads:[~2011-05-24  3:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-24  3:30 [U-Boot] [PATCH 0/7] Blackfin fixes for 2011.06 Mike Frysinger
2011-05-24  3:30 ` [U-Boot] [PATCH 1/7] Blackfin: use common LDSCRIPT logic Mike Frysinger
2011-05-24  3:30 ` [U-Boot] [PATCH 2/7] Blackfin: use on-chip reset func with newer parts Mike Frysinger
2011-05-24  3:30 ` [U-Boot] [PATCH 3/7] Blackfin: bf548-ezkit/bf561-ezkit: update env location Mike Frysinger
2011-05-24  3:30 ` [U-Boot] [PATCH 4/7] Blackfin: boards: build zlib dir with -O2 Mike Frysinger
2011-05-24  3:30 ` Mike Frysinger [this message]
2011-05-24  3:30 ` [U-Boot] [PATCH 6/7] Blackfin: cm-bf537e/cm-bf537u/tcm-bf537: enable mmc_spi support Mike Frysinger
2011-05-24  3:31 ` [U-Boot] [PATCH 7/7] Blackfin: cm-bf537e/cm-bf537u/tcm-bf537: update embedded env settings Mike Frysinger
2011-05-24  3:32 ` [U-Boot] Pull request u-boot-blackfin.git Mike Frysinger
2011-06-01 19:58   ` Wolfgang Denk
2011-06-02 15:02     ` Mike Frysinger
2011-06-02 20:46       ` Wolfgang Denk
2011-06-03 17:28   ` [U-Boot] Pull request u-boot-blackfin.git (v2) Mike Frysinger
2011-06-08 21:28     ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1306207860-5124-6-git-send-email-vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.