Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Dec 2020 18:41:10 GMT
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: e51ed06ae157 - mlphy(4)/tlphy(4): Remove obsolete drivers
Message-ID:  <202012261841.0BQIfAni063379@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by marius:

URL: https://cgit.FreeBSD.org/src/commit/?id=e51ed06ae1577cbcb10251c8c1f68ab2f7048b9b

commit e51ed06ae1577cbcb10251c8c1f68ab2f7048b9b
Author:     Marius Strobl <marius@FreeBSD.org>
AuthorDate: 2020-12-26 18:07:50 +0000
Commit:     Marius Strobl <marius@FreeBSD.org>
CommitDate: 2020-12-26 18:40:55 +0000

    mlphy(4)/tlphy(4): Remove obsolete drivers
    
    These drivers should have been removed along with tl(4) as part of
    7c897ca91fe1cdb785531d2f5aa0d441c1d73142 and r347918 respectively
    as these fromer made sure to only ever attach to the latter, e. g.:
    <...>
    static int
    tlphy_probe(device_t dev)
    {
    
            if (!mii_dev_mac_match(dev, "tl"))
                    return (ENXIO);
    <...>
---
 sys/conf/NOTES           |   2 -
 sys/conf/files           |   2 -
 sys/dev/mii/mlphy.c      | 360 ---------------------------------------------
 sys/dev/mii/tlphy.c      | 376 -----------------------------------------------
 sys/dev/mii/tlphyreg.h   |  56 -------
 sys/modules/mii/Makefile |   4 +-
 6 files changed, 2 insertions(+), 798 deletions(-)

diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index 657f51c2abb1..62213a2a16ee 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -1810,7 +1810,6 @@ device  	icsphy		# ICS ICS1889-1893
 device  	ip1000phy	# IC Plus IP1000A/IP1001
 device  	jmphy		# JMicron JMP211/JMP202
 device  	lxtphy		# Level One LXT-970
-device  	mlphy		# Micro Linear 6692
 device  	nsgphy		# NatSemi DP8361/DP83865/DP83891
 device  	nsphy		# NatSemi DP83840A
 device  	nsphyter	# NatSemi DP83843/DP83815
@@ -1822,7 +1821,6 @@ device  	rlphy		# RealTek 8139
 device  	rlswitch	# RealTek 8305
 device  	smcphy		# SMSC LAN91C111
 device  	tdkphy		# TDK 89Q2120
-device  	tlphy		# Texas Instruments ThunderLAN
 device  	truephy		# LSI TruePHY
 device		xmphy		# XaQti XMAC II
 
diff --git a/sys/conf/files b/sys/conf/files
index dc4cadb36c14..8e30ae1eded1 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -2420,7 +2420,6 @@ dev/mii/mii_bitbang.c		optional miibus | mii_bitbang
 dev/mii/mii_physubr.c		optional miibus | mii
 dev/mii/mii_fdt.c		optional miibus fdt | mii fdt
 dev/mii/miibus_if.m		optional miibus | mii
-dev/mii/mlphy.c			optional miibus | mlphy
 dev/mii/nsgphy.c		optional miibus | nsgphy
 dev/mii/nsphy.c			optional miibus | nsphy
 dev/mii/nsphyter.c		optional miibus | nsphyter
@@ -2433,7 +2432,6 @@ dev/mii/rlswitch.c		optional rlswitch
 dev/mii/smcphy.c		optional miibus | smcphy
 dev/mii/smscphy.c		optional miibus | smscphy
 dev/mii/tdkphy.c		optional miibus | tdkphy
-dev/mii/tlphy.c			optional miibus | tlphy
 dev/mii/truephy.c		optional miibus | truephy
 dev/mii/ukphy.c			optional miibus | mii
 dev/mii/ukphy_subr.c		optional miibus | mii
diff --git a/sys/dev/mii/mlphy.c b/sys/dev/mii/mlphy.c
deleted file mode 100644
index 8f31062f4b27..000000000000
--- a/sys/dev/mii/mlphy.c
+++ /dev/null
@@ -1,360 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-4-Clause
- *
- * Copyright (c) 1997, 1998, 1999
- *	Bill Paul <wpaul@ctr.columbia.edu>.  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. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by Bill Paul.
- * 4. 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 Bill Paul 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 Bill Paul OR THE VOICES IN HIS HEAD
- * 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 Micro Linear 6692 PHYs
- *
- * The Micro Linear 6692 is a strange beast, and dealing with it using
- * this code framework is tricky. The 6692 is actually a 100Mbps-only
- * device, which means that a second PHY is required to support 10Mbps
- * modes. However, even though the 6692 does not support 10Mbps modes,
- * it can still advertise them when performing autonegotiation. If a
- * 10Mbps mode is negotiated, we must program the registers of the
- * companion PHY accordingly in addition to programming the registers
- * of the 6692.
- *
- * This device also does not have vendor/device ID registers.
- */
-
-#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 <sys/malloc.h>
-
-#include <net/if.h>
-#include <net/if_media.h>
-
-#include <dev/mii/mii.h>
-#include <dev/mii/miivar.h>
-
-#include "miibus_if.h"
-
-#define ML_STATE_AUTO_SELF	1
-#define ML_STATE_AUTO_OTHER	2
-
-struct mlphy_softc	{
-	struct mii_softc	ml_mii;
-	device_t		ml_dev;
-	int			ml_state;
-	int			ml_linked;
-};
-
-static int mlphy_probe(device_t);
-static int mlphy_attach(device_t);
-
-static device_method_t mlphy_methods[] = {
-	/* device interface */
-	DEVMETHOD(device_probe,		mlphy_probe),
-	DEVMETHOD(device_attach,	mlphy_attach),
-	DEVMETHOD(device_detach,	mii_phy_detach),
-	DEVMETHOD(device_shutdown,	bus_generic_shutdown),
-	DEVMETHOD_END
-};
-
-static devclass_t mlphy_devclass;
-
-static driver_t mlphy_driver = {
-	"mlphy",
-	mlphy_methods,
-	sizeof(struct mlphy_softc)
-};
-
-DRIVER_MODULE(mlphy, miibus, mlphy_driver, mlphy_devclass, 0, 0);
-
-static struct mii_softc *mlphy_find_other(struct mlphy_softc *);
-static int	mlphy_service(struct mii_softc *, struct mii_data *, int);
-static void	mlphy_reset(struct mii_softc *);
-static void	mlphy_status(struct mii_softc *);
-
-static const struct mii_phy_funcs mlphy_funcs = {
-	mlphy_service,
-	mlphy_status,
-	mlphy_reset
-};
-
-static int
-mlphy_probe(dev)
-	device_t		dev;
-{
-	struct mii_attach_args	*ma;
-
-	ma = device_get_ivars(dev);
-
-	/*
-	 * Micro Linear PHY reports oui == 0 model == 0
-	 */
-	if (MII_OUI(ma->mii_id1, ma->mii_id2) != 0 ||
-	    MII_MODEL(ma->mii_id2) != 0)
-		return (ENXIO);
-
-	/*
-	 * Make sure the parent is a `tl'. So far, I have only
-	 * encountered the 6692 on an Olicom card with a ThunderLAN
-	 * controller chip.
-	 */
-	if (!mii_dev_mac_match(dev, "tl"))
-		return (ENXIO);
-
-	device_set_desc(dev, "Micro Linear 6692 media interface");
-
-	return (BUS_PROBE_DEFAULT);
-}
-
-static int
-mlphy_attach(dev)
-	device_t		dev;
-{
-	struct mlphy_softc *msc;
-	struct mii_softc *sc;
-
-	msc = device_get_softc(dev);
-	sc = &msc->ml_mii;
-	msc->ml_dev = dev;
-	mii_phy_dev_attach(dev, MIIF_NOMANPAUSE, &mlphy_funcs, 0);
-
-	PHY_RESET(sc);
-
-	sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & sc->mii_capmask;
-	/* Let the companion PHY (if any) only handle the media we don't. */
-	sc->mii_capmask = ~sc->mii_capabilities;
-	device_printf(dev, " ");
-	mii_phy_add_media(sc);
-	printf("\n");
-
-	MIIBUS_MEDIAINIT(sc->mii_dev);
-	return (0);
-}
-
-static struct mii_softc *
-mlphy_find_other(struct mlphy_softc *msc)
-{
-	device_t		*devlist;
-	struct mii_softc *retval;
-	int i, devs;
-
-	retval = NULL;
-	if (device_get_children(msc->ml_mii.mii_dev, &devlist, &devs) != 0)
-		return (NULL);
-	for (i = 0; i < devs; i++) {
-		if (devlist[i] != msc->ml_dev) {
-			retval = device_get_softc(devlist[i]);
-			break;
-		}
-	}
-	free(devlist, M_TEMP);
-	return (retval);
-}
-
-static int
-mlphy_service(xsc, mii, cmd)
-	struct mii_softc *xsc;
-	struct mii_data *mii;
-	int cmd;
-{
-	struct ifmedia_entry	*ife = mii->mii_media.ifm_cur;
-	struct mii_softc	*other = NULL;
-	struct mlphy_softc	*msc = (struct mlphy_softc *)xsc;
-	struct mii_softc	*sc = (struct mii_softc *)&msc->ml_mii;
-	int			other_inst, reg;
-
-	/*
-	 * See if there's another PHY on this bus with us.
-	 * If so, we may need it for 10Mbps modes.
-	 */
-	other = mlphy_find_other(msc);
-
-	switch (cmd) {
-	case MII_POLLSTAT:
-		break;
-
-	case MII_MEDIACHG:
-		switch (IFM_SUBTYPE(ife->ifm_media)) {
-		case IFM_AUTO:
-			/*
-			 * For autonegotiation, reset and isolate the
-			 * companion PHY (if any) and then do NWAY
-			 * autonegotiation ourselves.
-			 */
-			msc->ml_state = ML_STATE_AUTO_SELF;
-			if (other != NULL) {
-				PHY_RESET(other);
-				PHY_WRITE(other, MII_BMCR, BMCR_ISO);
-			}
-			(void)mii_phy_auto(sc);
-			msc->ml_linked = 0;
-			return (0);
-		case IFM_10_T:
-		case IFM_100_TX:
-			/*
-			 * For 10baseT and 100baseTX modes, reset and isolate
-			 * the companion PHY (if any), then program ourselves
-			 * accordingly.
-			 */
-			if (other != NULL) {
-				PHY_RESET(other);
-				PHY_WRITE(other, MII_BMCR, BMCR_ISO);
-			}
-			mii_phy_setmedia(sc);
-			msc->ml_state = 0;
-			break;
-		default:
-			return (EINVAL);
-		}
-		break;
-
-	case MII_TICK:
-		/*
-		 * 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 BMSR twice in case it's latched.
-		 * If we're in a 10Mbps mode, check the link of the
-		 * 10Mbps PHY. Sometimes the Micro Linear PHY's
-		 * linkstat bit will clear while the linkstat bit of
-		 * the companion PHY will remain set.
-		 */
-		if (msc->ml_state == ML_STATE_AUTO_OTHER) {
-			reg = PHY_READ(other, MII_BMSR) |
-			    PHY_READ(other, MII_BMSR);
-		} else {
-			reg = PHY_READ(sc, MII_BMSR) |
-			    PHY_READ(sc, MII_BMSR);
-		}
-
-		if (reg & BMSR_LINK) {
-			if (!msc->ml_linked) {
-				msc->ml_linked = 1;
-				PHY_STATUS(sc);
-			}
-			break;
-		}
-
-		/*
-		 * Only retry autonegotiation every 5 seconds.
-		 */
-		if (++sc->mii_ticks <= MII_ANEGTICKS)
-			break;
-
-		sc->mii_ticks = 0;
-		msc->ml_linked = 0;
-		mii->mii_media_active = IFM_NONE;
-		PHY_RESET(sc);
-		msc->ml_state = ML_STATE_AUTO_SELF;
-		if (other != NULL) {
-			PHY_RESET(other);
-			PHY_WRITE(other, MII_BMCR, BMCR_ISO);
-		}
-		mii_phy_auto(sc);
-		return (0);
-	}
-
-	/* Update the media status. */
-
-	if (msc->ml_state == ML_STATE_AUTO_OTHER) {
-		other_inst = other->mii_inst;
-		other->mii_inst = sc->mii_inst;
-		if (IFM_INST(ife->ifm_media) == other->mii_inst)
-			(void)PHY_SERVICE(other, mii, MII_POLLSTAT);
-		other->mii_inst = other_inst;
-		sc->mii_media_active = other->mii_media_active;
-		sc->mii_media_status = other->mii_media_status;
-	} else
-		ukphy_status(sc);
-
-	/* Callback if something changed. */
-	mii_phy_update(sc, cmd);
-	return (0);
-}
-
-/*
- * The Micro Linear PHY comes out of reset with the 'autoneg
- * enable' bit set, which we don't want.
- */
-static void
-mlphy_reset(sc)
-	struct mii_softc	*sc;
-{
-	int			reg;
-
-	mii_phy_reset(sc);
-	reg = PHY_READ(sc, MII_BMCR);
-	reg &= ~BMCR_AUTOEN;
-	PHY_WRITE(sc, MII_BMCR, reg);
-}
-
-/*
- * If we negotiate a 10Mbps mode, we need to check for an alternate
- * PHY and make sure it's enabled and set correctly.
- */
-static void
-mlphy_status(sc)
-	struct mii_softc	*sc;
-{
-	struct mlphy_softc	*msc = (struct mlphy_softc *)sc;
-	struct mii_data		*mii = msc->ml_mii.mii_pdata;
-	struct mii_softc	*other = NULL;
-
-	/* See if there's another PHY on the bus with us. */
-	other = mlphy_find_other(msc);
-	if (other == NULL)
-		return;
-
-	ukphy_status(sc);
-
-	if (IFM_SUBTYPE(mii->mii_media_active) != IFM_10_T) {
-		msc->ml_state = ML_STATE_AUTO_SELF;
-		PHY_RESET(other);
-		PHY_WRITE(other, MII_BMCR, BMCR_ISO);
-	}
-
-	if (IFM_SUBTYPE(mii->mii_media_active) == IFM_10_T) {
-		msc->ml_state = ML_STATE_AUTO_OTHER;
-		PHY_RESET(&msc->ml_mii);
-		PHY_WRITE(&msc->ml_mii, MII_BMCR, BMCR_ISO);
-		PHY_RESET(other);
-		mii_phy_auto(other);
-	}
-}
diff --git a/sys/dev/mii/tlphy.c b/sys/dev/mii/tlphy.c
deleted file mode 100644
index 438db72f78b7..000000000000
--- a/sys/dev/mii/tlphy.c
+++ /dev/null
@@ -1,376 +0,0 @@
-/*	$NetBSD: tlphy.c,v 1.18 1999/05/14 11:40:28 drochner Exp $	*/
-
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD AND BSD-2-Clause
- *
- * 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.
- *
- * 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 Texas Instruments's ThunderLAN PHYs
- */
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/socket.h>
-#include <sys/errno.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-#include <sys/malloc.h>
-
-#include <machine/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/tlphyreg.h>
-
-#include "miibus_if.h"
-
-struct tlphy_softc {
-	struct mii_softc sc_mii;		/* generic PHY */
-	int sc_need_acomp;
-};
-
-static int tlphy_probe(device_t);
-static int tlphy_attach(device_t);
-
-static device_method_t tlphy_methods[] = {
-	/* device interface */
-	DEVMETHOD(device_probe,		tlphy_probe),
-	DEVMETHOD(device_attach,	tlphy_attach),
-	DEVMETHOD(device_detach,	mii_phy_detach),
-	DEVMETHOD(device_shutdown,	bus_generic_shutdown),
-	DEVMETHOD_END
-};
-
-static devclass_t tlphy_devclass;
-
-static driver_t tlphy_driver = {
-	"tlphy",
-	tlphy_methods,
-	sizeof(struct tlphy_softc)
-};
-
-DRIVER_MODULE(tlphy, miibus, tlphy_driver, tlphy_devclass, 0, 0);
-
-static int	tlphy_service(struct mii_softc *, struct mii_data *, int);
-static int	tlphy_auto(struct tlphy_softc *);
-static void	tlphy_acomp(struct tlphy_softc *);
-static void	tlphy_status(struct mii_softc *);
-
-static const struct mii_phydesc tlphys[] = {
-	MII_PHY_DESC(TI, TLAN10T),
-	MII_PHY_END
-};
-
-static const struct mii_phy_funcs tlphy_funcs = {
-	tlphy_service,
-	tlphy_status,
-	mii_phy_reset
-};
-
-static int
-tlphy_probe(device_t dev)
-{
-
-	if (!mii_dev_mac_match(dev, "tl"))
-		return (ENXIO);
-	return (mii_phy_dev_probe(dev, tlphys, BUS_PROBE_DEFAULT));
-}
-
-static int
-tlphy_attach(device_t dev)
-{
-	device_t *devlist;
-	struct mii_softc *other, *sc_mii;
-	const char *sep = "";
-	int capmask, devs, i;
-
-	sc_mii = device_get_softc(dev);
-
-	mii_phy_dev_attach(dev, MIIF_NOMANPAUSE, &tlphy_funcs, 0);
-
-	/*
-	 * Note that if we're on a device that also supports 100baseTX,
-	 * we are not going to want to use the built-in 10baseT port,
-	 * since there will be another PHY on the MII wired up to the
-	 * UTP connector.
-	 */
-	capmask = BMSR_DEFCAPMASK;
-	if (sc_mii->mii_inst &&
-	    device_get_children(sc_mii->mii_dev, &devlist, &devs) == 0) {
-		for (i = 0; i < devs; i++) {
-			if (devlist[i] != dev) {
-				other = device_get_softc(devlist[i]);
-				capmask &= ~other->mii_capabilities;
-				break;
-			}
-		}
-		free(devlist, M_TEMP);
-	}
-
-	PHY_RESET(sc_mii);
-
-	sc_mii->mii_capabilities = PHY_READ(sc_mii, MII_BMSR) & capmask;
-
-#define	ADD(m, c)							\
-    ifmedia_add(&sc_mii->mii_pdata->mii_media, (m), (c), NULL)
-#define	PRINT(s)	printf("%s%s", sep, s); sep = ", "
-
-	if ((sc_mii->mii_flags & (MIIF_MACPRIV0 | MIIF_MACPRIV1)) != 0 &&
-	    (sc_mii->mii_capabilities & BMSR_MEDIAMASK) != 0)
-		device_printf(dev, " ");
-	if ((sc_mii->mii_flags & MIIF_MACPRIV0) != 0) {
-		ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_2, 0, sc_mii->mii_inst),
-		    0);
-		PRINT("10base2/BNC");
-	}
-	if ((sc_mii->mii_flags & MIIF_MACPRIV1) != 0) {
-		ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_5, 0, sc_mii->mii_inst),
-		    0);
-		PRINT("10base5/AUI");
-	}
-	if ((sc_mii->mii_capabilities & BMSR_MEDIAMASK) != 0) {
-		printf("%s", sep);
-		mii_phy_add_media(sc_mii);
-	}
-	if ((sc_mii->mii_flags & (MIIF_MACPRIV0 | MIIF_MACPRIV1)) != 0 &&
-	    (sc_mii->mii_capabilities & BMSR_MEDIAMASK) != 0)
-		printf("\n");
-#undef ADD
-#undef PRINT
-
-	MIIBUS_MEDIAINIT(sc_mii->mii_dev);
-	return (0);
-}
-
-static int
-tlphy_service(struct mii_softc *self, struct mii_data *mii, int cmd)
-{
-	struct tlphy_softc *sc = (struct tlphy_softc *)self;
-	struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
-	int reg;
-
-	if (sc->sc_need_acomp)
-		tlphy_acomp(sc);
-
-	switch (cmd) {
-	case MII_POLLSTAT:
-		break;
-
-	case MII_MEDIACHG:
-		switch (IFM_SUBTYPE(ife->ifm_media)) {
-		case IFM_AUTO:
-			/*
-			 * The ThunderLAN PHY doesn't self-configure after
-			 * an autonegotiation cycle, so there's no such
-			 * thing as "already in auto mode".
-			 */
-			(void)tlphy_auto(sc);
-			break;
-		case IFM_10_2:
-		case IFM_10_5:
-			PHY_WRITE(&sc->sc_mii, MII_BMCR, 0);
-			PHY_WRITE(&sc->sc_mii, MII_TLPHY_CTRL, CTRL_AUISEL);
-			DELAY(100000);
-			break;
-		default:
-			PHY_WRITE(&sc->sc_mii, MII_TLPHY_CTRL, 0);
-			DELAY(100000);
-			mii_phy_setmedia(&sc->sc_mii);
-		}
-		break;
-
-	case MII_TICK:
-		/*
-		 * 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 BMSR twice in case it's latched.
-		 *
-		 * XXX WHAT ABOUT CHECKING LINK ON THE BNC/AUI?!
-		 */
-		reg = PHY_READ(&sc->sc_mii, MII_BMSR) |
-		    PHY_READ(&sc->sc_mii, MII_BMSR);
-		if (reg & BMSR_LINK)
-			break;
-
-		/*
-		 * Only retry autonegotiation every 5 seconds.
-		 */
-		if (++sc->sc_mii.mii_ticks <= MII_ANEGTICKS)
-			break;
-
-		sc->sc_mii.mii_ticks = 0;
-		PHY_RESET(&sc->sc_mii);
-		(void)tlphy_auto(sc);
-		return (0);
-	}
-
-	/* Update the media status. */
-	PHY_STATUS(self);
-
-	/* Callback if something changed. */
-	mii_phy_update(&sc->sc_mii, cmd);
-	return (0);
-}
-
-static void
-tlphy_status(struct mii_softc *self)
-{
-	struct tlphy_softc *sc = (struct tlphy_softc *)self;
-	struct mii_data *mii = sc->sc_mii.mii_pdata;
-	int bmsr, bmcr, tlctrl;
-
-	mii->mii_media_status = IFM_AVALID;
-	mii->mii_media_active = IFM_ETHER;
-
-	bmcr = PHY_READ(&sc->sc_mii, MII_BMCR);
-	if (bmcr & BMCR_ISO) {
-		mii->mii_media_active |= IFM_NONE;
-		mii->mii_media_status = 0;
-		return;
-	}
-
-	tlctrl = PHY_READ(&sc->sc_mii, MII_TLPHY_CTRL);
-	if (tlctrl & CTRL_AUISEL) {
-		mii->mii_media_status = 0;
-		mii->mii_media_active = mii->mii_media.ifm_cur->ifm_media;
-		return;
-	}
-
-	bmsr = PHY_READ(&sc->sc_mii, MII_BMSR) |
-	    PHY_READ(&sc->sc_mii, MII_BMSR);
-	if (bmsr & BMSR_LINK)
-		mii->mii_media_status |= IFM_ACTIVE;
-
-	if (bmcr & BMCR_LOOP)
-		mii->mii_media_active |= IFM_LOOP;
-
-	/*
-	 * Grr, braindead ThunderLAN PHY doesn't have any way to
-	 * tell which media is actually active.  (Note it also
-	 * doesn't self-configure after autonegotiation.)  We
-	 * just have to report what's in the BMCR.
-	 */
-	if (bmcr & BMCR_FDX)
-		mii->mii_media_active |= IFM_FDX | mii_phy_flowstatus(self);
-	else
-		mii->mii_media_active |= IFM_HDX;
-	mii->mii_media_active |= IFM_10_T;
-}
-
-static int
-tlphy_auto(struct tlphy_softc *sc)
-{
-	int error;
-
-	switch ((error = mii_phy_auto(&sc->sc_mii))) {
-	case EIO:
-		/*
-		 * Just assume we're not in full-duplex mode.
-		 * XXX Check link and try AUI/BNC?
-		 */
-		PHY_WRITE(&sc->sc_mii, MII_BMCR, 0);
-		break;
-
-	case EJUSTRETURN:
-		/* Flag that we need to program when it completes. */
-		sc->sc_need_acomp = 1;
-		break;
-
-	default:
-		tlphy_acomp(sc);
-	}
-
-	return (error);
-}
-
-static void
-tlphy_acomp(struct tlphy_softc *sc)
-{
-	int aner, anlpar;
-
-	sc->sc_need_acomp = 0;
-
-	/*
-	 * Grr, braindead ThunderLAN PHY doesn't self-configure
-	 * after autonegotiation.  We have to do it ourselves
-	 * based on the link partner status.
-	 */
-
-	aner = PHY_READ(&sc->sc_mii, MII_ANER);
-	if (aner & ANER_LPAN) {
-		anlpar = PHY_READ(&sc->sc_mii, MII_ANLPAR) &
-		    PHY_READ(&sc->sc_mii, MII_ANAR);
-		if (anlpar & ANAR_10_FD) {
-			PHY_WRITE(&sc->sc_mii, MII_BMCR, BMCR_FDX);
-			return;
-		}
-	}
-	PHY_WRITE(&sc->sc_mii, MII_BMCR, 0);
-}
diff --git a/sys/dev/mii/tlphyreg.h b/sys/dev/mii/tlphyreg.h
deleted file mode 100644
index 2e21d0eb8745..000000000000
--- a/sys/dev/mii/tlphyreg.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*	$NetBSD: tlphyreg.h,v 1.1 1998/08/10 23:59:58 thorpej Exp $	*/
-
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD
- *
- * 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.
- *
- * $FreeBSD$
- */
-
-#ifndef _DEV_MII_TLPHYREG_H_
-#define	_DEV_MII_TLPHYREG_H_
-
-/*
- * Registers for the TI ThunderLAN internal PHY.
- */
-
-#define	MII_TLPHY_ID	0x10	/* ThunderLAN PHY ID */
-#define	ID_10BASETAUI	0x0001	/* 10baseT/AUI PHY */
-
-#define	MII_TLPHY_CTRL	0x11	/* Control regiseter */
-#define	CTRL_ILINK	0x8000	/* Ignore link */
-#define	CTRL_SWPOL	0x4000	/* swap polarity */
-#define	CTRL_AUISEL	0x2000	/* Select AUI */
-#define	CTRL_SQEEN	0x1000	/* Enable SQE */
-#define	CTRL_NFEW	0x0004	/* Not far end wrap */
-#define	CTRL_INTEN	0x0002	/* Interrupts enable */
-#define	CTRL_TINT	0x0001	/* Test Interrupts */
-
-#define	MII_TLPHY_ST	0x12	/* Status register */
-#define	ST_MII_INT	0x8000	/* MII interrupt */
-#define	ST_PHOK		0x4000	/* Power high OK */
-#define	ST_POLOK	0x2000	/* Polarity OK */
-#define	ST_TPE		0x1000	/* Twisted pair energy */
-
-#endif /* _DEV_MII_TLPHYREG_H_ */
diff --git a/sys/modules/mii/Makefile b/sys/modules/mii/Makefile
index 51b4f056d0d2..5709af97b720 100644
--- a/sys/modules/mii/Makefile
+++ b/sys/modules/mii/Makefile
@@ -7,9 +7,9 @@ SRCS=	acphy.c amphy.c atphy.c axphy.c bmtphy.c brgphy.c bus_if.h
 SRCS+=	ciphy.c device_if.h
 SRCS+=	e1000phy.c gentbi.c icsphy.c ip1000phy.c jmphy.c lxtphy.c
 SRCS+=	miibus_if.c miibus_if.h mii.c miidevs.h mii_bitbang.c mii_physubr.c
-SRCS+=	mlphy.c nsgphy.c nsphy.c nsphyter.c pci_if.h pnaphy.c qsphy.c
+SRCS+=	nsgphy.c nsphy.c nsphyter.c pci_if.h pnaphy.c qsphy.c
 SRCS+=	rdcphy.c rgephy.c rlphy.c smcphy.c
-SRCS+=	smscphy.c tdkphy.c tlphy.c truephy.c
+SRCS+=	smscphy.c tdkphy.c truephy.c
 SRCS+=	ukphy.c ukphy_subr.c
 SRCS+=	xmphy.c
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202012261841.0BQIfAni063379>