[ECOS] Generic PHY Driver Changes

Jay Foster jay@systech.com
Fri Jun 23 00:32:00 GMT 2006

I'm developing a new ethernet driver for an MCU that has two ethernet
interfaces.  I would like to use the generic PHY driver, but have
encountered the following problem:

The two ethernet interfaces on the MCU share common MDC and MDIO signals, so
both PHYs are on the same MII bus.  The _eth_phy_init() function simply
scans each possible MII address (0 through 31) attempting to find a PHY
driver.  It will find the same PHY for both ethernet interfaces.  There
currently is no way to specify which PHY is associated with which ethernet

Some possible solutions (for discussion) are:

1) Set the initial phy_addr member of the eth_phy_access_t object passed to
_eth_phy_init() to indicate that _eth_phy_init() should only try that MII
address.  One approach would be to logically OR the phy_addr value with a
special flag bit (0x20 for example).  The _eth_phy_init() routine could
detect this, since the resulting phy_addr value would be invalid, and just
look for the PHY at that address (after removing the flag bit of course).

2) Add an additional parameter to the _eth_phy_init() function.  Perhaps a
'flags' parameter.  A flag could be defined that indicates to only look for
the PHY at the address specified by the initial phy_addr value in the
eth_phy_access_t object.  The flags parameter could be expanded in the
future to have other uses too.

Any thoughts?


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