diff options
author | marius <marius@FreeBSD.org> | 2010-10-15 14:52:11 +0000 |
---|---|---|
committer | marius <marius@FreeBSD.org> | 2010-10-15 14:52:11 +0000 |
commit | 385153aa98ec9bc0cd0bde471d7b89b6f7304427 (patch) | |
tree | 6dd0ca5b178547c1f20c8ce1f607ac42d4afe2ae /sys/dev/mii/lxtphy.c | |
parent | 27659e5aa689e80a32d089f84ed2637bb3ce140d (diff) | |
download | FreeBSD-src-385153aa98ec9bc0cd0bde471d7b89b6f7304427.zip FreeBSD-src-385153aa98ec9bc0cd0bde471d7b89b6f7304427.tar.gz |
Convert the PHY drivers to honor the mii_flags passed down and convert
the NIC drivers as well as the PHY drivers to take advantage of the
mii_attach() introduced in r213878 to get rid of certain hacks. For
the most part these were:
- Artificially limiting miibus_{read,write}reg methods to certain PHY
addresses; we now let mii_attach() only probe the PHY at the desired
address(es) instead.
- PHY drivers setting MIIF_* flags based on the NIC driver they hang
off from, partly even based on grabbing and using the softc of the
parent; we now pass these flags down from the NIC to the PHY drivers
via mii_attach(). This got us rid of all such hacks except those of
brgphy() in combination with bce(4) and bge(4), which is way beyond
what can be expressed with simple flags.
While at it, I took the opportunity to change the NIC drivers to pass
up the error returned by mii_attach() (previously by mii_phy_probe())
and unify the error message used in this case where and as appropriate
as mii_attach() actually can fail for a number of reasons, not just
because of no PHY(s) being present at the expected address(es).
Reviewed by: jhb, yongari
Diffstat (limited to 'sys/dev/mii/lxtphy.c')
-rw-r--r-- | sys/dev/mii/lxtphy.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/sys/dev/mii/lxtphy.c b/sys/dev/mii/lxtphy.c index fc12ee6..44b40ff 100644 --- a/sys/dev/mii/lxtphy.c +++ b/sys/dev/mii/lxtphy.c @@ -127,7 +127,6 @@ lxtphy_attach(device_t dev) struct mii_softc *sc; struct mii_attach_args *ma; struct mii_data *mii; - const char *nic; sc = device_get_softc(dev); ma = device_get_ivars(dev); @@ -135,6 +134,7 @@ lxtphy_attach(device_t dev) mii = ma->mii_data; LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + sc->mii_flags = miibus_get_flags(dev); sc->mii_inst = mii->mii_instance++; sc->mii_phy = ma->mii_phyno; sc->mii_service = lxtphy_service; @@ -145,15 +145,6 @@ lxtphy_attach(device_t dev) sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; device_printf(dev, " "); - /* - * On Apple BMAC controllers, we end up in a weird state - * of partially-completed autonegotiation on boot. So - * force autonegotation to try again. - */ - nic = device_get_name(device_get_parent(sc->mii_dev)); - if (strcmp(nic, "bm") == 0) - sc->mii_flags |= MIIF_FORCEANEG | MIIF_NOISOLATE; - #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_FX, 0, sc->mii_inst), MII_MEDIA_100_TX); |