- In qsphy_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. - Don't set MIIF_NOISOLATE so qsphy(4) can be used in configurations with multiple PHYs. There doesn't seem to be a problem with isolating QS6612 per se nor in combination with the NICs they're used with. - Use mii_phy_add_media() instead of mii_add_media() so the latter can be eventually retired. - Take advantage of mii_phy_setmedia(). Obtained from: NetBSD (except for the first item) MFC after: 2 weeks
This commit is contained in:
parent
9a0b47981d
commit
f8f3badf74
@ -153,16 +153,15 @@ qsphy_attach(device_t dev)
|
||||
sc->mii_phy = ma->mii_phyno;
|
||||
sc->mii_service = qsphy_service;
|
||||
sc->mii_pdata = mii;
|
||||
sc->mii_flags |= MIIF_NOISOLATE;
|
||||
|
||||
qsphy_reset(sc);
|
||||
|
||||
mii->mii_instance++;
|
||||
|
||||
qsphy_reset(sc);
|
||||
|
||||
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);
|
||||
@ -199,25 +198,7 @@ qsphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
|
||||
if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
|
||||
break;
|
||||
|
||||
switch (IFM_SUBTYPE(ife->ifm_media)) {
|
||||
case IFM_AUTO:
|
||||
/*
|
||||
* If we're already in auto mode, just return.
|
||||
*/
|
||||
if (PHY_READ(sc, MII_BMCR) & BMCR_AUTOEN)
|
||||
return (0);
|
||||
|
||||
(void) mii_phy_auto(sc);
|
||||
break;
|
||||
|
||||
default:
|
||||
/*
|
||||
* BMCR data is stored in the ifmedia entry.
|
||||
*/
|
||||
PHY_WRITE(sc, MII_ANAR,
|
||||
mii_anar(ife->ifm_media));
|
||||
PHY_WRITE(sc, MII_BMCR, ife->ifm_data);
|
||||
}
|
||||
mii_phy_setmedia(sc);
|
||||
break;
|
||||
|
||||
case MII_TICK:
|
||||
@ -227,12 +208,6 @@ qsphy_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;
|
||||
|
||||
/*
|
||||
* This PHY's autonegotiation doesn't need to be kicked.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user