diff options
author | jhb <jhb@FreeBSD.org> | 2007-02-21 18:17:44 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2007-02-21 18:17:44 +0000 |
commit | cacf0d22c40108d2bf73286869a50235afa4a913 (patch) | |
tree | 3076263f608486e26ab04e525a5ae2f7cdc6883f /sys/dev | |
parent | a5cba253f7c129dcf48fc6203b925b8ec7dad484 (diff) | |
download | FreeBSD-src-cacf0d22c40108d2bf73286869a50235afa4a913.zip FreeBSD-src-cacf0d22c40108d2bf73286869a50235afa4a913.tar.gz |
Restore support for the 5706C bce(4) phy that was broken during the
addition of SerDes support. According to the docs, the 5706C and 5708C
phys are supposed to use the same MII model that is separate from the
SerDes parts, but the 5706C actually uses the MII model of the SerDes
parts. To fix this, readd the old 5706C entry to miidevs and add a
special check in brgphy_probe() for phys that match the 5706C ID. If
the phy is supported by the gentbi(4) driver, then it's a SerDes phy, so
we fail the probe and let gentbi(4) grab it. Otherwise, it's a 5706C phy,
so we let brgphy(4) grab it.
In coordination with: dwhite
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/mii/brgphy.c | 53 | ||||
-rw-r--r-- | sys/dev/mii/miidevs | 3 |
2 files changed, 54 insertions, 2 deletions
diff --git a/sys/dev/mii/brgphy.c b/sys/dev/mii/brgphy.c index 247e83f..06a3d6f 100644 --- a/sys/dev/mii/brgphy.c +++ b/sys/dev/mii/brgphy.c @@ -97,6 +97,7 @@ static void brgphy_status(struct mii_softc *); static int brgphy_mii_phy_auto(struct mii_softc *); static void brgphy_reset(struct mii_softc *); static void brgphy_loop(struct mii_softc *); +static int bcm5706_is_tbi(device_t); static void bcm5401_load_dspcode(struct mii_softc *); static void bcm5411_load_dspcode(struct mii_softc *); static void brgphy_fixup_5704_a0_bug(struct mii_softc *); @@ -122,6 +123,7 @@ static const struct mii_phydesc brgphys[] = { MII_PHY_DESC(xxBROADCOM, BCM5752), MII_PHY_DESC(xxBROADCOM, BCM5754), MII_PHY_DESC(xxBROADCOM, BCM5780), + MII_PHY_DESC(xxBROADCOM, BCM5708C), MII_PHY_DESC(xxBROADCOM_ALT1, BCM5787), MII_PHY_END }; @@ -129,8 +131,29 @@ static const struct mii_phydesc brgphys[] = { static int brgphy_probe(device_t dev) { + struct mii_attach_args *ma; + int error; - return (mii_phy_dev_probe(dev, brgphys, BUS_PROBE_DEFAULT)); + error = mii_phy_dev_probe(dev, brgphys, BUS_PROBE_DEFAULT); + if (error != BUS_PROBE_DEFAULT) + return (error); + + ma = device_get_ivars(dev); + if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_xxBROADCOM && + MII_MODEL(ma->mii_id2) == MII_MODEL_xxBROADCOM_BCM5706C) { + /* + * Broadcom uses the same MII model ID on two + * different types of phys. The first is found on the + * BCM 5706 and is supported by this driver. The + * other is found on the BCM 5706S and 5708S and is + * supported by the gentbi(4) driver, so we check to + * see if this phy is supported by gentbi(4) and fail + * the probe if so. + */ + if (bcm5706_is_tbi(dev)) + return (ENXIO); + } + return (error); } static int @@ -488,6 +511,34 @@ brgphy_loop(struct mii_softc *sc) } } +/* + * Check to see if a 5706 phy is really a SerDes phy. Copied from + * gentbi_probe(). + */ +static int +bcm5706_is_tbi(device_t dev) +{ + device_t parent; + struct mii_attach_args *ma; + int bmsr, extsr; + + parent = device_get_parent(dev); + ma = device_get_ivars(dev); + + bmsr = MIIBUS_READREG(parent, ma->mii_phyno, MII_BMSR); + if ((bmsr & BMSR_EXTSTAT) == 0 || (bmsr & BMSR_MEDIAMASK) != 0) + return (0); + + extsr = MIIBUS_READREG(parent, ma->mii_phyno, MII_EXTSR); + if (extsr & (EXTSR_1000TFDX|EXTSR_1000THDX)) + return (0); + + if (extsr & (EXTSR_1000XFDX|EXTSR_1000XHDX)) + return (1); + + return (0); +} + /* Turn off tap power management on 5401. */ static void bcm5401_load_dspcode(struct mii_softc *sc) diff --git a/sys/dev/mii/miidevs b/sys/dev/mii/miidevs index 705f5e8..bee3fc2 100644 --- a/sys/dev/mii/miidevs +++ b/sys/dev/mii/miidevs @@ -123,13 +123,14 @@ model xxBROADCOM BCM5411 0x0007 BCM5411 10/100/1000baseTX PHY model xxBROADCOM BCM5754 0x000e BCM5754 10/100/1000baseTX PHY model xxBROADCOM BCM5752 0x0010 BCM5752 10/100/1000baseTX PHY model xxBROADCOM BCM5701 0x0011 BCM5701 10/100/1000baseTX PHY +model xxBROADCOM BCM5706C 0x0015 BCM5706C 10/100/1000baseTX PHY model xxBROADCOM BCM5703 0x0016 BCM5703 10/100/1000baseTX PHY model xxBROADCOM BCM5704 0x0019 BCM5704 10/100/1000baseTX PHY model xxBROADCOM BCM5705 0x001a BCM5705 10/100/1000baseTX PHY model xxBROADCOM BCM5750 0x0018 BCM5750 10/100/1000baseTX PHY model xxBROADCOM BCM5714 0x0034 BCM5714 10/100/1000baseTX PHY model xxBROADCOM BCM5780 0x0035 BCM5780 10/100/1000baseTX PHY -model xxBROADCOM BCM5706C 0x0036 BCM5706C/5708C 10/100/1000baseTX PHY +model xxBROADCOM BCM5708C 0x0036 BCM5708C 10/100/1000baseTX PHY model xxBROADCOM_ALT1 BCM5787 0x000e BCM5787 10/100/1000baseTX PHY /* Cicada Semiconductor PHYs (now owned by Vitesse?) */ |