- 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
This commit is contained in:
parent
aef9ed21c4
commit
24250291d1
@ -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
|
||||
@ -231,12 +217,6 @@ exphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
|
||||
if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
|
||||
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.
|
||||
|
Loading…
Reference in New Issue
Block a user