summaryrefslogtreecommitdiffstats
path: root/sys/dev/mii/exphy.c
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2007-01-12 23:17:43 +0000
committermarius <marius@FreeBSD.org>2007-01-12 23:17:43 +0000
commit24250291d1a655819f636b89a3f1b91015008548 (patch)
tree4564e09670a893122f1f470ead5b267442d84cc4 /sys/dev/mii/exphy.c
parentaef9ed21c43e2e9ba80c5a19e1b92a7f0c2e04f1 (diff)
downloadFreeBSD-src-24250291d1a655819f636b89a3f1b91015008548.zip
FreeBSD-src-24250291d1a655819f636b89a3f1b91015008548.tar.gz
- Take advantage of mii_phy_dev_probe().
- In exphy_service() for the MII_TICK case don't bother to check whether the currently selected media is of type IFM_AUTO as auto-negotiation doesn't need to be kicked anyway. - Remove #if 0'ed unapplicable code. - Fix some whitespace nits. MFC after: 1 week
Diffstat (limited to 'sys/dev/mii/exphy.c')
-rw-r--r--sys/dev/mii/exphy.c58
1 files changed, 19 insertions, 39 deletions
diff --git a/sys/dev/mii/exphy.c b/sys/dev/mii/exphy.c
index fc418be..c4ab68b 100644
--- a/sys/dev/mii/exphy.c
+++ b/sys/dev/mii/exphy.c
@@ -114,36 +114,27 @@ 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(BROADCOM, 3C905C),
+ MII_PHY_END
+};
+
static int
exphy_probe(device_t dev)
{
- struct mii_attach_args *ma;
- device_t parent;
-
- ma = device_get_ivars(dev);
- parent = device_get_parent(device_get_parent(dev));
-
- /*
- * Argh, 3Com PHY reports oui == 0 model == 0!
- */
- if ((MII_OUI(ma->mii_id1, ma->mii_id2) != 0 ||
- MII_MODEL(ma->mii_id2) != 0) &&
- (MII_OUI(ma->mii_id1, ma->mii_id2) != MII_OUI_BROADCOM ||
- MII_MODEL(ma->mii_id2) != MII_MODEL_BROADCOM_3C905C))
- return (ENXIO);
-
- /*
- * Make sure the parent is an `ex'.
- */
- if (strcmp(device_get_name(parent), "xl") != 0)
- return (ENXIO);
- if (MII_OUI(ma->mii_id1, ma->mii_id2) == 0)
- device_set_desc(dev, "3Com internal media interface");
- else
- device_set_desc(dev, MII_STR_BROADCOM_3C905C);
-
- return (BUS_PROBE_DEFAULT);
+ 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
@@ -164,7 +155,7 @@ exphy_attach(device_t dev)
*/
if (mii->mii_instance != 0) {
device_printf(dev, "ignoring this PHY, non-zero instance\n");
- return(ENXIO);
+ return (ENXIO);
}
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
@@ -179,11 +170,6 @@ exphy_attach(device_t dev)
#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),
MII_MEDIA_100_TX);
@@ -196,7 +182,7 @@ exphy_attach(device_t dev)
printf("\n");
#undef ADD
MIIBUS_MEDIAINIT(sc->mii_dev);
- return(0);
+ return (0);
}
static int
@@ -232,12 +218,6 @@ exphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
return (0);
/*
- * Only used for autonegotiation.
- */
- if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO)
- break;
-
- /*
* The 3Com PHY's autonegotiation doesn't need to be
* kicked; it continues in the background.
*/
OpenPOWER on IntegriCloud