svn commit: r214927 - stable/7/sys/dev/mii
Marius Strobl
marius at FreeBSD.org
Sun Nov 7 17:41:10 UTC 2010
Author: marius
Date: Sun Nov 7 17:41:09 2010
New Revision: 214927
URL: http://svn.freebsd.org/changeset/base/214927
Log:
MFC: r214263
Take advantage of mii_phy_add_media()/mii_phy_setmedia().
Modified:
stable/7/sys/dev/mii/pnaphy.c
Directory Properties:
stable/7/sys/ (props changed)
stable/7/sys/cddl/contrib/opensolaris/ (props changed)
stable/7/sys/contrib/dev/acpica/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
Modified: stable/7/sys/dev/mii/pnaphy.c
==============================================================================
--- stable/7/sys/dev/mii/pnaphy.c Sun Nov 7 17:40:58 2010 (r214926)
+++ stable/7/sys/dev/mii/pnaphy.c Sun Nov 7 17:41:09 2010 (r214927)
@@ -102,7 +102,6 @@ pnaphy_attach(device_t dev)
struct mii_softc *sc;
struct mii_attach_args *ma;
struct mii_data *mii;
- const char *sep = "";
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
@@ -116,29 +115,16 @@ pnaphy_attach(device_t dev)
sc->mii_service = pnaphy_service;
sc->mii_pdata = mii;
- sc->mii_flags |= MIIF_NOISOLATE;
-
-#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
-#define PRINT(s) printf("%s%s", sep, s); sep = ", "
+ sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP | MIIF_IS_HPNA;
mii_phy_reset(sc);
sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
device_printf(dev, " ");
- if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0)
- printf("no media present");
- else {
- ADD(IFM_MAKEWORD(IFM_ETHER, IFM_HPNA_1, 0, sc->mii_inst), 0);
- PRINT("HomePNA");
- }
-
+ mii_phy_add_media(sc);
printf("\n");
-#undef ADD
-#undef PRINT
-
MIIBUS_MEDIAINIT(sc->mii_dev);
-
return (0);
}
@@ -159,17 +145,11 @@ pnaphy_service(struct mii_softc *sc, str
break;
switch (IFM_SUBTYPE(ife->ifm_media)) {
- case IFM_AUTO:
- case IFM_10_T:
- case IFM_100_TX:
- case IFM_100_T4:
- return (EINVAL);
+ case IFM_HPNA_1:
+ mii_phy_setmedia(sc);
+ break;
default:
- /*
- * BMCR data is stored in the ifmedia entry.
- */
- PHY_WRITE(sc, MII_ANAR, mii_anar(ife->ifm_media));
- PHY_WRITE(sc, MII_BMCR, ife->ifm_data);
+ return (EINVAL);
}
break;
@@ -182,7 +162,7 @@ pnaphy_service(struct mii_softc *sc, str
/* Update the media status. */
ukphy_status(sc);
if (IFM_SUBTYPE(mii->mii_media_active) == IFM_10_T)
- mii->mii_media_active = IFM_ETHER|IFM_HPNA_1;
+ mii->mii_media_active = IFM_ETHER | IFM_HPNA_1;
/* Callback if something changed. */
mii_phy_update(sc, cmd);
More information about the svn-src-stable-7
mailing list