[ECOS] Re: How to get Ethernet link status?

Jay Foster jay@systech.com
Tue Dec 16 22:02:00 GMT 2008


I had to modify the ethernet driver to use the Generic PHY Package.  I made
it conditional on the presence of the Generic PHY Package
(CYGPKG_DEVS_ETH_PHY) so the driver could still be built without it.

Basically you will create a set of functions in your ethernet driver
(XXX_eth_phy_put_reg(), XXX_eth_phy_get_reg(), XXX_ETH_phy_noop()), and
instantiate a eth_phy_access_t object.  Then call _eth_phy_init() from your
ethernet driver initialization code someplace.  The calls to
_eth_phy_state() will then call the appropriate XXX_eth_phy_put_reg(),
XXX_eth_phy_get_reg() functions in your ethernet driver via the
eth_phy_access_t object.  Essentially, instead of the ethernet driver
accessing the PHY directly, it does so indirectly through the Generic PHY
API.  The code that actually talks with the PHY is still in the ethernet
driver, probably the same or very similar to what is there already.

It's a bit of work to do, so unless you have a compelling reason to, you
might not bother.  For me, I needed the ability to work with multiple PHYs
at run-time, depending on which one was installed, so it was worth it.

Jay

-----Original Message-----
From: Grant Edwards [mailto:grante@visi.com]
Sent: Tuesday, December 16, 2008 1:15 PM
To: ecos-discuss@sources.redhat.com
Subject: [ECOS] Re: How to get Ethernet link status?


On 2008-12-16, Jay Foster <jay@systech.com> wrote:

> I've done this by implementing my own function, which calls the
> _eth_phy_state() function from the Generic PHY Package.  Depending on
which
> drivers/packages are configured, my function might call the ethernet
driver
> specific function (PhyStatus() for example), or the _eth_phy_state()
> function when the Generic PHY Package is configured.

I'm a little confused as to how the generic phy package is
supposed to work.  On my board, access to the PHY is done via
registers in the Ethernet MAC (IOW, access to the PHY is only
available in the Ethernet driver).

> You're right that other than the Generic PHY Package, there is
> no generic way to do this, thus my own function that hides
> this from my application(s).

I guess I'll just have to create a global line status function
in my Ethernet drivers that application code can call.

-- 
Grant Edwards                   grante             Yow! Look!  A ladder!
                                  at               Maybe it leads to heaven,
                               visi.com            or a sandwich!


-- 
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



More information about the Ecos-discuss mailing list