Deleted Added
sdiff udiff text old ( 216623 ) new ( 221407 )
full compact
1/*-
2 * Copyright (c) 2001 Wind River Systems
3 * Copyright (c) 2001
4 * Bill Paul <wpaul@bsdi.com>. All rights reserved.
5 * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
6 * All rights reserved.
7 *
8 * This code is derived from software contributed to The NetBSD Foundation

--- 24 unchanged lines hidden (view full) ---

33 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
37 * THE POSSIBILITY OF SUCH DAMAGE.
38 */
39
40#include <sys/cdefs.h>
41__FBSDID("$FreeBSD: head/sys/dev/mii/nsgphy.c 216623 2010-12-21 21:12:18Z marius $");
42
43/*
44 * Driver for the National Semiconductor DP83861, DP83865 and DP83891
45 * 10/100/1000 PHYs.
46 * Datasheet available at: http://www.national.com/ds/DP/DP83861.pdf
47 * and at: http://www.national.com/ds/DP/DP83865.pdf
48 *
49 * The DP83891 is the older NS GigE PHY which isn't being sold

--- 45 unchanged lines hidden (view full) ---

95};
96
97DRIVER_MODULE(nsgphy, miibus, nsgphy_driver, nsgphy_devclass, 0, 0);
98
99static int nsgphy_service(struct mii_softc *, struct mii_data *,int);
100static void nsgphy_status(struct mii_softc *);
101
102static const struct mii_phydesc nsgphys[] = {
103 MII_PHY_DESC(NATSEMI, DP83861),
104 MII_PHY_DESC(NATSEMI, DP83865),
105 MII_PHY_DESC(NATSEMI, DP83891),
106 MII_PHY_END
107};
108
109static int
110nsgphy_probe(device_t dev)
111{
112
113 return (mii_phy_dev_probe(dev, nsgphys, BUS_PROBE_DEFAULT));
114}
115
116static int
117nsgphy_attach(device_t dev)
118{
119 struct mii_softc *sc;
120 struct mii_attach_args *ma;
121 struct mii_data *mii;
122
123 sc = device_get_softc(dev);
124 ma = device_get_ivars(dev);
125 if (bootverbose)
126 device_printf(dev, "<rev. %d>\n", MII_REV(ma->mii_id2));
127 device_printf(dev, " ");
128 sc->mii_dev = device_get_parent(dev);
129 mii = ma->mii_data;
130 LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
131
132 sc->mii_flags = miibus_get_flags(dev);
133 sc->mii_inst = mii->mii_instance++;
134 sc->mii_phy = ma->mii_phyno;
135 sc->mii_service = nsgphy_service;
136 sc->mii_pdata = mii;
137
138 sc->mii_flags |= MIIF_NOMANPAUSE;
139
140 mii_phy_reset(sc);
141
142 /*
143 * NB: the PHY has the 10BASE-T BMSR bits hard-wired to 0,
144 * even though it supports 10BASE-T.
145 */
146 sc->mii_capabilities = (PHY_READ(sc, MII_BMSR) |
147 BMSR_10TFDX | BMSR_10THDX) & ma->mii_capmask;
148 /*
149 * Note that as documented manual 1000BASE-T modes of DP83865 only
150 * work together with other National Semiconductor PHYs.
151 */
152 if (sc->mii_capabilities & BMSR_EXTSTAT)
153 sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR);
154
155 mii_phy_add_media(sc);

--- 23 unchanged lines hidden (view full) ---

179
180 case MII_TICK:
181 if (mii_phy_tick(sc) == EJUSTRETURN)
182 return (0);
183 break;
184 }
185
186 /* Update the media status. */
187 nsgphy_status(sc);
188
189 /* Callback if something changed. */
190 mii_phy_update(sc, cmd);
191 return (0);
192}
193
194static void
195nsgphy_status(struct mii_softc *sc)

--- 66 unchanged lines hidden ---