[U-Boot] [PATCH 12/17] Moved initialization of MPC512x_FEC Ethernet driver to CPU directory

Ben Warren biggerbadderben at gmail.com
Sun Aug 31 10:46:46 CEST 2008


Added a cpu_eth_init() function to MPC512x CPU directory and
removed code from net/eth.c

Signed-off-by: Ben Warren <biggerbadderben at gmail.com>
---
 cpu/mpc512x/cpu.c |   13 +++++++++++++
 cpu/mpc5xxx/cpu.c |   13 +++++++++++++
 include/netdev.h  |    2 ++
 net/eth.c         |    4 ----
 4 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/cpu/mpc512x/cpu.c b/cpu/mpc512x/cpu.c
index 1f39ac4..d432d99 100644
--- a/cpu/mpc512x/cpu.c
+++ b/cpu/mpc512x/cpu.c
@@ -30,6 +30,7 @@
 #include <common.h>
 #include <command.h>
 #include <mpc512x.h>
+#include <netdev.h>
 #include <asm/processor.h>
 
 #if defined(CONFIG_OF_LIBFDT)
@@ -195,3 +196,15 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 #endif
 }
 #endif
+
+#ifdef CONFIG_MPC512x_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 mpc512x_fec_initialize(bis);
+}
+#endif
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/include/netdev.h b/include/netdev.h
index 258248c..f6b6052 100644
--- a/include/netdev.h
+++ b/include/netdev.h
@@ -49,6 +49,8 @@ int inca_switch_initialize(bd_t *bis);
 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 93c18c5..4c7c912 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -45,7 +45,6 @@ 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 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 *);
@@ -177,9 +176,6 @@ int eth_initialize(bd_t *bis)
 #if defined(CONFIG_MPC5xxx_FEC)
 	mpc5xxx_fec_initialize(bis);
 #endif
-#if defined(CONFIG_MPC512x_FEC)
-	mpc512x_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