Deleted Added
full compact
59c59
< __FBSDID("$FreeBSD: head/sys/dev/mii/bmtphy.c 215716 2010-11-22 21:24:29Z marius $");
---
> __FBSDID("$FreeBSD: head/sys/dev/mii/bmtphy.c 215720 2010-11-22 22:03:11Z marius $");
87a88,92
> struct bmtphy_softc {
> struct mii_softc mii_sc;
> int mii_model;
> };
>
103c108
< sizeof(struct mii_softc)
---
> sizeof(struct bmtphy_softc)
109a115
> static void bmtphy_reset(struct mii_softc *);
113a120
> MII_PHY_DESC(BROADCOM, BCM5214),
114a122
> MII_PHY_DESC(BROADCOM, BCM5222),
140,142c148,151
< struct mii_softc *sc;
< struct mii_attach_args *ma;
< struct mii_data *mii;
---
> struct bmtphy_softc *bsc;
> struct mii_softc *sc;
> struct mii_attach_args *ma;
> struct mii_data *mii;
144c153,154
< sc = device_get_softc(dev);
---
> bsc = device_get_softc(dev);
> sc = &bsc->mii_sc;
158c168
< mii_phy_reset(sc);
---
> bsc->mii_model = MII_MODEL(ma->mii_id2);
159a170,171
> bmtphy_reset(sc);
>
199d210
<
206,208c217,219
< struct mii_data *mii;
< struct ifmedia_entry *ife;
< int bmsr, bmcr, aux_csr;
---
> struct mii_data *mii;
> struct ifmedia_entry *ife;
> int bmsr, bmcr, aux_csr;
217d227
< aux_csr = PHY_READ(sc, MII_BMTPHY_AUX_CSR);
242a253
> aux_csr = PHY_READ(sc, MII_BMTPHY_AUX_CSR);
254a266,294
>
> static void
> bmtphy_reset(struct mii_softc *sc)
> {
> struct bmtphy_softc *bsc;
> u_int16_t data;
>
> bsc = (struct bmtphy_softc *)sc;
>
> mii_phy_reset(sc);
>
> if (bsc->mii_model == MII_MODEL_BROADCOM_BCM5221) {
> /* Enable shadow register mode. */
> data = PHY_READ(sc, 0x1f);
> PHY_WRITE(sc, 0x1f, data | 0x0080);
>
> /* Enable APD (Auto PowerDetect). */
> data = PHY_READ(sc, MII_BMTPHY_AUX2);
> PHY_WRITE(sc, MII_BMTPHY_AUX2, data | 0x0020);
>
> /* Enable clocks across APD for Auto-MDIX functionality. */
> data = PHY_READ(sc, MII_BMTPHY_INTR);
> PHY_WRITE(sc, MII_BMTPHY_INTR, data | 0x0004);
>
> /* Disable shadow register mode. */
> data = PHY_READ(sc, 0x1f);
> PHY_WRITE(sc, 0x1f, data & ~0x0080);
> }
> }