On Wed, 26 Mar 2008 12:43:50 +0100 Stefan Roese <[EMAIL PROTECTED]> wrote:
> On Wednesday 26 March 2008, Haavard Skinnemoen wrote: > > > Yes, same SoC ethernet interfaces. Currently PHY address etc is > > > configured via config options. > > > > Judging by the number of #ifdefs in ppc_4xx_eth_initialize, that > > function contains quite a bit of board-specific code. > > Most of it is not board-specific, but platform-specific. This driver handles > all 4xx EMAC variants and there are quite a lot. But basically you are > correct. Yeah, but the platform-specific bits are normal for a platform-specific driver. I just think that ideally, the board-specific bits should be split out and placed in board_eth_init() for each board. > > > > Can't you just add a weak definition of board_eth_init() in the CPU > > > > code then? > > > > > > No. The weak definition is already in net/eth.c. > > > > Make it non-weak then. > > In net/eth.c? It can't get overwritten then. I mean the cpu-specific one. The generic "fallback" function should stay weak. > > If a platform wants to implement board-specific > > ethernet init code as #ifdef hell, it should be free to do so. I don't > > think we should add workarounds in the generic code for such platforms > > though. > > I could use board_eth_init() as a common PPC4xx platform code. But I would > loose the chance being able to implement a "real" board specific > board_eth_init() for some boards in the future then. Yeah...it would be bad to prevent future boards from doing the right thing... How about you do an internal split in cpu/ppc4xx/4xx_enet.c first, placing the truly platform-specfic bits in a separate function that can be called by "new-style" boards, and the board-specific bits in board_eth_init(), serving as a wrapper around the platform-specific init function, with as many #ifdefs as needed in order to handle the existing differences between the boards. This function could be conditional on CONFIG_PPC4XX_LEGACY_BOARD_ETH_INIT or something so that boards can be migrated to the new API one by one. U-Boot could really use a Janitor team ;-) Haavard ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ U-Boot-Users mailing list U-Boot-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/u-boot-users