[U-Boot] AMCC 405EX - EMAC0 + EMAC1 Problems

All,
I am having issues getting EMAC1 working alongside EMAC0. We need both EMACs running at the same time in U-Boot (U-Boot handles the PHY configuration, since the VxWorks implementation of PHY initialization is buggy).
What I have done is this:
In net/eth.c I have modified the eth_init(bd_t *bis) function to simply initialize both EMACs (line 443). We use EMAC0 by default, so I set eth_current back to EMAC0 when I am finished and return 0 on success. Here is what the function looks like right now: (I know I can clean this up better, but I am looking for a first cut solution that works. When I have it working, I will clean up the code.)
int eth_init(bd_t *bis) { struct eth_device* old_current;
if (!eth_current) { puts ("No ethernet found.\n"); return -1; }
old_current = eth_current; do { debug ("Trying %s\n", eth_current->name);
if (eth_current->init(eth_current,bis) < 0) { debug ("FAIL\n"); eth_try_another(0); return -1; } eth_current->state = ETH_STATE_ACTIVE; eth_try_another(0);
debug ("Trying %s\n", eth_current->name); if (eth_current->init(eth_current,bis) < 0) { debug ("FAIL\n"); eth_try_another(0); return -1; } eth_current->state = ETH_STATE_ACTIVE;
eth_current = old_current; return 0; } while (old_current != eth_current);
return -1; }
What happens is this, when I boot via TFTP, both EMACs and PHYs get initialized, but the system hangs as soon as it starts the protocol's request (ping, tftp, etc.).
It seems that I am missing something somewhere - I am overwriting some configuration that I should not be or something of that sort. But shouldn't the EMAC data structure be separated to the point where I should be able to initialize them individually without causing problems?
Thanks for any insight!
Jonathan

Hi Jonathan ,
Jonathan Haws wrote:
All,
I am having issues getting EMAC1 working alongside EMAC0. We need both EMACs running at the same time in U-Boot (U-Boot handles the PHY configuration, since the VxWorks implementation of PHY initialization is buggy).
What I have done is this:
In net/eth.c I have modified the eth_init(bd_t *bis) function to simply initialize both EMACs (line 443). We use EMAC0 by default, so I set eth_current back to EMAC0 when I am finished and return 0 on success. Here is what the function looks like right now: (I know I can clean this up better, but I am looking for a first cut solution that works. When I have it working, I will clean up the code.)
Instead of modifying net/eth.c, I recommend creating a board_eth_init() function. Something like this should do:
int board_eth_init(bd_t *bis) { struct eth_device *dev; cpu_eth_init(bis); /* Initialize both EMACs */ dev = eth_get_dev_by_index(1); dev->init(dev, bis); /* Initialize EMAC1 */ return 0; }
This way you don't have to monkey around with any of the current/prime stuff. Of course, we would never allow this sort of thing to be submitted to mainline because you're not allowed to touch hardware that doesn't get used, but what you do in your private code is your business.
regards, Ben

Dear Jonathan Haws,
In message BB99A6BA28709744BF22A68E6D7EB51F0324BBB96D@midas.usurf.usu.edu you wrote:
I am having issues getting EMAC1 working alongside EMAC0. We need both EMACs running at the same time in U-Boot (U-Boot handles the PHY configuration, since the VxWorks implementation of PHY initialization is buggy).
Hm... Note that such code will probably not go into mainline. The principle in U-Boot is not to initialize any devices that are not used by U-Boot itself, so unless you use a network related command in U-Boot, none of the Ethenret interfaces shall be initialized; and U-Boot never uses more than one at a time in any case.
What I have done is this:
In net/eth.c I have modified the eth_init(bd_t *bis) function to simply initialize both EMACs (line 443). We use EMAC0 by default, so I set eth_current back to EMAC0 when I am finished and return 0 on success. Here is what the function looks like right now: (I know I can clean this up better, but I am looking for a first cut solution that works. When I have it working, I will clean up the code.)
NAK. This will not go into mainline.
Best regards,
Wolfgang Denk

Hi Jonathan,
On Thursday 17 September 2009 20:00:42 Jonathan Haws wrote:
I am having issues getting EMAC1 working alongside EMAC0. We need both EMACs running at the same time in U-Boot (U-Boot handles the PHY configuration, since the VxWorks implementation of PHY initialization is buggy).
If the VxWorks PHY init is "buggy", then you should probably fix this VxWorks code.
Cheers, 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
participants (4)
-
Ben Warren
-
Jonathan Haws
-
Stefan Roese
-
Wolfgang Denk