From e3090534d62045dcb73f5392bacc64a4e8e443dc Mon Sep 17 00:00:00 2001
From: Ben Warren <biggerbadderben@gmail.com>
Date: Sun, 31 Aug 2008 10:08:43 -0700
Subject: [PATCH] Moved initialization of PCNET Ethernet controller to
 board_eth_init()

Affected boards:
	PN62
	sc520_cdp

Removed initialization of the driver from net/eth.c

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
---
 board/pn62/pn62.c           | 6 ++++++
 board/sc520_cdp/sc520_cdp.c | 6 ++++++
 drivers/net/pcnet.c         | 1 +
 include/netdev.h            | 5 +++++
 net/eth.c                   | 4 ----
 5 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/board/pn62/pn62.c b/board/pn62/pn62.c
index d905b2965c..60fc431db5 100644
--- a/board/pn62/pn62.c
+++ b/board/pn62/pn62.c
@@ -23,6 +23,7 @@
 #include <common.h>
 #include <mpc824x.h>
 #include <pci.h>
+#include <netdev.h>
 
 #include "pn62.h"
 
@@ -186,3 +187,8 @@ static int get_mac_address (int id, u8 * mac, char *string, int size)
 				mac[0], mac[1], mac[2],
 				mac[3], mac[4], mac[5]);
 }
+
+int board_eth_init(bd_t *bis)
+{
+	return pci_eth_init(bis);
+}
diff --git a/board/sc520_cdp/sc520_cdp.c b/board/sc520_cdp/sc520_cdp.c
index 8050aa6fee..f21c73002f 100644
--- a/board/sc520_cdp/sc520_cdp.c
+++ b/board/sc520_cdp/sc520_cdp.c
@@ -29,6 +29,7 @@
 #include <asm/ic/sc520.h>
 #include <asm/ic/ali512x.h>
 #include <spi.h>
+#include <netdev.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -629,3 +630,8 @@ ssize_t spi_write(uchar *addr, int alen, uchar *buffer, int len)
 #endif
 	return res;
 }
+
+int board_eth_init(bd_t *bis)
+{
+	return pci_eth_init(bis);
+}
diff --git a/drivers/net/pcnet.c b/drivers/net/pcnet.c
index a4f0214106..99b69429e9 100644
--- a/drivers/net/pcnet.c
+++ b/drivers/net/pcnet.c
@@ -26,6 +26,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 c5b0815e04..b1dadd84b3 100644
--- a/include/netdev.h
+++ b/include/netdev.h
@@ -48,6 +48,7 @@ int mcdmafec_initialize(bd_t *bis);
 int mcffec_initialize(bd_t *bis);
 int natsemi_initialize(bd_t *bis);
 int ns8382x_initialize(bd_t *bis);
+int pcnet_initialize(bd_t *bis);
 int rtl8139_initialize(bd_t *bis);
 int rtl8169_initialize(bd_t *bis);
 int skge_initialize(bd_t *bis);
@@ -61,6 +62,10 @@ int uli526x_initialize(bd_t *bis);
 static inline int pci_eth_init(bd_t *bis)
 {
 	int num = 0;
+
+#ifdef CONFIG_PCNET
+	num += pcnet_initialize(bis);
+#endif
 #ifdef CONFIG_NATSEMI
 	num += natsemi_initialize(bis);
 #endif
diff --git a/net/eth.c b/net/eth.c
index dc7b288a66..aa6b2c8c2a 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -55,7 +55,6 @@ extern int mpc512x_fec_initialize(bd_t*);
 extern int mpc8220_fec_initialize(bd_t*);
 extern int mv6436x_eth_initialize(bd_t *);
 extern int mv6446x_eth_initialize(bd_t *);
-extern int pcnet_initialize(bd_t*);
 extern int plb2800_eth_initialize(bd_t*);
 extern int ppc_4xx_eth_initialize(bd_t *);
 extern int scc_initialize(bd_t*);
@@ -227,9 +226,6 @@ int eth_initialize(bd_t *bis)
 #ifdef CONFIG_3COM
 	eth_3com_initialize(bis);
 #endif
-#ifdef CONFIG_PCNET
-	pcnet_initialize(bis);
-#endif
 #ifdef CFG_GT_6426x
 	gt6426x_eth_initialize(bis);
 #endif
-- 
2.39.5