[U-Boot] [PATCH v2 13/17] Moved initialization of MPC5xxx_FEC Ethernet driver to CPU directory

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


Modified board_eth_init() functions of boards that have this FEC in addition
to other Ethernet controllers.

Affected boards:
	bc3450
	icecube
	mvbc_p
	o2dnt
	pm520
	total5200
	tq5200

Removed initialization of controller from net/eth.c

Signed-off-by: Ben Warren <biggerbadderben at gmail.com>
---
 board/bc3450/bc3450.c               |    1 +
 board/icecube/icecube.c             |    1 +
 board/matrix_vision/mvbc_p/mvbc_p.c |    6 ++++++
 board/o2dnt/o2dnt.c                 |    1 +
 board/pm520/pm520.c                 |    1 +
 board/total5200/total5200.c         |    1 +
 board/tqc/tqm5200/tqm5200.c         |    1 +
 cpu/mpc5xxx/cpu.c                   |   13 +++++++++++++
 drivers/net/mpc5xxx_fec.c           |    1 +
 include/netdev.h                    |    1 +
 net/eth.c                           |    4 ----
 11 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/board/bc3450/bc3450.c b/board/bc3450/bc3450.c
index e27c234..7ddf74c 100644
--- a/board/bc3450/bc3450.c
+++ b/board/bc3450/bc3450.c
@@ -673,5 +673,6 @@ int board_get_height (void)
 
 int board_eth_init(bd_t *bis)
 {
+	cpu_eth_init(bis); /* Built in FEC comes first */
 	return pci_eth_init(bis);
 }
diff --git a/board/icecube/icecube.c b/board/icecube/icecube.c
index 2ab86be..d84ab3a 100644
--- a/board/icecube/icecube.c
+++ b/board/icecube/icecube.c
@@ -394,5 +394,6 @@ ft_board_setup(void *blob, bd_t *bd)
 
 int board_eth_init(bd_t *bis)
 {
+	cpu_eth_init(bis); /* Built in FEC comes first */
 	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 3332f5a..648b45e 100644
--- a/board/matrix_vision/mvbc_p/mvbc_p.c
+++ b/board/matrix_vision/mvbc_p/mvbc_p.c
@@ -35,6 +35,7 @@
 #include <fpga.h>
 #include <environment.h>
 #include <fdt_support.h>
+#include <netdev.h>
 #include <asm/io.h>
 #include "fpga.h"
 #include "mvbc_p.h"
@@ -324,3 +325,8 @@ void ft_board_setup(void *blob, bd_t *bd)
 	ft_cpu_setup(blob, bd);
 	fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
 }
+
+int board_eth_init(bd_t *bis)
+{
+	return cpu_eth_init(bis); /* Built in FEC comes first */
+}
diff --git a/board/o2dnt/o2dnt.c b/board/o2dnt/o2dnt.c
index 37832de..19faf52 100644
--- a/board/o2dnt/o2dnt.c
+++ b/board/o2dnt/o2dnt.c
@@ -184,5 +184,6 @@ void pci_init_board(void)
 
 int board_eth_init(bd_t *bis)
 {
+	cpu_eth_init(bis); /* Built in FEC comes first */
 	return pci_eth_init(bis);
 }
diff --git a/board/pm520/pm520.c b/board/pm520/pm520.c
index c9610fb..a9d63cc 100644
--- a/board/pm520/pm520.c
+++ b/board/pm520/pm520.c
@@ -325,5 +325,6 @@ void doc_init (void)
 
 int board_eth_init(bd_t *bis)
 {
+	cpu_eth_init(bis); /* Built in FEC comes first */
 	return pci_eth_init(bis);
 }
diff --git a/board/total5200/total5200.c b/board/total5200/total5200.c
index c1848fc..ec00a67 100644
--- a/board/total5200/total5200.c
+++ b/board/total5200/total5200.c
@@ -312,5 +312,6 @@ int board_get_height (void)
 
 int board_eth_init(bd_t *bis)
 {
+	cpu_eth_init(bis); /* Built in FEC comes first */
 	return pci_eth_init(bis);
 }
diff --git a/board/tqc/tqm5200/tqm5200.c b/board/tqc/tqm5200/tqm5200.c
index d75aa9b..5152331 100644
--- a/board/tqc/tqm5200/tqm5200.c
+++ b/board/tqc/tqm5200/tqm5200.c
@@ -753,5 +753,6 @@ void ft_board_setup(void *blob, bd_t *bd)
 
 int board_eth_init(bd_t *bis)
 {
+	cpu_eth_init(bis); /* Built in FEC comes first */
 	return pci_eth_init(bis);
 }
diff --git a/cpu/mpc5xxx/cpu.c b/cpu/mpc5xxx/cpu.c
index 0ed2899..1326c3c 100644
--- a/cpu/mpc5xxx/cpu.c
+++ b/cpu/mpc5xxx/cpu.c
@@ -29,6 +29,7 @@
 #include <watchdog.h>
 #include <command.h>
 #include <mpc5xxx.h>
+#include <netdev.h>
 #include <asm/io.h>
 #include <asm/processor.h>
 
@@ -155,3 +156,15 @@ ulong bootcount_load (void)
 		return (*save_addr & 0x0000ffff);
 }
 #endif /* CONFIG_BOOTCOUNT_LIMIT */
+
+#ifdef CONFIG_MPC5xxx_FEC
+/* Default initializations for FEC controllers.  To override,
+ * create a board-specific function called:
+ * 	int board_eth_init(bd_t *bis)
+ */
+
+int cpu_eth_init(bd_t *bis)
+{
+	return mpc5xxx_fec_initialize(bis);
+}
+#endif
diff --git a/drivers/net/mpc5xxx_fec.c b/drivers/net/mpc5xxx_fec.c
index 3d3eb8b..f8618b1 100644
--- a/drivers/net/mpc5xxx_fec.c
+++ b/drivers/net/mpc5xxx_fec.c
@@ -11,6 +11,7 @@
 #include <mpc5xxx_sdma.h>
 #include <malloc.h>
 #include <net.h>
+#include <netdev.h>
 #include <miiphy.h>
 #include "mpc5xxx_fec.h"
 
diff --git a/include/netdev.h b/include/netdev.h
index 487d319..f7738cc 100644
--- a/include/netdev.h
+++ b/include/netdev.h
@@ -50,6 +50,7 @@ int macb_eth_initialize(int id, void *regs, unsigned int phy_addr);
 int mcdmafec_initialize(bd_t *bis);
 int mcffec_initialize(bd_t *bis);
 int mpc512x_fec_initialize(bd_t *bis);
+int mpc5xxx_fec_initialize(bd_t *bis);
 int natsemi_initialize(bd_t *bis);
 int ns8382x_initialize(bd_t *bis);
 int pcnet_initialize(bd_t *bis);
diff --git a/net/eth.c b/net/eth.c
index b61d0fc..053179e 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -44,7 +44,6 @@ 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 mpc5xxx_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 *);
@@ -173,9 +172,6 @@ int eth_initialize(bd_t *bis)
 #ifdef SCC_ENET
 	scc_initialize(bis);
 #endif
-#if defined(CONFIG_MPC5xxx_FEC)
-	mpc5xxx_fec_initialize(bis);
-#endif
 #if defined(CONFIG_MPC8220_FEC)
 	mpc8220_fec_initialize(bis);
 #endif
-- 
1.5.4.3



More information about the U-Boot mailing list