Deleted Added
full compact
ukphy.c (95722) ukphy.c (95723)
1/* $NetBSD: ukphy.c,v 1.2 1999/04/23 04:24:32 thorpej Exp $ */
2
3/*-
4 * Copyright (c) 1998, 1999 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,

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

84
85#include <dev/mii/mii.h>
86#include <dev/mii/miivar.h>
87
88#include "miibus_if.h"
89
90#if !defined(lint)
91static const char rcsid[] =
1/* $NetBSD: ukphy.c,v 1.2 1999/04/23 04:24:32 thorpej Exp $ */
2
3/*-
4 * Copyright (c) 1998, 1999 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,

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

84
85#include <dev/mii/mii.h>
86#include <dev/mii/miivar.h>
87
88#include "miibus_if.h"
89
90#if !defined(lint)
91static const char rcsid[] =
92 "$FreeBSD: head/sys/dev/mii/ukphy.c 95722 2002-04-29 13:07:38Z phk $";
92 "$FreeBSD: head/sys/dev/mii/ukphy.c 95723 2002-04-29 13:35:31Z phk $";
93#endif
94
95static int ukphy_probe (device_t);
96static int ukphy_attach (device_t);
97
98static device_method_t ukphy_methods[] = {
99 /* device interface */
100 DEVMETHOD(device_probe, ukphy_probe),

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

151 sc->mii_phy = ma->mii_phyno;
152 sc->mii_service = ukphy_service;
153 sc->mii_pdata = mii;
154
155 mii->mii_instance++;
156
157 sc->mii_flags |= MIIF_NOISOLATE;
158
93#endif
94
95static int ukphy_probe (device_t);
96static int ukphy_attach (device_t);
97
98static device_method_t ukphy_methods[] = {
99 /* device interface */
100 DEVMETHOD(device_probe, ukphy_probe),

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

151 sc->mii_phy = ma->mii_phyno;
152 sc->mii_service = ukphy_service;
153 sc->mii_pdata = mii;
154
155 mii->mii_instance++;
156
157 sc->mii_flags |= MIIF_NOISOLATE;
158
159#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
160
161 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst),
162 BMCR_ISO);
163#if 0
164 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst),
165 BMCR_LOOP|BMCR_S100);
166#endif
167
168 mii_phy_reset(sc);
169
170 sc->mii_capabilities =
171 PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
159 mii_phy_reset(sc);
160
161 sc->mii_capabilities =
162 PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
163 if (sc->mii_capabilities & BMSR_EXTSTAT)
164 sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR);
172 device_printf(dev, " ");
165 device_printf(dev, " ");
173 mii_add_media(sc);
166 mii_phy_add_media(sc);
174 printf("\n");
167 printf("\n");
175#undef ADD
176
177 MIIBUS_MEDIAINIT(sc->mii_dev);
178
179 return(0);
180}
181
182static int
183ukphy_service(sc, mii, cmd)

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

209 }
210
211 /*
212 * If the interface is not up, don't do anything.
213 */
214 if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
215 break;
216
168
169 MIIBUS_MEDIAINIT(sc->mii_dev);
170
171 return(0);
172}
173
174static int
175ukphy_service(sc, mii, cmd)

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

201 }
202
203 /*
204 * If the interface is not up, don't do anything.
205 */
206 if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
207 break;
208
217 switch (IFM_SUBTYPE(ife->ifm_media)) {
218 case IFM_AUTO:
219 /*
220 * If we're already in auto mode, just return.
221 */
222 if (PHY_READ(sc, MII_BMCR) & BMCR_AUTOEN)
223 return (0);
224 (void) mii_phy_auto(sc, 1);
225 break;
226 case IFM_100_T4:
227 /*
228 * XXX Not supported as a manual setting right now.
229 */
230 return (EINVAL);
231 default:
232 /*
233 * BMCR data is stored in the ifmedia entry.
234 */
235 PHY_WRITE(sc, MII_ANAR,
236 mii_anar(ife->ifm_media));
237 PHY_WRITE(sc, MII_BMCR, ife->ifm_data);
238 }
209 mii_phy_setmedia(sc);
239 break;
240
241 case MII_TICK:
242 /*
243 * If we're not currently selected, just return.
244 */
245 if (IFM_INST(ife->ifm_media) != sc->mii_inst)
246 return (0);

--- 12 unchanged lines hidden ---
210 break;
211
212 case MII_TICK:
213 /*
214 * If we're not currently selected, just return.
215 */
216 if (IFM_INST(ife->ifm_media) != sc->mii_inst)
217 return (0);

--- 12 unchanged lines hidden ---