From 90108b38f19fc6ca669c2296a3d74500d8818a39 Mon Sep 17 00:00:00 2001 From: Jason Wright Date: Tue, 7 Dec 1999 22:01:34 +0000 Subject: 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 --- sys/dev/mii/ukphy.c | 41 +++++++---------------------------------- 1 file changed, 7 insertions(+), 34 deletions(-) (limited to 'sys/dev/mii/ukphy.c') diff --git a/sys/dev/mii/ukphy.c b/sys/dev/mii/ukphy.c index 23c56f1ac68..ee24f04f8a2 100644 --- a/sys/dev/mii/ukphy.c +++ b/sys/dev/mii/ukphy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ukphy.c,v 1.5 1999/09/17 01:38:56 jason Exp $ */ +/* $OpenBSD: ukphy.c,v 1.6 1999/12/07 22:01:33 jason Exp $ */ /* $NetBSD: ukphy.c,v 1.1.6.1 1999/04/23 15:39:00 perry Exp $ */ /*- @@ -85,33 +85,23 @@ #include #include -#ifdef __NetBSD__ -int ukphymatch __P((struct device *, struct cfdata *, void *)); -#else int ukphymatch __P((struct device *, void *, void *)); -#endif void ukphyattach __P((struct device *, struct device *, void *)); struct cfattach ukphy_ca = { sizeof(struct mii_softc), ukphymatch, ukphyattach }; -#ifdef __OpenBSD__ struct cfdriver ukphy_cd = { NULL, "ukphy", DV_DULL }; -#endif int ukphy_service __P((struct mii_softc *, struct mii_data *, int)); int ukphymatch(parent, match, aux) struct device *parent; -#ifdef __NetBSD__ - struct cfdata *match; -#else void *match; -#endif void *aux; { @@ -140,23 +130,12 @@ ukphyattach(parent, self, aux) sc->mii_service = ukphy_service; sc->mii_pdata = mii; -#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) - - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst), - BMCR_ISO); -#if 0 - ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst), - BMCR_LOOP|BMCR_S100); -#endif - 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); -#undef ADD + mii_add_media(sc); } int @@ -203,18 +182,8 @@ ukphy_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; @@ -258,6 +227,10 @@ ukphy_service(sc, mii, cmd) if (mii_phy_auto(sc, 0) == EJUSTRETURN) return (0); break; + + case MII_DOWN: + mii_phy_down(sc); + return (0); } /* Update the media status. */ -- cgit v1.2.3