mii_physubr.c revision 1.58 1 /* $NetBSD: mii_physubr.c,v 1.58 2008/02/29 06:40:38 dyoung 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,
9 * NASA Ames Research Center.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. All advertising materials mentioning features or use of this software
20 * must display the following acknowledgement:
21 * This product includes software developed by the NetBSD
22 * Foundation, Inc. and its contributors.
23 * 4. Neither the name of The NetBSD Foundation nor the names of its
24 * contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
28 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
29 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
31 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
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 THE
37 * POSSIBILITY OF SUCH DAMAGE.
38 */
39
40 /*
41 * Subroutines common to all PHYs.
42 */
43
44 #include <sys/cdefs.h>
45 __KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.58 2008/02/29 06:40:38 dyoung Exp $");
46
47 #include <sys/param.h>
48 #include <sys/device.h>
49 #include <sys/systm.h>
50 #include <sys/kernel.h>
51 #include <sys/socket.h>
52 #include <sys/errno.h>
53 #include <sys/proc.h>
54
55 #include <net/if.h>
56 #include <net/if_media.h>
57 #include <net/route.h>
58
59 #include <dev/mii/mii.h>
60 #include <dev/mii/miivar.h>
61
62 static void mii_phy_statusmsg(struct mii_softc *);
63
64 /*
65 * Media to register setting conversion table. Order matters.
66 */
67 static const struct mii_media mii_media_table[MII_NMEDIA] = {
68 /* None */
69 { BMCR_ISO, ANAR_CSMA,
70 0, },
71
72 /* 10baseT */
73 { BMCR_S10, ANAR_CSMA|ANAR_10,
74 0, },
75
76 /* 10baseT-FDX */
77 { BMCR_S10|BMCR_FDX, ANAR_CSMA|ANAR_10_FD,
78 0, },
79
80 /* 100baseT4 */
81 { BMCR_S100, ANAR_CSMA|ANAR_T4,
82 0, },
83
84 /* 100baseTX */
85 { BMCR_S100, ANAR_CSMA|ANAR_TX,
86 0, },
87
88 /* 100baseTX-FDX */
89 { BMCR_S100|BMCR_FDX, ANAR_CSMA|ANAR_TX_FD,
90 0, },
91
92 /* 1000baseX */
93 { BMCR_S1000, ANAR_CSMA,
94 0, },
95
96 /* 1000baseX-FDX */
97 { BMCR_S1000|BMCR_FDX, ANAR_CSMA,
98 0, },
99
100 /* 1000baseT */
101 { BMCR_S1000, ANAR_CSMA,
102 GTCR_ADV_1000THDX },
103
104 /* 1000baseT-FDX */
105 { BMCR_S1000, ANAR_CSMA,
106 GTCR_ADV_1000TFDX },
107 };
108
109 static void mii_phy_auto_timeout(void *);
110
111 void
112 mii_phy_setmedia(struct mii_softc *sc)
113 {
114 struct mii_data *mii = sc->mii_pdata;
115 struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
116 int bmcr, anar, gtcr;
117
118 if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO) {
119 /*
120 * Force renegotiation if MIIF_DOPAUSE.
121 *
122 * XXX This is only necessary because many NICs don't
123 * XXX advertise PAUSE capabilities at boot time. Maybe
124 * XXX we should force this only once?
125 */
126 if ((PHY_READ(sc, MII_BMCR) & BMCR_AUTOEN) == 0 ||
127 (sc->mii_flags & (MIIF_FORCEANEG|MIIF_DOPAUSE)))
128 (void) mii_phy_auto(sc, 1);
129 return;
130 }
131
132 /*
133 * Table index is stored in the media entry.
134 */
135
136 #ifdef DIAGNOSTIC
137 if (/* ife->ifm_data < 0 || */ ife->ifm_data >= MII_NMEDIA)
138 panic("mii_phy_setmedia");
139 #endif
140
141 anar = mii_media_table[ife->ifm_data].mm_anar;
142 bmcr = mii_media_table[ife->ifm_data].mm_bmcr;
143 gtcr = mii_media_table[ife->ifm_data].mm_gtcr;
144
145 if (mii->mii_media.ifm_media & IFM_ETH_MASTER) {
146 switch (IFM_SUBTYPE(ife->ifm_media)) {
147 case IFM_1000_T:
148 gtcr |= GTCR_MAN_MS|GTCR_ADV_MS;
149 break;
150
151 default:
152 panic("mii_phy_setmedia: MASTER on wrong media");
153 }
154 }
155
156 if (mii->mii_media.ifm_media & IFM_FLOW) {
157 if (sc->mii_flags & MIIF_IS_1000X)
158 anar |= ANAR_X_PAUSE_SYM | ANAR_X_PAUSE_ASYM;
159 else {
160 anar |= ANAR_FC;
161 /* XXX Only 1000BASE-T has PAUSE_ASYM? */
162 if ((sc->mii_flags & MIIF_HAVE_GTCR) &&
163 (sc->mii_extcapabilities &
164 (EXTSR_1000THDX|EXTSR_1000TFDX)))
165 anar |= ANAR_X_PAUSE_ASYM;
166 }
167 }
168
169 if (ife->ifm_media & IFM_LOOP)
170 bmcr |= BMCR_LOOP;
171
172 PHY_WRITE(sc, MII_ANAR, anar);
173 PHY_WRITE(sc, MII_BMCR, bmcr);
174 if (sc->mii_flags & MIIF_HAVE_GTCR)
175 PHY_WRITE(sc, MII_100T2CR, gtcr);
176 }
177
178 int
179 mii_phy_auto(struct mii_softc *sc, int waitfor)
180 {
181 int i;
182
183 if ((sc->mii_flags & MIIF_DOINGAUTO) == 0) {
184 /*
185 * Check for 1000BASE-X. Autonegotiation is a bit
186 * different on such devices.
187 */
188 if (sc->mii_flags & MIIF_IS_1000X) {
189 uint16_t anar = 0;
190
191 if (sc->mii_extcapabilities & EXTSR_1000XFDX)
192 anar |= ANAR_X_FD;
193 if (sc->mii_extcapabilities & EXTSR_1000XHDX)
194 anar |= ANAR_X_HD;
195
196 if (sc->mii_flags & MIIF_DOPAUSE) {
197 /* XXX Asymmetric vs. symmetric? */
198 anar |= ANLPAR_X_PAUSE_TOWARDS;
199 }
200
201 PHY_WRITE(sc, MII_ANAR, anar);
202 } else {
203 uint16_t anar;
204
205 anar = BMSR_MEDIA_TO_ANAR(sc->mii_capabilities) |
206 ANAR_CSMA;
207 if (sc->mii_flags & MIIF_DOPAUSE) {
208 anar |= ANAR_FC;
209 /* XXX Only 1000BASE-T has PAUSE_ASYM? */
210 if ((sc->mii_flags & MIIF_HAVE_GTCR) &&
211 (sc->mii_extcapabilities &
212 (EXTSR_1000THDX|EXTSR_1000TFDX)))
213 anar |= ANAR_X_PAUSE_ASYM;
214 }
215 PHY_WRITE(sc, MII_ANAR, anar);
216 if (sc->mii_flags & MIIF_HAVE_GTCR) {
217 uint16_t gtcr = 0;
218
219 if (sc->mii_extcapabilities & EXTSR_1000TFDX)
220 gtcr |= GTCR_ADV_1000TFDX;
221 if (sc->mii_extcapabilities & EXTSR_1000THDX)
222 gtcr |= GTCR_ADV_1000THDX;
223
224 PHY_WRITE(sc, MII_100T2CR, gtcr);
225 }
226 }
227 PHY_WRITE(sc, MII_BMCR, BMCR_AUTOEN | BMCR_STARTNEG);
228 }
229
230 if (waitfor) {
231 /* Wait 500ms for it to complete. */
232 for (i = 0; i < 500; i++) {
233 if (PHY_READ(sc, MII_BMSR) & BMSR_ACOMP)
234 return (0);
235 delay(1000);
236 }
237
238 /*
239 * Don't need to worry about clearing MIIF_DOINGAUTO.
240 * If that's set, a timeout is pending, and it will
241 * clear the flag.
242 */
243 return (EIO);
244 }
245
246 /*
247 * Just let it finish asynchronously. This is for the benefit of
248 * the tick handler driving autonegotiation. Don't want 500ms
249 * delays all the time while the system is running!
250 */
251 if (sc->mii_flags & MIIF_AUTOTSLEEP) {
252 sc->mii_flags |= MIIF_DOINGAUTO;
253 tsleep(&sc->mii_flags, PZERO, "miiaut", hz >> 1);
254 mii_phy_auto_timeout(sc);
255 } else if ((sc->mii_flags & MIIF_DOINGAUTO) == 0) {
256 sc->mii_flags |= MIIF_DOINGAUTO;
257 callout_reset(&sc->mii_nway_ch, hz >> 1,
258 mii_phy_auto_timeout, sc);
259 }
260 return (EJUSTRETURN);
261 }
262
263 static void
264 mii_phy_auto_timeout(void *arg)
265 {
266 struct mii_softc *sc = arg;
267 int s;
268
269 if (!device_is_active(&sc->mii_dev))
270 return;
271
272 s = splnet();
273 sc->mii_flags &= ~MIIF_DOINGAUTO;
274
275 /* Update the media status. */
276 (void) PHY_SERVICE(sc, sc->mii_pdata, MII_POLLSTAT);
277 splx(s);
278 }
279
280 int
281 mii_phy_tick(struct mii_softc *sc)
282 {
283 struct mii_data *mii = sc->mii_pdata;
284 struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
285 int reg;
286
287 /* Just bail now if the interface is down. */
288 if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
289 return (EJUSTRETURN);
290
291 /*
292 * If we're not doing autonegotiation, we don't need to do
293 * any extra work here. However, we need to check the link
294 * status so we can generate an announcement if the status
295 * changes.
296 */
297 if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO)
298 return (0);
299
300 /* Read the status register twice; BMSR_LINK is latch-low. */
301 reg = PHY_READ(sc, MII_BMSR) | PHY_READ(sc, MII_BMSR);
302 if (reg & BMSR_LINK) {
303 /*
304 * See above.
305 */
306 return (0);
307 }
308
309 /*
310 * Only retry autonegotiation every N seconds.
311 */
312 KASSERT(sc->mii_anegticks != 0);
313 if (++sc->mii_ticks <= sc->mii_anegticks)
314 return (EJUSTRETURN);
315
316 sc->mii_ticks = 0;
317 PHY_RESET(sc);
318
319 if (mii_phy_auto(sc, 0) == EJUSTRETURN)
320 return (EJUSTRETURN);
321
322 /*
323 * Might need to generate a status message if autonegotiation
324 * failed.
325 */
326 return (0);
327 }
328
329 void
330 mii_phy_reset(struct mii_softc *sc)
331 {
332 int reg, i;
333
334 if (sc->mii_flags & MIIF_NOISOLATE)
335 reg = BMCR_RESET;
336 else
337 reg = BMCR_RESET | BMCR_ISO;
338 PHY_WRITE(sc, MII_BMCR, reg);
339
340 /* Wait another 100ms for it to complete. */
341 for (i = 0; i < 100; i++) {
342 reg = PHY_READ(sc, MII_BMCR);
343 if ((reg & BMCR_RESET) == 0)
344 break;
345 delay(1000);
346 }
347
348 if (sc->mii_inst != 0 && ((sc->mii_flags & MIIF_NOISOLATE) == 0))
349 PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO);
350 }
351
352 void
353 mii_phy_down(struct mii_softc *sc)
354 {
355
356 if (sc->mii_flags & MIIF_DOINGAUTO) {
357 sc->mii_flags &= ~MIIF_DOINGAUTO;
358 callout_stop(&sc->mii_nway_ch);
359 }
360 }
361
362 void
363 mii_phy_status(struct mii_softc *sc)
364 {
365
366 PHY_STATUS(sc);
367 }
368
369 void
370 mii_phy_update(struct mii_softc *sc, int cmd)
371 {
372 struct mii_data *mii = sc->mii_pdata;
373
374 if (sc->mii_media_active != mii->mii_media_active ||
375 sc->mii_media_status != mii->mii_media_status ||
376 cmd == MII_MEDIACHG) {
377 mii_phy_statusmsg(sc);
378 (*mii->mii_statchg)(device_parent(&sc->mii_dev));
379 sc->mii_media_active = mii->mii_media_active;
380 sc->mii_media_status = mii->mii_media_status;
381 }
382 }
383
384 static void
385 mii_phy_statusmsg(struct mii_softc *sc)
386 {
387 struct mii_data *mii = sc->mii_pdata;
388 struct ifnet *ifp = mii->mii_ifp;
389 int s;
390
391 s = splnet();
392 if (mii->mii_media_status & IFM_AVALID) {
393 if (mii->mii_media_status & IFM_ACTIVE)
394 if_link_state_change(ifp, LINK_STATE_UP);
395 else
396 if_link_state_change(ifp, LINK_STATE_DOWN);
397 } else
398 if_link_state_change(ifp, LINK_STATE_UNKNOWN);
399 splx(s);
400
401 ifp->if_baudrate = ifmedia_baudrate(mii->mii_media_active);
402 }
403
404 /*
405 * Initialize generic PHY media based on BMSR, called when a PHY is
406 * attached. We expect to be set up to print a comma-separated list
407 * of media names. Does not print a newline.
408 */
409 void
410 mii_phy_add_media(struct mii_softc *sc)
411 {
412 struct mii_data *mii = sc->mii_pdata;
413 const char *sep = "";
414 int fdx = 0;
415
416 #define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
417 #define PRINT(n) aprint_normal("%s%s", sep, (n)); sep = ", "
418
419 if ((sc->mii_flags & MIIF_NOISOLATE) == 0)
420 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst),
421 MII_MEDIA_NONE);
422
423 /*
424 * There are different interpretations for the bits in
425 * HomePNA PHYs. And there is really only one media type
426 * that is supported.
427 */
428 if (sc->mii_flags & MIIF_IS_HPNA) {
429 if (sc->mii_capabilities & BMSR_10THDX) {
430 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_HPNA_1, 0,
431 sc->mii_inst),
432 MII_MEDIA_10_T);
433 PRINT("HomePNA1");
434 }
435 return;
436 }
437
438 if (sc->mii_capabilities & BMSR_10THDX) {
439 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, 0, sc->mii_inst),
440 MII_MEDIA_10_T);
441 PRINT("10baseT");
442 }
443 if (sc->mii_capabilities & BMSR_10TFDX) {
444 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, IFM_FDX, sc->mii_inst),
445 MII_MEDIA_10_T_FDX);
446 PRINT("10baseT-FDX");
447 fdx = 1;
448 }
449 if (sc->mii_capabilities & BMSR_100TXHDX) {
450 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, 0, sc->mii_inst),
451 MII_MEDIA_100_TX);
452 PRINT("100baseTX");
453 }
454 if (sc->mii_capabilities & BMSR_100TXFDX) {
455 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_FDX, sc->mii_inst),
456 MII_MEDIA_100_TX_FDX);
457 PRINT("100baseTX-FDX");
458 fdx = 1;
459 }
460 if (sc->mii_capabilities & BMSR_100T4) {
461 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_T4, 0, sc->mii_inst),
462 MII_MEDIA_100_T4);
463 PRINT("100baseT4");
464 }
465
466 if (sc->mii_extcapabilities & EXTSR_MEDIAMASK) {
467 /*
468 * XXX Right now only handle 1000SX and 1000TX. Need
469 * XXX to handle 1000LX and 1000CX some how.
470 *
471 * Note since it can take 5 seconds to auto-negotiate
472 * a gigabit link, we make anegticks 10 seconds for
473 * all the gigabit media types.
474 */
475 if (sc->mii_extcapabilities & EXTSR_1000XHDX) {
476 sc->mii_anegticks = MII_ANEGTICKS_GIGE;
477 sc->mii_flags |= MIIF_IS_1000X;
478 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, 0,
479 sc->mii_inst), MII_MEDIA_1000_X);
480 PRINT("1000baseSX");
481 }
482 if (sc->mii_extcapabilities & EXTSR_1000XFDX) {
483 sc->mii_anegticks = MII_ANEGTICKS_GIGE;
484 sc->mii_flags |= MIIF_IS_1000X;
485 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, IFM_FDX,
486 sc->mii_inst), MII_MEDIA_1000_X_FDX);
487 PRINT("1000baseSX-FDX");
488 fdx = 1;
489 }
490
491 /*
492 * 1000baseT media needs to be able to manipulate
493 * master/slave mode. We set IFM_ETH_MASTER in
494 * the "don't care mask" and filter it out when
495 * the media is set.
496 *
497 * All 1000baseT PHYs have a 1000baseT control register.
498 */
499 if (sc->mii_extcapabilities & EXTSR_1000THDX) {
500 sc->mii_anegticks = MII_ANEGTICKS_GIGE;
501 sc->mii_flags |= MIIF_HAVE_GTCR;
502 mii->mii_media.ifm_mask |= IFM_ETH_MASTER;
503 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_T, 0,
504 sc->mii_inst), MII_MEDIA_1000_T);
505 PRINT("1000baseT");
506 }
507 if (sc->mii_extcapabilities & EXTSR_1000TFDX) {
508 sc->mii_anegticks = MII_ANEGTICKS_GIGE;
509 sc->mii_flags |= MIIF_HAVE_GTCR;
510 mii->mii_media.ifm_mask |= IFM_ETH_MASTER;
511 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_T, IFM_FDX,
512 sc->mii_inst), MII_MEDIA_1000_T_FDX);
513 PRINT("1000baseT-FDX");
514 fdx = 1;
515 }
516 }
517
518 if (sc->mii_capabilities & BMSR_ANEG) {
519 ADD(IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, sc->mii_inst),
520 MII_NMEDIA); /* intentionally invalid index */
521 PRINT("auto");
522 }
523 #undef ADD
524 #undef PRINT
525 if (fdx != 0 && (sc->mii_flags & MIIF_DOPAUSE))
526 mii->mii_media.ifm_mask |= IFM_ETH_FMASK;
527 }
528
529 void
530 mii_phy_delete_media(struct mii_softc *sc)
531 {
532 struct mii_data *mii = sc->mii_pdata;
533
534 ifmedia_delete_instance(&mii->mii_media, sc->mii_inst);
535 }
536
537 int
538 mii_phy_activate(struct device *self, enum devact act)
539 {
540 int rv = 0;
541
542 switch (act) {
543 case DVACT_ACTIVATE:
544 rv = EOPNOTSUPP;
545 break;
546
547 case DVACT_DEACTIVATE:
548 /* Nothing special to do. */
549 break;
550 }
551
552 return (rv);
553 }
554
555 /* ARGSUSED1 */
556 int
557 mii_phy_detach(struct device *self, int flags)
558 {
559 struct mii_softc *sc = device_private(self);
560
561 if (sc->mii_flags & MIIF_DOINGAUTO)
562 callout_stop(&sc->mii_nway_ch);
563
564 mii_phy_delete_media(sc);
565 LIST_REMOVE(sc, mii_list);
566
567 return (0);
568 }
569
570 const struct mii_phydesc *
571 mii_phy_match(const struct mii_attach_args *ma, const struct mii_phydesc *mpd)
572 {
573
574 for (; mpd->mpd_name != NULL; mpd++) {
575 if (MII_OUI(ma->mii_id1, ma->mii_id2) == mpd->mpd_oui &&
576 MII_MODEL(ma->mii_id2) == mpd->mpd_model)
577 return (mpd);
578 }
579 return (NULL);
580 }
581
582 /*
583 * Return the flow control status flag from MII_ANAR & MII_ANLPAR.
584 */
585 u_int
586 mii_phy_flowstatus(struct mii_softc *sc)
587 {
588 u_int anar, anlpar;
589
590 if ((sc->mii_flags & MIIF_DOPAUSE) == 0)
591 return (0);
592
593 anar = PHY_READ(sc, MII_ANAR);
594 anlpar = PHY_READ(sc, MII_ANLPAR);
595
596 if ((anar & ANAR_X_PAUSE_SYM) & (anlpar & ANLPAR_X_PAUSE_SYM))
597 return (IFM_FLOW|IFM_ETH_TXPAUSE|IFM_ETH_RXPAUSE);
598
599 if ((anar & ANAR_X_PAUSE_SYM) == 0) {
600 if ((anar & ANAR_X_PAUSE_ASYM) &&
601 ((anlpar &
602 ANLPAR_X_PAUSE_TOWARDS) == ANLPAR_X_PAUSE_TOWARDS))
603 return (IFM_FLOW|IFM_ETH_TXPAUSE);
604 else
605 return (0);
606 }
607
608 if ((anar & ANAR_X_PAUSE_ASYM) == 0) {
609 if (anlpar & ANLPAR_X_PAUSE_SYM)
610 return (IFM_FLOW|IFM_ETH_TXPAUSE|IFM_ETH_RXPAUSE);
611 else
612 return (0);
613 }
614
615 switch ((anlpar & ANLPAR_X_PAUSE_TOWARDS)) {
616 case ANLPAR_X_PAUSE_NONE:
617 return (0);
618
619 case ANLPAR_X_PAUSE_ASYM:
620 return (IFM_FLOW|IFM_ETH_RXPAUSE);
621
622 default:
623 return (IFM_FLOW|IFM_ETH_RXPAUSE|IFM_ETH_TXPAUSE);
624 }
625 /* NOTREACHED */
626 }
627
628 bool
629 mii_phy_resume(device_t dv PMF_FN_ARGS)
630 {
631 struct mii_softc *sc = device_private(dv);
632
633 PHY_RESET(sc);
634 return PHY_SERVICE(sc, sc->mii_pdata, MII_MEDIACHG) == 0;
635 }
636