Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Nov 2010 17:35:42 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r214924 - stable/8/sys/dev/mii
Message-ID:  <201011071735.oA7HZgfi065262@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Sun Nov  7 17:35:42 2010
New Revision: 214924
URL: http://svn.freebsd.org/changeset/base/214924

Log:
  MFC: r214262
  
  - Take advantage of mii_phy_dev_probe().
  - Use mii_phy_add_media() instead of mii_add_media(). I'm not sure how
    this driver actually managed to work before as mii_add_media() is
    intended to be used to gether with mii_anar() while mii_phy_add_media()
    is intended to be used with mii_phy_setmedia(), however this driver
    mii_add_media() along with mii_phy_setmedia().

Modified:
  stable/8/sys/dev/mii/smcphy.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/mii/smcphy.c
==============================================================================
--- stable/8/sys/dev/mii/smcphy.c	Sun Nov  7 17:33:04 2010	(r214923)
+++ stable/8/sys/dev/mii/smcphy.c	Sun Nov  7 17:35:42 2010	(r214924)
@@ -76,20 +76,16 @@ static driver_t smcphy_driver = {
 
 DRIVER_MODULE(smcphy, miibus, smcphy_driver, smcphy_devclass, 0, 0);
 
+static const struct mii_phydesc smcphys[] = {
+	MII_PHY_DESC(SMSC, LAN83C183),
+	MII_PHY_END
+};
+
 static int
 smcphy_probe(device_t dev)
 {
-	struct	mii_attach_args *ma;
-
-	ma = device_get_ivars(dev);
 
-	if (MII_OUI(ma->mii_id1, ma->mii_id2) != MII_OUI_SMSC ||
-	    MII_MODEL(ma->mii_id2) != MII_MODEL_SMSC_LAN83C183)
-		return (ENXIO);
-
-	device_set_desc(dev, MII_STR_SMSC_LAN83C183);
-
-	return (0);
+	return (mii_phy_dev_probe(dev, smcphys, BUS_PROBE_DEFAULT));
 }
 
 static int
@@ -111,7 +107,7 @@ smcphy_attach(device_t dev)
 	sc->mii_service = smcphy_service;
 	sc->mii_pdata = mii;
 
-	sc->mii_flags |= MIIF_NOISOLATE;
+	sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP;
 
 	if (smcphy_reset(sc) != 0) {
 		device_printf(dev, "reset failed\n");
@@ -122,7 +118,7 @@ smcphy_attach(device_t dev)
 
 	sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
 	device_printf(dev, " ");
-	mii_add_media(sc);
+	mii_phy_add_media(sc);
 	printf("\n");
 
 	MIIBUS_MEDIAINIT(sc->mii_dev);



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