From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Roese Date: Tue, 10 Jun 2008 11:12:00 +0200 Subject: [U-Boot-Users] [PATCH] Add mechanisms for CPU and board-specific Ethernet initialization In-Reply-To: <1213086567-29194-1-git-send-email-biggerbadderben@gmail.com> References: <> <1213086567-29194-1-git-send-email-biggerbadderben@gmail.com> Message-ID: <200806101112.00887.sr@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Ben, On Tuesday 10 June 2008, Ben Warren wrote: > This patch is the first step in cleaning up net/eth.c, by moving Ethernet > initialization to CPU or board-specific code. Initial implementation is > only on the Freescale TSEC controller, but others will be added soon. Great, thanks. > diff --git a/net/eth.c b/net/eth.c > index c4f24c6..e75dc43 100644 > --- a/net/eth.c > +++ b/net/eth.c > @@ -28,6 +28,12 @@ > > #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"))); + > #ifdef CFG_GT_6426x > extern int gt6426x_eth_initialize(bd_t *bis); > #endif > @@ -165,6 +171,10 @@ int eth_initialize(bd_t *bis) > #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) > miiphy_init(); > #endif > + /* Try CPU-specific initialization first. If it fails or isn't > + * present, call the board-specific initialization */ > + if (cpu_eth_init(bis) < 0 ) Nitpicking: No space before ")" please. > + board_eth_init(bis); Shouldn't this be the other way around? + if (board_eth_init(bis) < 0) + eth_eth_init(bis); So that the board init routine can "overwrite" the cpu init version. Best regards, Stefan ===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office@denx.de =====================================================================