summaryrefslogtreecommitdiff
path: root/sys/dev/mii/exphy.c
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>1999-12-07 22:01:34 +0000
committerJason Wright <jason@cvs.openbsd.org>1999-12-07 22:01:34 +0000
commit90108b38f19fc6ca669c2296a3d74500d8818a39 (patch)
tree675bda7203b288a18e60016c22f6e3e78ac90114 /sys/dev/mii/exphy.c
parent703694a5279961334bfedfce9c01810442e3cd2f (diff)
Merge with NetBSD:
o move common support functions for phy drivers from mii.c to mii_physubr.c, so that they are not includes if no PHY is configured o Clean up the code that adds media a little, and make media selection table-driven in preparation for some other changes to be made. o Don't add any loopback versions of media, for now. o Add mii_down(), which is used by MAC drivers to inform PHYs that the interface is now down. PHYs use this to cancel pending asynchronous operations. o Add OUI for Enable Semiconductor. o New Driver for TDK TSC78Q2120 PHY
Diffstat (limited to 'sys/dev/mii/exphy.c')
-rw-r--r--sys/dev/mii/exphy.c42
1 files changed, 7 insertions, 35 deletions
diff --git a/sys/dev/mii/exphy.c b/sys/dev/mii/exphy.c
index f29a3c1fdb2..3ba7b351c10 100644
--- a/sys/dev/mii/exphy.c
+++ b/sys/dev/mii/exphy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exphy.c,v 1.5 1999/09/26 17:50:41 jason Exp $ */
+/* $OpenBSD: exphy.c,v 1.6 1999/12/07 22:01:28 jason Exp $ */
/* $NetBSD: exphy.c,v 1.15.6.1 1999/04/23 15:39:33 perry Exp $ */
/*-
@@ -85,22 +85,16 @@
#include <dev/mii/miivar.h>
#include <dev/mii/miidevs.h>
-#ifdef __NetBSD__
-int exphymatch __P((struct device *, struct cfdata *, void *));
-#else
int exphymatch __P((struct device *, void *, void *));
-#endif
void exphyattach __P((struct device *, struct device *, void *));
struct cfattach exphy_ca = {
sizeof(struct mii_softc), exphymatch, exphyattach
};
-#ifdef __OpenBSD__
struct cfdriver exphy_cd = {
NULL, "exphy", DV_DULL
};
-#endif
int exphy_service __P((struct mii_softc *, struct mii_data *, int));
void exphy_reset __P((struct mii_softc *));
@@ -108,11 +102,7 @@ void exphy_reset __P((struct mii_softc *));
int
exphymatch(parent, match, aux)
struct device *parent;
-#ifdef __NetBSD__
- struct cfdata *match;
-#else
void *match;
-#endif
void *aux;
{
struct mii_attach_args *ma = aux;
@@ -160,24 +150,12 @@ exphyattach(parent, self, aux)
}
sc->mii_flags |= MIIF_NOISOLATE;
-#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
-
-#if 0 /* See above. */
- ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst),
- BMCR_ISO);
-#endif
-
- ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst),
- BMCR_LOOP|BMCR_S100);
-
exphy_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);
-#undef ADD
+ mii_add_media(sc);
}
int
@@ -214,18 +192,8 @@ exphy_service(sc, mii, cmd)
return (0);
(void) mii_phy_auto(sc, 1);
break;
- case IFM_100_T4:
- /*
- * XXX Not supported as a manual setting right now.
- */
- 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;
@@ -247,6 +215,10 @@ exphy_service(sc, mii, cmd)
* kicked; it continues in the background.
*/
break;
+
+ case MII_DOWN:
+ mii_phy_down(sc);
+ return (0);
}
/* Update the media status. */