public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Ethernet PHY board specific configuration
@ 2011-02-28 11:37 Martin Laabs
  2011-03-01 10:37 ` Christophe Coutand
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Laabs @ 2011-02-28 11:37 UTC (permalink / raw)
  To: ecos-discuss

Hello,

my eCos port to the AT91SAM9 family is mostly done. Now I want to configure 
the ethernet phy after it is recognized by ecos and before the MAC begins 
transmitting data. The cause is to configure the auto-negotiation mode and 
LED settings.
As far as I know there is no such macro or callback defined yet. Is this 
correct and where should I add such a macro?

Thank you,
  Martin Laabs


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

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

* RE: [ECOS] Ethernet PHY board specific configuration
  2011-02-28 11:37 [ECOS] Ethernet PHY board specific configuration Martin Laabs
@ 2011-03-01 10:37 ` Christophe Coutand
  2011-03-01 12:29   ` Martin Laabs
  0 siblings, 1 reply; 4+ messages in thread
From: Christophe Coutand @ 2011-03-01 10:37 UTC (permalink / raw)
  To: eCos Discuss

My experience is that the PHY API of eCos only let you retrieve the PHY
state (Link Mode) using _eth_phy_state() which you can further use for
setting your MAC layer. If you should handle any specific link
configuration or act on link mode change (from interrupt), you must
write you own configuration function. _eth_phy_cfg seems to be a generic
function which should be propagated to _eth_phy_dev_entry to have more
flexibility.

Christophe

-----Original Message-----
From: ecos-discuss-owner@ecos.sourceware.org
[mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Martin
Laabs
Sent: 28. februar 2011 12:37
To: ecos-discuss@ecos.sourceware.org
Subject: [ECOS] Ethernet PHY board specific configuration

Hello,

my eCos port to the AT91SAM9 family is mostly done. Now I want to
configure 
the ethernet phy after it is recognized by ecos and before the MAC
begins 
transmitting data. The cause is to configure the auto-negotiation mode
and 
LED settings.
As far as I know there is no such macro or callback defined yet. Is this

correct and where should I add such a macro?

Thank you,
  Martin Laabs


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

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

* Re: [ECOS] Ethernet PHY board specific configuration
  2011-03-01 10:37 ` Christophe Coutand
@ 2011-03-01 12:29   ` Martin Laabs
  2011-03-01 13:47     ` Christophe Coutand
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Laabs @ 2011-03-01 12:29 UTC (permalink / raw)
  To: ecos-discuss

Hello Christophe,


On 03/01/11 11:36, Christophe Coutand wrote:
> My experience is that the PHY API of eCos only let you retrieve the PHY
> state (Link Mode) using _eth_phy_state() which you can further use for
> setting your MAC layer. If you should handle any specific link
> configuration or act on link mode change (from interrupt), you must
> write you own configuration function. _eth_phy_cfg seems to be a generic
> function which should be propagated to _eth_phy_dev_entry to have more
> flexibility.

Thank you for this information. I already thought I have to change the 
_eth_phy_dev entry. However it will be somewhat tricky to implement a real 
callback to the board specific code.

Thank you,
  Martin L.


>
> Christophe
>
> -----Original Message-----
> From: ecos-discuss-owner@ecos.sourceware.org
> [mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Martin
> Laabs
> Sent: 28. februar 2011 12:37
> To: ecos-discuss@ecos.sourceware.org
> Subject: [ECOS] Ethernet PHY board specific configuration
>
> Hello,
>
> my eCos port to the AT91SAM9 family is mostly done. Now I want to
> configure
> the ethernet phy after it is recognized by ecos and before the MAC
> begins
> transmitting data. The cause is to configure the auto-negotiation mode
> and
> LED settings.
> As far as I know there is no such macro or callback defined yet. Is this
>
> correct and where should I add such a macro?
>
> Thank you,
>    Martin Laabs
>
>


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

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

* RE: [ECOS] Ethernet PHY board specific configuration
  2011-03-01 12:29   ` Martin Laabs
@ 2011-03-01 13:47     ` Christophe Coutand
  0 siblings, 0 replies; 4+ messages in thread
From: Christophe Coutand @ 2011-03-01 13:47 UTC (permalink / raw)
  To: uni, ecos-discuss

Hi Martin,

I am misunderstanding your requirements. Why do you need a callback
function and to where?

To me, the current eCos flow is as following:

	1. Ethernet driver initialization: eth_drv_funs.(*init)(struct
eth_drv_sc *sc, unsigned char *enaddr) 
	2. In the eth init function, call _eth_phy_init() which will
initialize the PHY interface and probe for matching PHY id.
	3. In the eth init function, call _eth_phy_state() which will
report the current link state
	4. Configure the MAC according to the link state

In this case there is no need for callback function. This flow only
works well for auto-negotiated link.

If I would require to configure the PHY for different link mode or board
specific configuration, I would just add a new field to the PHY entry:

struct _eth_phy_dev_entry {
    char          *name;
    unsigned long  id;
    bool         (*stat)(eth_phy_access_t *f, int *stat);
    bool         (*cfg)(eth_phy_access_t *f, int mode);
} CYG_HAL_TABLE_TYPE;

The declaration of the PHY would require to be extended with the new
field.

_eth_phy_dev("IC+ IP101A", 0x02430c54, ip101a_stat, my_ip101a_cfg)

Finally you can update _eth_phy_cfg to call the PHY specific
configuration routine. my_ip101a_cfg can be a generic routing (part of
the PHY file) for the particular PHY (for setting link mode) our could
be board specific if you require to configure some additional registers
( clock alignment, LEDs etc. ).

externC int
_eth_phy_cfg(eth_phy_access_t *f, int mode)
{

 if(f->dev->cfg)
   return (f->dev-> cfg)(f, mode)

...

In the previous flow, I would replace #3 with _eth_phy_cfg which also
return the state of the link. Not a perfect solution but should work
fine.

Christophe



-----Original Message-----
From: ecos-discuss-owner@ecos.sourceware.org
[mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Martin
Laabs
Sent: 1. mars 2011 13:29
To: ecos-discuss@ecos.sourceware.org
Subject: Re: [ECOS] Ethernet PHY board specific configuration

Hello Christophe,


On 03/01/11 11:36, Christophe Coutand wrote:
> My experience is that the PHY API of eCos only let you retrieve the
PHY
> state (Link Mode) using _eth_phy_state() which you can further use for
> setting your MAC layer. If you should handle any specific link
> configuration or act on link mode change (from interrupt), you must
> write you own configuration function. _eth_phy_cfg seems to be a
generic
> function which should be propagated to _eth_phy_dev_entry to have more
> flexibility.

Thank you for this information. I already thought I have to change the 
_eth_phy_dev entry. However it will be somewhat tricky to implement a
real 
callback to the board specific code.

Thank you,
  Martin L.


>
> Christophe
>
> -----Original Message-----
> From: ecos-discuss-owner@ecos.sourceware.org
> [mailto:ecos-discuss-owner@ecos.sourceware.org] On Behalf Of Martin
> Laabs
> Sent: 28. februar 2011 12:37
> To: ecos-discuss@ecos.sourceware.org
> Subject: [ECOS] Ethernet PHY board specific configuration
>
> Hello,
>
> my eCos port to the AT91SAM9 family is mostly done. Now I want to
> configure
> the ethernet phy after it is recognized by ecos and before the MAC
> begins
> transmitting data. The cause is to configure the auto-negotiation mode
> and
> LED settings.
> As far as I know there is no such macro or callback defined yet. Is
this
>
> correct and where should I add such a macro?
>
> Thank you,
>    Martin Laabs
>
>


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

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

end of thread, other threads:[~2011-03-01 13:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-28 11:37 [ECOS] Ethernet PHY board specific configuration Martin Laabs
2011-03-01 10:37 ` Christophe Coutand
2011-03-01 12:29   ` Martin Laabs
2011-03-01 13:47     ` Christophe Coutand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).