diff options
| author | Marius Strobl <marius@FreeBSD.org> | 2010-11-07 11:12:30 +0000 |
|---|---|---|
| committer | Marius Strobl <marius@FreeBSD.org> | 2010-11-07 11:12:30 +0000 |
| commit | 4aec3028843cf6e3074fa61de9a91bd59471724a (patch) | |
| tree | f19e75c9f3911f2eb777800aa6baf92e5e4e9830 /sys/dev/hme | |
| parent | 2347dd66d8a5b52a08bc3af1aa7cef656a1bf714 (diff) | |
Notes
Diffstat (limited to 'sys/dev/hme')
| -rw-r--r-- | sys/dev/hme/if_hme.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/sys/dev/hme/if_hme.c b/sys/dev/hme/if_hme.c index 393bf2f6a7b5..abd441bdcb6e 100644 --- a/sys/dev/hme/if_hme.c +++ b/sys/dev/hme/if_hme.c @@ -315,9 +315,20 @@ hme_config(struct hme_softc *sc) hme_mifinit(sc); - if ((error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, hme_mediachange, - hme_mediastatus)) != 0) { - device_printf(sc->sc_dev, "phy probe failed: %d\n", error); + /* + * DP83840A used with HME chips don't advertise their media + * capabilities themselves properly so force writing the ANAR + * according to the BMSR in mii_phy_setmedia(). + */ + error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, hme_mediachange, + hme_mediastatus, BMSR_DEFCAPMASK, HME_PHYAD_EXTERNAL, + MII_OFFSET_ANY, MIIF_FORCEANEG); + i = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, hme_mediachange, + hme_mediastatus, BMSR_DEFCAPMASK, HME_PHYAD_INTERNAL, + MII_OFFSET_ANY, MIIF_FORCEANEG); + if (error != 0 && i != 0) { + error = ENXIO; + device_printf(sc->sc_dev, "attaching PHYs failed\n"); goto fail_rxdesc; } sc->sc_mii = device_get_softc(sc->sc_miibus); @@ -1404,10 +1415,6 @@ hme_mii_readreg(device_t dev, int phy, int reg) int n; u_int32_t v; - /* We can at most have two PHYs. */ - if (phy != HME_PHYAD_EXTERNAL && phy != HME_PHYAD_INTERNAL) - return (0); - sc = device_get_softc(dev); /* Select the desired PHY in the MIF configuration register */ v = HME_MIF_READ_4(sc, HME_MIFI_CFG); @@ -1445,10 +1452,6 @@ hme_mii_writereg(device_t dev, int phy, int reg, int val) int n; u_int32_t v; - /* We can at most have two PHYs. */ - if (phy != HME_PHYAD_EXTERNAL && phy != HME_PHYAD_INTERNAL) - return (0); - sc = device_get_softc(dev); /* Select the desired PHY in the MIF configuration register */ v = HME_MIF_READ_4(sc, HME_MIFI_CFG); |
