aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/mii
diff options
context:
space:
mode:
authorMarius Strobl <marius@FreeBSD.org>2011-10-08 12:33:10 +0000
committerMarius Strobl <marius@FreeBSD.org>2011-10-08 12:33:10 +0000
commit112a855de73f1077df8308aede5ae11819b90853 (patch)
treed092c392cb4048b55d5299cf6e1cdf2d236f5376 /sys/dev/mii
parent09307b254746fefdd32b01499fad7c465a81ea56 (diff)
Notes
Diffstat (limited to 'sys/dev/mii')
-rw-r--r--sys/dev/mii/exphy.c197
-rw-r--r--sys/dev/mii/inphy.c197
-rw-r--r--sys/dev/mii/inphyreg.h35
-rw-r--r--sys/dev/mii/ruephy.c233
-rw-r--r--sys/dev/mii/ruephyreg.h38
5 files changed, 0 insertions, 700 deletions
diff --git a/sys/dev/mii/exphy.c b/sys/dev/mii/exphy.c
deleted file mode 100644
index 04add674fcc4..000000000000
--- a/sys/dev/mii/exphy.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/* $NetBSD: exphy.c,v 1.16 1999/04/23 04:24:32 thorpej Exp $ */
-
-/*-
- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
- * NASA Ames Research Center, and by Frank van der Linden.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*-
- * Copyright (c) 1997 Manuel Bouyer. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * driver for 3Com internal PHYs
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/socket.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-
-#include <net/if.h>
-#include <net/if_media.h>
-
-#include <dev/mii/mii.h>
-#include <dev/mii/miivar.h>
-#include "miidevs.h"
-
-#include "miibus_if.h"
-
-static int exphy_probe(device_t);
-static int exphy_attach(device_t);
-
-static device_method_t exphy_methods[] = {
- /* device interface */
- DEVMETHOD(device_probe, exphy_probe),
- DEVMETHOD(device_attach, exphy_attach),
- DEVMETHOD(device_detach, mii_phy_detach),
- DEVMETHOD(device_shutdown, bus_generic_shutdown),
- { 0, 0 }
-};
-
-static devclass_t exphy_devclass;
-
-static driver_t exphy_driver = {
- "xlphy",
- exphy_methods,
- sizeof(struct mii_softc)
-};
-
-DRIVER_MODULE(xlphy, miibus, exphy_driver, exphy_devclass, 0, 0);
-
-static int exphy_service(struct mii_softc *, struct mii_data *, int);
-static void exphy_reset(struct mii_softc *);
-
-/*
- * Some 3Com internal PHYs report zero for OUI and model, others use
- * actual values.
- * Note that the 3Com internal PHYs having OUI 0x105a and model 0 are
- * handled fine by ukphy(4); they can be isolated and don't require
- * special treatment after reset.
- */
-static const struct mii_phydesc exphys[] = {
- { 0, 0, "3Com internal media interface" },
- MII_PHY_DESC(xxBROADCOM, 3C905C),
- MII_PHY_END
-};
-
-static const struct mii_phy_funcs exphy_funcs = {
- exphy_service,
- ukphy_status,
- exphy_reset
-};
-
-static int
-exphy_probe(device_t dev)
-{
-
- if (strcmp(device_get_name(device_get_parent(device_get_parent(dev))),
- "xl") == 0)
- return (mii_phy_dev_probe(dev, exphys, BUS_PROBE_DEFAULT));
- return (ENXIO);
-}
-
-static int
-exphy_attach(device_t dev)
-{
-
- /*
- * The 3Com PHY can never be isolated.
- */
- mii_phy_dev_attach(dev, MIIF_NOISOLATE | MIIF_NOMANPAUSE,
- &exphy_funcs, 1);
- return (0);
-}
-
-static int
-exphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
-{
-
- switch (cmd) {
- case MII_POLLSTAT:
- break;
-
- case MII_MEDIACHG:
- /*
- * If the interface is not up, don't do anything.
- */
- if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
- break;
-
- mii_phy_setmedia(sc);
- break;
-
- case MII_TICK:
- /*
- * Is the interface even up?
- */
- if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
- return (0);
-
- /*
- * The 3Com PHY's autonegotiation doesn't need to be
- * kicked; it continues in the background.
- */
- break;
- }
-
- /* Update the media status. */
- PHY_STATUS(sc);
-
- /* Callback if something changed. */
- mii_phy_update(sc, cmd);
- return (0);
-}
-
-static void
-exphy_reset(struct mii_softc *sc)
-{
-
- mii_phy_reset(sc);
-
- /*
- * XXX 3Com PHY doesn't set the BMCR properly after
- * XXX reset, which breaks autonegotiation.
- */
- PHY_WRITE(sc, MII_BMCR, BMCR_S100|BMCR_AUTOEN|BMCR_FDX);
-}
diff --git a/sys/dev/mii/inphy.c b/sys/dev/mii/inphy.c
deleted file mode 100644
index e6a601cbfa8c..000000000000
--- a/sys/dev/mii/inphy.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/*-
- * Copyright (c) 2001 Jonathan Lemon
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * driver for Intel 82553 and 82555 PHYs
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/socket.h>
-#include <sys/bus.h>
-
-#include <net/if.h>
-#include <net/if_media.h>
-
-#include <dev/mii/mii.h>
-#include <dev/mii/miivar.h>
-#include "miidevs.h"
-
-#include <dev/mii/inphyreg.h>
-
-#include "miibus_if.h"
-
-static int inphy_probe(device_t dev);
-static int inphy_attach(device_t dev);
-
-static device_method_t inphy_methods[] = {
- /* device interface */
- DEVMETHOD(device_probe, inphy_probe),
- DEVMETHOD(device_attach, inphy_attach),
- DEVMETHOD(device_detach, mii_phy_detach),
- DEVMETHOD(device_shutdown, bus_generic_shutdown),
- { 0, 0 }
-};
-
-static devclass_t inphy_devclass;
-
-static driver_t inphy_driver = {
- "inphy",
- inphy_methods,
- sizeof(struct mii_softc)
-};
-
-DRIVER_MODULE(inphy, miibus, inphy_driver, inphy_devclass, 0, 0);
-
-static int inphy_service(struct mii_softc *, struct mii_data *, int);
-static void inphy_status(struct mii_softc *);
-static void inphy_reset(struct mii_softc *);
-
-static const struct mii_phydesc inphys[] = {
- MII_PHY_DESC(xxINTEL, I82553),
- MII_PHY_DESC(yyINTEL, I82553),
- MII_PHY_DESC(yyINTEL, I82555),
- MII_PHY_DESC(yyINTEL, I82562EM),
- MII_PHY_DESC(yyINTEL, I82562ET),
- MII_PHY_END
-};
-
-static const struct mii_phy_funcs inphy_funcs = {
- inphy_service,
- inphy_status,
- inphy_reset
-};
-
-static int
-inphy_probe(device_t dev)
-{
-
- return (mii_phy_dev_probe(dev, inphys, BUS_PROBE_DEFAULT));
-}
-
-static int
-inphy_attach(device_t dev)
-{
-
- mii_phy_dev_attach(dev, MIIF_NOMANPAUSE, &inphy_funcs, 1);
- return (0);
-}
-
-static int
-inphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
-{
-
- switch (cmd) {
- case MII_POLLSTAT:
- break;
-
- case MII_MEDIACHG:
- /*
- * If the interface is not up, don't do anything.
- */
- if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
- break;
-
- mii_phy_setmedia(sc);
- break;
-
- case MII_TICK:
- if (mii_phy_tick(sc) == EJUSTRETURN)
- return (0);
- break;
- }
-
- /* Update the media status. */
- PHY_STATUS(sc);
-
- /* Callback if something changed. */
- mii_phy_update(sc, cmd);
- return (0);
-}
-
-static void
-inphy_status(struct mii_softc *sc)
-{
- struct mii_data *mii = sc->mii_pdata;
- struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
- int bmsr, bmcr, scr;
-
- mii->mii_media_status = IFM_AVALID;
- mii->mii_media_active = IFM_ETHER;
-
- bmsr = PHY_READ(sc, MII_BMSR) | PHY_READ(sc, MII_BMSR);
- if (bmsr & BMSR_LINK)
- mii->mii_media_status |= IFM_ACTIVE;
-
- bmcr = PHY_READ(sc, MII_BMCR);
- if (bmcr & BMCR_ISO) {
- mii->mii_media_active |= IFM_NONE;
- mii->mii_media_status = 0;
- return;
- }
-
- if (bmcr & BMCR_LOOP)
- mii->mii_media_active |= IFM_LOOP;
-
- if (bmcr & BMCR_AUTOEN) {
- if ((bmsr & BMSR_ACOMP) == 0) {
- mii->mii_media_active |= IFM_NONE;
- return;
- }
-
- scr = PHY_READ(sc, MII_INPHY_SCR);
- if (scr & SCR_S100)
- mii->mii_media_active |= IFM_100_TX;
- else
- mii->mii_media_active |= IFM_10_T;
- if (scr & SCR_FDX)
- mii->mii_media_active |=
- IFM_FDX | mii_phy_flowstatus(sc);
- else
- mii->mii_media_active |= IFM_HDX;
- } else
- mii->mii_media_active = ife->ifm_media;
-}
-
-static void
-inphy_reset(struct mii_softc *sc)
-{
-
- mii_phy_reset(sc);
-
- /* Ensure Bay flow control is disabled. */
- PHY_WRITE(sc, MII_INPHY_SCR,
- PHY_READ(sc, MII_INPHY_SCR) & ~SCR_FLOWCTL);
-}
diff --git a/sys/dev/mii/inphyreg.h b/sys/dev/mii/inphyreg.h
deleted file mode 100644
index 4b7d1f113051..000000000000
--- a/sys/dev/mii/inphyreg.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*-
- * Copyright (c) 2001 Jonathan Lemon
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#define MII_INPHY_SCR 0x10 /* status and control register */
-#define SCR_FLOWCTL 0x8000
-#define SCR_S100 0x0002 /* autonegotiated speed */
-#define SCR_FDX 0x0001 /* autonegotiated duplex */
diff --git a/sys/dev/mii/ruephy.c b/sys/dev/mii/ruephy.c
deleted file mode 100644
index a0d54417d8c8..000000000000
--- a/sys/dev/mii/ruephy.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/*-
- * Copyright (c) 2001-2003, Shunsuke Akiyama <akiyama@FreeBSD.org>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * driver for RealTek RTL8150 internal PHY
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/module.h>
-#include <sys/socket.h>
-#include <sys/bus.h>
-
-#include <net/if.h>
-#include <net/if_arp.h>
-#include <net/if_media.h>
-
-#include <dev/mii/mii.h>
-#include <dev/mii/miivar.h>
-#include "miidevs.h"
-
-#include <machine/bus.h>
-#include <dev/mii/ruephyreg.h>
-
-#include "miibus_if.h"
-
-static int ruephy_probe(device_t);
-static int ruephy_attach(device_t);
-
-static device_method_t ruephy_methods[] = {
- /* device interface */
- DEVMETHOD(device_probe, ruephy_probe),
- DEVMETHOD(device_attach, ruephy_attach),
- DEVMETHOD(device_detach, mii_phy_detach),
- DEVMETHOD(device_shutdown, bus_generic_shutdown),
- { 0, 0 }
-};
-
-static devclass_t ruephy_devclass;
-
-static driver_t ruephy_driver = {
- "ruephy",
- ruephy_methods,
- sizeof(struct mii_softc)
-};
-
-DRIVER_MODULE(ruephy, miibus, ruephy_driver, ruephy_devclass, 0, 0);
-
-static int ruephy_service(struct mii_softc *, struct mii_data *, int);
-static void ruephy_reset(struct mii_softc *);
-static void ruephy_status(struct mii_softc *);
-
-/*
- * The RealTek RTL8150 internal PHY doesn't have vendor/device ID
- * registers; rue(4) fakes up a return value of all zeros.
- */
-static const struct mii_phydesc ruephys[] = {
- { 0, 0, "RealTek RTL8150 internal media interface" },
- MII_PHY_END
-};
-
-static const struct mii_phy_funcs ruephy_funcs = {
- ruephy_service,
- ruephy_status,
- ruephy_reset
-};
-
-static int
-ruephy_probe(device_t dev)
-{
-
- if (strcmp(device_get_name(device_get_parent(device_get_parent(dev))),
- "rue") == 0)
- return (mii_phy_dev_probe(dev, ruephys, BUS_PROBE_DEFAULT));
- return (ENXIO);
-}
-
-static int
-ruephy_attach(device_t dev)
-{
-
- mii_phy_dev_attach(dev, MIIF_NOISOLATE | MIIF_NOMANPAUSE,
- &ruephy_funcs, 1);
- return (0);
-}
-
-static int
-ruephy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
-{
- struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
- int reg;
-
- switch (cmd) {
- case MII_POLLSTAT:
- break;
-
- case MII_MEDIACHG:
- /*
- * If the interface is not up, don't do anything.
- */
- if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
- break;
-
- mii_phy_setmedia(sc);
- break;
-
- case MII_TICK:
- /*
- * Is the interface even up?
- */
- if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
- return (0);
-
- /*
- * Only used for autonegotiation.
- */
- if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO)
- break;
-
- /*
- * Check to see if we have link. If we do, we don't
- * need to restart the autonegotiation process. Read
- * the MSR twice in case it's latched.
- */
- reg = PHY_READ(sc, RUEPHY_MII_MSR) |
- PHY_READ(sc, RUEPHY_MII_MSR);
- if (reg & RUEPHY_MSR_LINK)
- break;
-
- /* Only retry autonegotiation every mii_anegticks seconds. */
- if (sc->mii_ticks <= sc->mii_anegticks)
- break;
-
- sc->mii_ticks = 0;
- PHY_RESET(sc);
- if (mii_phy_auto(sc) == EJUSTRETURN)
- return (0);
- break;
- }
-
- /* Update the media status. */
- PHY_STATUS(sc);
-
- /* Callback if something changed. */
- mii_phy_update(sc, cmd);
-
- return (0);
-}
-
-static void
-ruephy_reset(struct mii_softc *sc)
-{
-
- mii_phy_reset(sc);
-
- /*
- * XXX RealTek RTL8150 PHY doesn't set the BMCR properly after
- * XXX reset, which breaks autonegotiation.
- */
- PHY_WRITE(sc, MII_BMCR, (BMCR_S100 | BMCR_AUTOEN | BMCR_FDX));
-}
-
-static void
-ruephy_status(struct mii_softc *phy)
-{
- struct mii_data *mii = phy->mii_pdata;
- struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
- int bmsr, bmcr, msr;
-
- mii->mii_media_status = IFM_AVALID;
- mii->mii_media_active = IFM_ETHER;
-
- msr = PHY_READ(phy, RUEPHY_MII_MSR) | PHY_READ(phy, RUEPHY_MII_MSR);
- if (msr & RUEPHY_MSR_LINK)
- mii->mii_media_status |= IFM_ACTIVE;
-
- bmcr = PHY_READ(phy, MII_BMCR);
- if (bmcr & BMCR_ISO) {
- mii->mii_media_active |= IFM_NONE;
- mii->mii_media_status = 0;
- return;
- }
-
- bmsr = PHY_READ(phy, MII_BMSR) | PHY_READ(phy, MII_BMSR);
- if (bmcr & BMCR_AUTOEN) {
- if ((bmsr & BMSR_ACOMP) == 0) {
- /* Erg, still trying, I guess... */
- mii->mii_media_active |= IFM_NONE;
- return;
- }
-
- if (msr & RUEPHY_MSR_SPEED100)
- mii->mii_media_active |= IFM_100_TX;
- else
- mii->mii_media_active |= IFM_10_T;
-
- if (msr & RUEPHY_MSR_DUPLEX)
- mii->mii_media_active |=
- IFM_FDX | mii_phy_flowstatus(phy);
- else
- mii->mii_media_active |= IFM_HDX;
- } else
- mii->mii_media_active = ife->ifm_media;
-}
diff --git a/sys/dev/mii/ruephyreg.h b/sys/dev/mii/ruephyreg.h
deleted file mode 100644
index 5f3911bebd5d..000000000000
--- a/sys/dev/mii/ruephyreg.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*-
- * Copyright (c) 2001-2003, Shunsuke Akiyama <akiyama@FreeBSD.org>.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#ifndef _RUEPHYREG_H_
-#define _RUEPHYREG_H_
-
-#define RUEPHY_MII_MSR 0x0137 /* B, R/W */
-#define RUEPHY_MSR_RXFCE 0x40
-#define RUEPHY_MSR_DUPLEX 0x10
-#define RUEPHY_MSR_SPEED100 0x08
-#define RUEPHY_MSR_LINK 0x04
-
-#endif /* _RUEPHYREG_H_ */