[U-Boot] [PATCH v2 15/17] Moved initialization of E1000 Ethernet controller to board_eth_init()

Ben Warren biggerbadderben at gmail.com
Mon Sep 1 07:57:40 CEST 2008


Affected boards:
	ap1000
	mvbc_p
	PM854

Removed initialization of the driver from net/eth.c

Signed-off-by: Ben Warren <biggerbadderben at gmail.com>
---
 board/amirix/ap1000/ap1000.c        |    7 +++++++
 board/matrix_vision/mvbc_p/mvbc_p.c |    3 ++-
 board/pm854/pm854.c                 |    6 ++++++
 drivers/net/e1000.c                 |    2 +-
 drivers/net/e1000.h                 |    1 +
 include/netdev.h                    |    4 ++++
 net/eth.c                           |    4 ----
 7 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/board/amirix/ap1000/ap1000.c b/board/amirix/ap1000/ap1000.c
index 55277e7..8f30ed9 100644
--- a/board/amirix/ap1000/ap1000.c
+++ b/board/amirix/ap1000/ap1000.c
@@ -23,6 +23,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <netdev.h>
 #include <asm/processor.h>
 
 #include "powerspan.h"
@@ -697,3 +698,9 @@ U_BOOT_CMD (swrecon, 1, 0, do_swreconfig,
 	    "swrecon - trigger a board reconfigure to the software selected configuration\n",
 	    "\n"
 	    "    - trigger a board reconfigure to the software selected configuration\n");
+
+int board_eth_init(bd_t *bis)
+{
+	return pci_eth_init(bis);
+}
+
diff --git a/board/matrix_vision/mvbc_p/mvbc_p.c b/board/matrix_vision/mvbc_p/mvbc_p.c
index 648b45e..c88c4a6 100644
--- a/board/matrix_vision/mvbc_p/mvbc_p.c
+++ b/board/matrix_vision/mvbc_p/mvbc_p.c
@@ -328,5 +328,6 @@ void ft_board_setup(void *blob, bd_t *bd)
 
 int board_eth_init(bd_t *bis)
 {
-	return cpu_eth_init(bis); /* Built in FEC comes first */
+	cpu_eth_init(bis); /* Built in FEC comes first */
+	return pci_eth_init(bis);
 }
diff --git a/board/pm854/pm854.c b/board/pm854/pm854.c
index 7dbafb9..f366814 100644
--- a/board/pm854/pm854.c
+++ b/board/pm854/pm854.c
@@ -27,6 +27,7 @@
 
 #include <common.h>
 #include <pci.h>
+#include <netdev.h>
 #include <asm/processor.h>
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
@@ -289,3 +290,8 @@ pci_init_board(void)
 	pci_mpc85xx_init(&hose);
 #endif /* CONFIG_PCI */
 }
+
+int board_eth_init(bd_t *bis)
+{
+	return pci_eth_init(bis);
+}
diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c
index c8b4e98..2dcaa2c 100644
--- a/drivers/net/e1000.c
+++ b/drivers/net/e1000.c
@@ -3059,5 +3059,5 @@ e1000_initialize(bd_t * bis)
 
 		card_number++;
 	}
-	return 1;
+	return card_number;
 }
diff --git a/drivers/net/e1000.h b/drivers/net/e1000.h
index c258bc2..08042a8 100644
--- a/drivers/net/e1000.h
+++ b/drivers/net/e1000.h
@@ -36,6 +36,7 @@
 #include <common.h>
 #include <malloc.h>
 #include <net.h>
+#include <netdev.h>
 #include <asm/io.h>
 #include <pci.h>
 
diff --git a/include/netdev.h b/include/netdev.h
index 1013a80..fa4d92d 100644
--- a/include/netdev.h
+++ b/include/netdev.h
@@ -42,6 +42,7 @@ int cpu_eth_init(bd_t *bis);
 
 /* Driver initialization prototypes */
 int bfin_EMAC_initialize(bd_t *bis);
+int e1000_initialize(bd_t *bis);
 int eth_3com_initialize (bd_t * bis);
 int greth_initialize(bd_t *bis);
 void gt6426x_eth_initialize(bd_t *bis);
@@ -69,6 +70,9 @@ static inline int pci_eth_init(bd_t *bis)
 {
 	int num = 0;
 
+#ifdef CONFIG_E1000
+	num += e1000_initialize(bis);
+#endif
 #ifdef CONFIG_PCNET
 	num += pcnet_initialize(bis);
 #endif
diff --git a/net/eth.c b/net/eth.c
index 42c370b..f9a9957 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -41,7 +41,6 @@ int board_eth_init(bd_t *bis) __attribute((weak, alias("__def_eth_init")));
 
 extern int au1x00_enet_initialize(bd_t*);
 extern int dc21x4x_initialize(bd_t*);
-extern int e1000_initialize(bd_t*);
 extern int eepro100_initialize(bd_t*);
 extern int fec_initialize(bd_t*);
 extern int mpc8220_fec_initialize(bd_t*);
@@ -193,9 +192,6 @@ int eth_initialize(bd_t *bis)
 #if defined(CONFIG_IXP4XX_NPE)
 	npe_initialize(bis);
 #endif
-#ifdef CONFIG_E1000
-	e1000_initialize(bis);
-#endif
 #ifdef CONFIG_EEPRO100
 	eepro100_initialize(bis);
 #endif
-- 
1.5.4.3



More information about the U-Boot mailing list