summaryrefslogtreecommitdiffstats
path: root/sys/dev/mii
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2010-10-24 11:37:01 +0000
committermarius <marius@FreeBSD.org>2010-10-24 11:37:01 +0000
commit9139a02a2a9fd1e7b3c8694569ee3a9f3405cde9 (patch)
tree6e89f235eb785d8c31b7ddb66bc5048a689eac52 /sys/dev/mii
parent0f77c58470dc7e0fdeb301ea9f373dbcd72cf15d (diff)
downloadFreeBSD-src-9139a02a2a9fd1e7b3c8694569ee3a9f3405cde9.zip
FreeBSD-src-9139a02a2a9fd1e7b3c8694569ee3a9f3405cde9.tar.gz
- Take advantage of mii_phy_dev_probe().
- Use mii_phy_add_media() instead of mii_add_media(). I'm not sure how this driver actually managed to work before as mii_add_media() is intended to be used to gether with mii_anar() while mii_phy_add_media() is intended to be used with mii_phy_setmedia(), however this driver mii_add_media() along with mii_phy_setmedia().
Diffstat (limited to 'sys/dev/mii')
-rw-r--r--sys/dev/mii/smcphy.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/sys/dev/mii/smcphy.c b/sys/dev/mii/smcphy.c
index f356fdb..f442858 100644
--- a/sys/dev/mii/smcphy.c
+++ b/sys/dev/mii/smcphy.c
@@ -76,20 +76,16 @@ static driver_t smcphy_driver = {
DRIVER_MODULE(smcphy, miibus, smcphy_driver, smcphy_devclass, 0, 0);
+static const struct mii_phydesc smcphys[] = {
+ MII_PHY_DESC(SMSC, LAN83C183),
+ MII_PHY_END
+};
+
static int
smcphy_probe(device_t dev)
{
- struct mii_attach_args *ma;
-
- ma = device_get_ivars(dev);
-
- if (MII_OUI(ma->mii_id1, ma->mii_id2) != MII_OUI_SMSC ||
- MII_MODEL(ma->mii_id2) != MII_MODEL_SMSC_LAN83C183)
- return (ENXIO);
- device_set_desc(dev, MII_STR_SMSC_LAN83C183);
-
- return (0);
+ return (mii_phy_dev_probe(dev, smcphys, BUS_PROBE_DEFAULT));
}
static int
@@ -111,7 +107,7 @@ smcphy_attach(device_t dev)
sc->mii_service = smcphy_service;
sc->mii_pdata = mii;
- sc->mii_flags |= MIIF_NOISOLATE;
+ sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP;
if (smcphy_reset(sc) != 0) {
device_printf(dev, "reset failed\n");
@@ -122,7 +118,7 @@ smcphy_attach(device_t dev)
sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
device_printf(dev, " ");
- mii_add_media(sc);
+ mii_phy_add_media(sc);
printf("\n");
MIIBUS_MEDIAINIT(sc->mii_dev);
OpenPOWER on IntegriCloud