Lines Matching +full:force +full:- +full:external +full:- +full:phy
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
36 * driver for the Marvell 88E1000 series external 1000/100/10-BT PHY.
41 * 1000baseSX PHY.
43 * Jung-uk Kim <jkim@niksun.com>
140 (sc->mii_flags & MIIF_MACPRIV0) != 0) in e1000phy_attach()
141 sc->mii_flags |= MIIF_PHYPRIV0; in e1000phy_attach()
143 switch (sc->mii_mpd_model) { in e1000phy_attach()
147 sc->mii_flags |= MIIF_HAVEFIBER; in e1000phy_attach()
152 * Some 88E1149 PHY's page select is initialized to in e1000phy_attach()
155 * accessed during PHY operation. It is believed that in e1000phy_attach()
156 * page 0 should be used for copper PHY so reinitialize in e1000phy_attach()
157 * E1000_EADR to select default copper PHY. If parent in e1000phy_attach()
158 * device know the type of PHY(either copper or fiber), in e1000phy_attach()
160 * type of PHY. in e1000phy_attach()
168 sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & sc->mii_capmask; in e1000phy_attach()
169 if (sc->mii_capabilities & BMSR_EXTSTAT) { in e1000phy_attach()
170 sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); in e1000phy_attach()
171 if ((sc->mii_extcapabilities & in e1000phy_attach()
173 sc->mii_flags |= MIIF_HAVE_GTCR; in e1000phy_attach()
179 MIIBUS_MEDIAINIT(sc->mii_dev); in e1000phy_attach()
189 if ((sc->mii_flags & MIIF_HAVEFIBER) != 0) { in e1000phy_reset()
192 if (sc->mii_mpd_model == MII_MODEL_xxMARVELL_E1112) { in e1000phy_reset()
193 /* Select 1000BASE-X only mode. */ in e1000phy_reset()
200 if ((sc->mii_flags & MIIF_PHYPRIV0) != 0) { in e1000phy_reset()
210 switch (sc->mii_mpd_model) { in e1000phy_reset()
222 if (sc->mii_mpd_model == MII_MODEL_xxMARVELL_E1116 || in e1000phy_reset()
223 sc->mii_mpd_model == MII_MODEL_xxMARVELL_E1116R_29) in e1000phy_reset()
244 if (sc->mii_mpd_model != MII_MODEL_xxMARVELL_E3016) { in e1000phy_reset()
250 if (sc->mii_mpd_model == MII_MODEL_xxMARVELL_E1116 || in e1000phy_reset()
251 sc->mii_mpd_model == MII_MODEL_xxMARVELL_E1116R_29 || in e1000phy_reset()
252 sc->mii_mpd_model == MII_MODEL_xxMARVELL_E1149 || in e1000phy_reset()
253 sc->mii_mpd_model == MII_MODEL_xxMARVELL_E1149R) { in e1000phy_reset()
262 switch (sc->mii_mpd_model) { in e1000phy_reset()
283 /* LED2 -> ACT, LED1 -> LINK, LED0 -> SPEED. */ in e1000phy_reset()
290 /* Force TX_CLK to 25MHz clock. */ in e1000phy_reset()
297 /* Reset the PHY so all changes take effect. */ in e1000phy_reset()
306 struct ifmedia_entry *ife = mii->mii_media.ifm_cur; in e1000phy_service()
315 if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO) { in e1000phy_service()
316 e1000phy_mii_phy_auto(sc, ife->ifm_media); in e1000phy_service()
321 switch (IFM_SUBTYPE(ife->ifm_media)) { in e1000phy_service()
323 if ((sc->mii_flags & MIIF_HAVE_GTCR) == 0) in e1000phy_service()
328 if ((sc->mii_extcapabilities & in e1000phy_service()
348 if ((ife->ifm_media & IFM_FDX) != 0) { in e1000phy_service()
358 if (IFM_SUBTYPE(ife->ifm_media) == IFM_1000_T) { in e1000phy_service()
360 if ((ife->ifm_media & IFM_ETH_MASTER) != 0) in e1000phy_service()
362 } else if ((sc->mii_flags & MIIF_HAVE_GTCR) != 0) in e1000phy_service()
373 if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) { in e1000phy_service()
374 sc->mii_ticks = 0; in e1000phy_service()
380 * Read the status register twice; BMSR_LINK is latch-low. in e1000phy_service()
384 sc->mii_ticks = 0; in e1000phy_service()
389 if (sc->mii_ticks++ == 0) in e1000phy_service()
391 if (sc->mii_ticks <= sc->mii_anegticks) in e1000phy_service()
394 sc->mii_ticks = 0; in e1000phy_service()
396 e1000phy_mii_phy_auto(sc, ife->ifm_media); in e1000phy_service()
411 struct mii_data *mii = sc->mii_pdata; in e1000phy_status()
414 mii->mii_media_status = IFM_AVALID; in e1000phy_status()
415 mii->mii_media_active = IFM_ETHER; in e1000phy_status()
422 mii->mii_media_status |= IFM_ACTIVE; in e1000phy_status()
425 mii->mii_media_active |= IFM_LOOP; in e1000phy_status()
430 mii->mii_media_active |= IFM_NONE; in e1000phy_status()
434 if ((sc->mii_flags & MIIF_HAVEFIBER) == 0) { in e1000phy_status()
437 mii->mii_media_active |= IFM_1000_T; in e1000phy_status()
440 mii->mii_media_active |= IFM_100_TX; in e1000phy_status()
443 mii->mii_media_active |= IFM_10_T; in e1000phy_status()
446 mii->mii_media_active |= IFM_NONE; in e1000phy_status()
451 * Some fiber PHY(88E1112) does not seem to set resolved in e1000phy_status()
454 mii->mii_media_active |= IFM_1000_SX; in e1000phy_status()
458 mii->mii_media_active |= IFM_FDX; in e1000phy_status()
459 if ((sc->mii_flags & MIIF_HAVEFIBER) == 0) in e1000phy_status()
460 mii->mii_media_active |= mii_phy_flowstatus(sc); in e1000phy_status()
462 mii->mii_media_active |= IFM_HDX; in e1000phy_status()
464 if (IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T) { in e1000phy_status()
467 mii->mii_media_active |= IFM_ETH_MASTER; in e1000phy_status()
476 if ((sc->mii_flags & MIIF_HAVEFIBER) == 0) { in e1000phy_mii_phy_auto()
482 (sc->mii_flags & MIIF_FORCEPAUSE) != 0) in e1000phy_mii_phy_auto()
487 if ((sc->mii_flags & MIIF_HAVE_GTCR) != 0) { in e1000phy_mii_phy_auto()
489 if ((sc->mii_extcapabilities & EXTSR_1000TFDX) != 0) in e1000phy_mii_phy_auto()
491 if ((sc->mii_extcapabilities & EXTSR_1000THDX) != 0) in e1000phy_mii_phy_auto()