mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-18 22:33:39 +00:00
- In acphy_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. - Fix a whitespace nit. - Probe another Altima PHY, which is a AC101 workalike and integrated in at least ADMtek ADM8511 but apparently is not mentioned in any publically available data sheet so the actual identifier is unknown. - Don't set MIIF_NOISOLATE so acphy(4) can be used in configurations with multiple PHYs. There doesn't seem to be a problem with isolating AC101 and workalikes 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 and second item) MFC after: 2 weeks
This commit is contained in:
parent
18e13cb9aa
commit
65169ee9c6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=164834
|
@ -119,6 +119,8 @@ static void acphy_status(struct mii_softc *);
|
|||
static const struct mii_phydesc acphys[] = {
|
||||
MII_PHY_DESC(xxALTIMA, AC101),
|
||||
MII_PHY_DESC(xxALTIMA, AC101L),
|
||||
/* XXX This is reported to work, but it's not from any data sheet. */
|
||||
MII_PHY_DESC(xxALTIMA, ACXXX),
|
||||
MII_PHY_END
|
||||
};
|
||||
|
||||
|
@ -146,16 +148,15 @@ acphy_attach(device_t dev)
|
|||
sc->mii_phy = ma->mii_phyno;
|
||||
sc->mii_service = acphy_service;
|
||||
sc->mii_pdata = mii;
|
||||
sc->mii_flags |= MIIF_NOISOLATE;
|
||||
|
||||
acphy_reset(sc);
|
||||
|
||||
mii->mii_instance++;
|
||||
|
||||
acphy_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);
|
||||
|
@ -194,28 +195,10 @@ acphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
|
|||
|
||||
/* Wake & deisolate up if necessary */
|
||||
reg = PHY_READ(sc, MII_BMCR);
|
||||
if (reg & (BMCR_ISO | BMCR_PDOWN))
|
||||
if (reg & (BMCR_ISO | BMCR_PDOWN))
|
||||
PHY_WRITE(sc, MII_BMCR, reg & ~(BMCR_ISO | BMCR_PDOWN));
|
||||
|
||||
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:
|
||||
|
@ -225,12 +208,6 @@ acphy_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 a new issue