summaryrefslogtreecommitdiff
path: root/sys/dev/mii/mtdphy.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/mii/mtdphy.c')
-rw-r--r--sys/dev/mii/mtdphy.c42
1 files changed, 7 insertions, 35 deletions
diff --git a/sys/dev/mii/mtdphy.c b/sys/dev/mii/mtdphy.c
index cff80b3d69e..67086f5d24c 100644
--- a/sys/dev/mii/mtdphy.c
+++ b/sys/dev/mii/mtdphy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mtdphy.c,v 1.3 1999/07/23 12:39:11 deraadt Exp $ */
+/* $OpenBSD: mtdphy.c,v 1.4 1999/12/07 22:01:31 jason Exp $ */
/*
* Copyright (c) 1998, 1999 Jason L. Wright (jason@thought.net)
@@ -95,20 +95,12 @@ mtdphyattach(parent, self, aux)
sc->mii_service = mtdphy_service;
sc->mii_pdata = mii;
- ifmedia_add(&mii->mii_media,
- IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst),
- BMCR_ISO, NULL);
- ifmedia_add(&mii->mii_media,
- IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst),
- BMCR_LOOP | BMCR_S100, NULL);
-
mii_phy_reset(sc);
sc->mii_capabilities =
PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
if (sc->mii_capabilities & BMSR_MEDIAMASK)
- mii_add_media(mii, sc->mii_capabilities,
- sc->mii_inst);
+ mii_add_media(sc);
}
int
@@ -152,32 +144,8 @@ mtdphy_service(sc, mii, cmd)
(void) mii_phy_auto(sc, 1);
break;
- case IFM_100_TX:
- PHY_WRITE(sc, MII_ANAR,
- mii_anar(ife->ifm_media));
-
- reg = BMCR_ISO | BMCR_S100;
- if ((ife->ifm_media & IFM_GMASK) == IFM_FDX)
- reg |= BMCR_FDX;
- PHY_WRITE(sc, MII_BMCR, reg);
- delay(75000);
-
- reg &= ~BMCR_ISO;
- PHY_WRITE(sc, MII_BMCR, reg);
- break;
-
- case IFM_100_T4:
- /*
- * Not supported by MTD972.
- */
- return (EINVAL);
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);
+ mii_phy_setmedia(sc);
}
break;
@@ -205,6 +173,10 @@ mtdphy_service(sc, mii, cmd)
* kicked; it continues in the background.
*/
break;
+
+ case MII_DOWN:
+ mii_phy_down(sc);
+ return (0);
}
/* Update the media status. */