
Stefan Roese wrote:
On Thursday 10 January 2008, Ben Warren wrote:
I'm not crazy about /net/eth.c calling board-specific ethernet initialization routines - it should be calling the driver initialization. This file is enough of a mess as it is, and adding a new entry for each board only makes it worse. Since there's precedent, though, consider this
Acked-by: Ben Warren biggerbadderben@gmail.com
In the next release (not the one finishing in a week), what do you think about this:
#if defined(CONFIG_BOARD_ETH_INIT) board_eth_initialize(bis) #endif
Or even better, using an empty baord_eth_initialize() function with the weak attribute. We get rid of this #ifdef this way.
Moving Ethernet initialization in general to the board (not just Atmel boards) would go a long way towards cleaning up the current mess and would provide more scalability and flexibility.
Thoughts?
How about if the board/platform code could add eth_init functions to a function-list. eth.c could then just call all functions in the list.
I was initially thinking about each board defining an array of Ethernet device structures, including device indices, PHY addresses, PHY info etc. that init code would step through. Something like this (made-up pseudo-code):
eth_devices eth_dev[] = { {
.type = TSEC; .index = 0; .phy = { .type = PHY_AUTO_DETECT; .address = 0x2 } }, { .type = TSEC; .index = 1; .phy = { .type = PHY_FIXED_1000_FULL; } }, { .type = ULI526x; /* PCI device */ }, NULL_DEVICE };
but a function list might be better. Something to think about for the next release.
regards, Ben