From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Roese Date: Wed, 11 Feb 2009 13:52:04 +0100 Subject: [U-Boot] [PATCH] ppc4xx: Fix problem with board_eth_init() vs cpu_eth_init() on AMCC boards In-Reply-To: <20090211121930.7F9B4832E893@gemini.denx.de> References: <1234342325-28950-1-git-send-email-sr@denx.de> <20090211121930.7F9B4832E893@gemini.denx.de> Message-ID: <200902111352.04598.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 On Wednesday 11 February 2009, Wolfgang Denk wrote: > > +++ b/board/amcc/katmai/katmai.c > > @@ -451,5 +451,11 @@ int post_hotkeys_pressed(void) > > > > int board_eth_init(bd_t *bis) > > { > > - return pci_eth_init(bis); > > + cpu_eth_init(bis); > > + pci_eth_init(bis); > > + > > + /* > > + * Return 0 so that cpu_eth_init() won't get executed again > > + */ > > + return 0; > > What happens in case of errors? This looks broken to me, or I > misinderstand the comment. This is the code calling board_eth_init() from net/eth.c: /* 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); So if we return with an error in board_eth_init(), cpu_eth_init() will get called again. Another way to fix this problem would be this implementation: board_eth_init() { pci_eth_init(bis); /* * Return -1 so that cpu_eth_init() will get executed in net/eth.c */ return -1; } But I like the former implementation better, since the cpu internal ethernet interfaces are added first to the network devices list. 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 =====================================================================