[U-Boot] [PATCH 3/3] net: switch device init to initcall

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Sat May 23 17:08:45 CEST 2009


apply to at91sam9263ek

this will result to reduce the size of 2212 bytes

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
 board/atmel/at91sam9263ek/at91sam9263ek.c |   12 ++++++------
 include/netdev.h                          |   12 ------------
 net/eth.c                                 |   16 ----------------
 3 files changed, 6 insertions(+), 34 deletions(-)

diff --git a/board/atmel/at91sam9263ek/at91sam9263ek.c b/board/atmel/at91sam9263ek/at91sam9263ek.c
index 57d5c95..54b0f59 100644
--- a/board/atmel/at91sam9263ek/at91sam9263ek.c
+++ b/board/atmel/at91sam9263ek/at91sam9263ek.c
@@ -23,6 +23,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/sizes.h>
 #include <asm/arch/at91sam9263.h>
 #include <asm/arch/at91sam9263_matrix.h>
@@ -272,11 +273,10 @@ void reset_phy(void)
 }
 #endif
 
-int board_eth_init(bd_t *bis)
-{
-	int rc = 0;
 #ifdef CONFIG_MACB
-	rc = macb_eth_initialize(0, (void *)AT91SAM9263_BASE_EMAC, 0x00);
-#endif
-	return rc;
+static int at91sam9263ek_eth_init(bd_t *bis)
+{
+	return macb_eth_initialize(0, (void *)AT91SAM9263_BASE_EMAC, 0x00);
 }
+__initcall(at91sam9263ek_eth_init);
+#endif
diff --git a/include/netdev.h b/include/netdev.h
index 63cf730..9860c99 100644
--- a/include/netdev.h
+++ b/include/netdev.h
@@ -28,18 +28,6 @@
 #ifndef _NETDEV_H_
 #define _NETDEV_H_
 
-/*
- * Board and CPU-specific initialization functions
- * board_eth_init() has highest priority.  cpu_eth_init() only
- * gets called if board_eth_init() isn't instantiated or fails.
- * Return values:
- *      0: success
- *     -1: failure
- */
-
-int board_eth_init(bd_t *bis);
-int cpu_eth_init(bd_t *bis);
-
 /* Driver initialization prototypes */
 int au1x00_enet_initialize(bd_t*);
 int bfin_EMAC_initialize(bd_t *bis);
diff --git a/net/eth.c b/net/eth.c
index 8940ebf..2904180 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -56,18 +56,6 @@ int eth_setenv_enetaddr(char *name, const uchar *enetaddr)
 #endif
 
 #if defined(CONFIG_CMD_NET) && defined(CONFIG_NET_MULTI)
-
-/*
- * CPU and board-specific Ethernet initializations.  Aliased function
- * signals caller to move on
- */
-static int __def_eth_init(bd_t *bis)
-{
-	return -1;
-}
-int cpu_eth_init(bd_t *bis) __attribute__((weak, alias("__def_eth_init")));
-int board_eth_init(bd_t *bis) __attribute__((weak, alias("__def_eth_init")));
-
 extern int mv6436x_eth_initialize(bd_t *);
 extern int mv6446x_eth_initialize(bd_t *);
 
@@ -191,10 +179,6 @@ int eth_initialize(bd_t *bis)
 #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
 	miiphy_init();
 #endif
-	/* Try board-specific initialization first.  If it fails or isn't
-	 * present, try the cpu-specific initialization */
-	if (board_eth_init(bis) < 0)
-		cpu_eth_init(bis);
 
 #if defined(CONFIG_DB64360) || defined(CONFIG_CPCI750)
 	mv6436x_eth_initialize(bis);
-- 
1.6.3.1



More information about the U-Boot mailing list