aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/bm
diff options
context:
space:
mode:
authorMarius Strobl <marius@FreeBSD.org>2010-10-15 14:52:11 +0000
committerMarius Strobl <marius@FreeBSD.org>2010-10-15 14:52:11 +0000
commit8e5d93dbb40452863b266a378868255bf986af67 (patch)
tree6dd0ca5b178547c1f20c8ce1f607ac42d4afe2ae /sys/dev/bm
parentd1457e3703928a249a45a6dd996918bc7eb6ba20 (diff)
downloadsrc-8e5d93dbb40452863b266a378868255bf986af67.tar.gz
src-8e5d93dbb40452863b266a378868255bf986af67.zip
Convert the PHY drivers to honor the mii_flags passed down and convert
the NIC drivers as well as the PHY drivers to take advantage of the mii_attach() introduced in r213878 to get rid of certain hacks. For the most part these were: - Artificially limiting miibus_{read,write}reg methods to certain PHY addresses; we now let mii_attach() only probe the PHY at the desired address(es) instead. - PHY drivers setting MIIF_* flags based on the NIC driver they hang off from, partly even based on grabbing and using the softc of the parent; we now pass these flags down from the NIC to the PHY drivers via mii_attach(). This got us rid of all such hacks except those of brgphy() in combination with bce(4) and bge(4), which is way beyond what can be expressed with simple flags. While at it, I took the opportunity to change the NIC drivers to pass up the error returned by mii_attach() (previously by mii_phy_probe()) and unify the error message used in this case where and as appropriate as mii_attach() actually can fail for a number of reasons, not just because of no PHY(s) being present at the expected address(es). Reviewed by: jhb, yongari
Notes
Notes: svn path=/head/; revision=213893
Diffstat (limited to 'sys/dev/bm')
-rw-r--r--sys/dev/bm/if_bm.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/sys/dev/bm/if_bm.c b/sys/dev/bm/if_bm.c
index c2a43589baf0..ded2b42f6f3f 100644
--- a/sys/dev/bm/if_bm.c
+++ b/sys/dev/bm/if_bm.c
@@ -594,11 +594,19 @@ bm_attach(device_t dev)
/* reset the adapter */
bm_chip_setup(sc);
- /* setup MII */
- error = mii_phy_probe(dev, &sc->sc_miibus, bm_ifmedia_upd,
- bm_ifmedia_sts);
- if (error != 0)
- device_printf(dev,"PHY probe failed: %d\n", error);
+ /*
+ * Setup MII
+ * On Apple BMAC controllers, we end up in a weird state of
+ * partially-completed autonegotiation on boot. So we force
+ * autonegotation to try again.
+ */
+ error = mii_attach(dev, &sc->sc_miibus, ifp, bm_ifmedia_upd,
+ bm_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY,
+ MIIF_FORCEANEG);
+ if (error != 0) {
+ device_printf(dev, "attaching PHYs failed\n");
+ return (error);
+ }
sc->sc_mii = device_get_softc(sc->sc_miibus);