Deleted Added
full compact
nsphyter.c (215716) nsphyter.c (221407)
1/* $NetBSD: nsphyter.c,v 1.28 2008/01/20 07:58:19 msaitoh Exp $ */
2
3/*-
4 * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,

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

50 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
51 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
52 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
53 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
54 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
55 */
56
57#include <sys/cdefs.h>
1/* $NetBSD: nsphyter.c,v 1.28 2008/01/20 07:58:19 msaitoh Exp $ */
2
3/*-
4 * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,

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

50 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
51 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
52 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
53 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
54 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
55 */
56
57#include <sys/cdefs.h>
58__FBSDID("$FreeBSD: head/sys/dev/mii/nsphyter.c 215716 2010-11-22 21:24:29Z marius $");
58__FBSDID("$FreeBSD: head/sys/dev/mii/nsphyter.c 221407 2011-05-03 19:51:29Z marius $");
59
60/*
61 * driver for National Semiconductor's DP83843 `PHYTER' ethernet 10/100 PHY
62 * Data Sheet available from www.national.com
63 *
64 * We also support the DP83815 `MacPHYTER' internal PHY since, for our
65 * purposes, they are compatible.
66 */

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

105};
106
107DRIVER_MODULE(nsphyter, miibus, nsphyter_driver, nsphyter_devclass, 0, 0);
108
109static int nsphyter_service(struct mii_softc *, struct mii_data *, int);
110static void nsphyter_status(struct mii_softc *);
111static void nsphyter_reset(struct mii_softc *);
112
59
60/*
61 * driver for National Semiconductor's DP83843 `PHYTER' ethernet 10/100 PHY
62 * Data Sheet available from www.national.com
63 *
64 * We also support the DP83815 `MacPHYTER' internal PHY since, for our
65 * purposes, they are compatible.
66 */

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

105};
106
107DRIVER_MODULE(nsphyter, miibus, nsphyter_driver, nsphyter_devclass, 0, 0);
108
109static int nsphyter_service(struct mii_softc *, struct mii_data *, int);
110static void nsphyter_status(struct mii_softc *);
111static void nsphyter_reset(struct mii_softc *);
112
113static const struct mii_phydesc nsphys[] = {
114 MII_PHY_DESC(NATSEMI, DP83815),
115 MII_PHY_DESC(NATSEMI, DP83843),
116 MII_PHY_DESC(NATSEMI, DP83847),
113static const struct mii_phydesc nsphyters[] = {
114 MII_PHY_DESC(xxNATSEMI, DP83815),
115 MII_PHY_DESC(xxNATSEMI, DP83843),
116 MII_PHY_DESC(xxNATSEMI, DP83847),
117 MII_PHY_END
118};
119
117 MII_PHY_END
118};
119
120static const struct mii_phy_funcs nsphyter_funcs = {
121 nsphyter_service,
122 nsphyter_status,
123 nsphyter_reset
124};
125
120static int
121nsphyter_probe(device_t dev)
122{
123
126static int
127nsphyter_probe(device_t dev)
128{
129
124 return (mii_phy_dev_probe(dev, nsphys, BUS_PROBE_DEFAULT));
130 return (mii_phy_dev_probe(dev, nsphyters, BUS_PROBE_DEFAULT));
125}
126
127static int
128nsphyter_attach(device_t dev)
129{
131}
132
133static int
134nsphyter_attach(device_t dev)
135{
130 struct mii_softc *sc;
131 struct mii_attach_args *ma;
132 struct mii_data *mii;
133
136
134 sc = device_get_softc(dev);
135 ma = device_get_ivars(dev);
136 sc->mii_dev = device_get_parent(dev);
137 mii = ma->mii_data;
138 LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
139
140 sc->mii_flags = miibus_get_flags(dev);
141 sc->mii_inst = mii->mii_instance++;
142 sc->mii_phy = ma->mii_phyno;
143 sc->mii_service = nsphyter_service;
144 sc->mii_pdata = mii;
145
146 sc->mii_flags |= MIIF_NOMANPAUSE;
147
148#if 1
149
150#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
151
152 /*
153 * XXX IFM_LOOP should be handled by mii_phy_add_media() based
154 * on MIIF_NOLOOP.
155 */
156 if ((sc->mii_flags & MIIF_NOLOOP) == 0)
157 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP,
158 sc->mii_inst), MII_MEDIA_100_TX);
159
160#endif
161
162 nsphyter_reset(sc);
163
164 sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
165 device_printf(dev, " ");
166 mii_phy_add_media(sc);
167 printf("\n");
168
169 MIIBUS_MEDIAINIT(sc->mii_dev);
137 mii_phy_dev_attach(dev, MIIF_NOMANPAUSE, &nsphyter_funcs, 1);
170 return (0);
171}
172
173static int
174nsphyter_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
175{
176
177 switch (cmd) {

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

190
191 case MII_TICK:
192 if (mii_phy_tick(sc) == EJUSTRETURN)
193 return (0);
194 break;
195 }
196
197 /* Update the media status. */
138 return (0);
139}
140
141static int
142nsphyter_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
143{
144
145 switch (cmd) {

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

158
159 case MII_TICK:
160 if (mii_phy_tick(sc) == EJUSTRETURN)
161 return (0);
162 break;
163 }
164
165 /* Update the media status. */
198 nsphyter_status(sc);
166 PHY_STATUS(sc);
199
200 /* Callback if something changed. */
201 mii_phy_update(sc, cmd);
202 return (0);
203}
204
205static void
206nsphyter_status(struct mii_softc *sc)

--- 92 unchanged lines hidden ---
167
168 /* Callback if something changed. */
169 mii_phy_update(sc, cmd);
170 return (0);
171}
172
173static void
174nsphyter_status(struct mii_softc *sc)

--- 92 unchanged lines hidden ---