All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] AMCC 405EX - EMAC0 + EMAC1 Problems
@ 2009-09-17 18:00 Jonathan Haws
  2009-09-17 18:18 ` Ben Warren
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jonathan Haws @ 2009-09-17 18:00 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] AMCC 405EX - EMAC0 + EMAC1 Problems
  2009-09-17 18:00 [U-Boot] AMCC 405EX - EMAC0 + EMAC1 Problems Jonathan Haws
@ 2009-09-17 18:18 ` Ben Warren
  2009-09-17 20:04 ` Wolfgang Denk
  2009-09-18  5:02 ` Stefan Roese
  2 siblings, 0 replies; 4+ messages in thread
From: Ben Warren @ 2009-09-17 18:18 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] AMCC 405EX - EMAC0 + EMAC1 Problems
  2009-09-17 18:00 [U-Boot] AMCC 405EX - EMAC0 + EMAC1 Problems Jonathan Haws
  2009-09-17 18:18 ` Ben Warren
@ 2009-09-17 20:04 ` Wolfgang Denk
  2009-09-18  5:02 ` Stefan Roese
  2 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Denk @ 2009-09-17 20:04 UTC (permalink / raw)
  To: u-boot

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

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
There are three ways to get something done:
        (1) Do it yourself.
        (2) Hire someone to do it for you.
        (3) Forbid your kids to do it.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] AMCC 405EX - EMAC0 + EMAC1 Problems
  2009-09-17 18:00 [U-Boot] AMCC 405EX - EMAC0 + EMAC1 Problems Jonathan Haws
  2009-09-17 18:18 ` Ben Warren
  2009-09-17 20:04 ` Wolfgang Denk
@ 2009-09-18  5:02 ` Stefan Roese
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Roese @ 2009-09-18  5:02 UTC (permalink / raw)
  To: u-boot

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 at denx.de

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-09-18  5:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-17 18:00 [U-Boot] AMCC 405EX - EMAC0 + EMAC1 Problems Jonathan Haws
2009-09-17 18:18 ` Ben Warren
2009-09-17 20:04 ` Wolfgang Denk
2009-09-18  5:02 ` Stefan Roese

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.