Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic Add link-up/link-down detection for the Macronix ...
details: https://anonhg.NetBSD.org/src/rev/c81d3cf7beaa
branches: trunk
changeset: 476859:c81d3cf7beaa
user: thorpej <thorpej%NetBSD.org@localhost>
date: Thu Sep 30 00:07:29 1999 +0000
description:
Add link-up/link-down detection for the Macronix NWay block.
diffstat:
sys/dev/ic/tulip.c | 30 +++++++++++++++++++++++++-----
1 files changed, 25 insertions(+), 5 deletions(-)
diffs (63 lines):
diff -r 62f909792072 -r c81d3cf7beaa sys/dev/ic/tulip.c
--- a/sys/dev/ic/tulip.c Wed Sep 29 23:11:36 1999 +0000
+++ b/sys/dev/ic/tulip.c Thu Sep 30 00:07:29 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tulip.c,v 1.23 1999/09/29 23:11:36 thorpej Exp $ */
+/* $NetBSD: tulip.c,v 1.24 1999/09/30 00:07:29 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -4564,8 +4564,14 @@
/*
* Only retry autonegotiation every 5 seconds.
*/
- if (++sc->sc_nway_ticks != 5)
+ if (++sc->sc_nway_ticks != 5) {
+ /*
+ * Update status; this may indicate link-up
+ * next time around.
+ */
+ tlp_pmac_nway_status(sc);
return (0);
+ }
sc->sc_nway_ticks = 0;
tlp_pmac_nway_reset(sc);
@@ -4675,13 +4681,11 @@
mii->mii_media_status = IFM_AVALID;
mii->mii_media_active = IFM_ETHER;
- if (sc->sc_flags & TULIPF_LINK_UP)
- mii->mii_media_status |= IFM_ACTIVE;
-
if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO) {
if (TULIP_ISSET(sc, CSR_STATUS, STATUS_LNPANC) == 0) {
/* Erg, still trying, I guess... */
mii->mii_media_active |= IFM_NONE;
+ sc->sc_flags &= ~TULIPF_LINK_UP;
return;
}
@@ -4709,6 +4713,22 @@
*/
mii->mii_media_active = ife->ifm_media;
}
+
+ /*
+ * Update link status.
+ */
+ reg = TULIP_READ(sc, CSR_PMAC_10TSTAT);
+ if (IFM_SUBTYPE(mii->mii_media_active) == IFM_10_T &&
+ (reg & PMAC_10TSTAT_LS10) == 0)
+ sc->sc_flags |= TULIPF_LINK_UP;
+ else if (IFM_SUBTYPE(mii->mii_media_active) == IFM_100_TX &&
+ (reg & PMAC_10TSTAT_LS100) == 0)
+ sc->sc_flags |= TULIPF_LINK_UP;
+ else
+ sc->sc_flags &= ~TULIPF_LINK_UP;
+
+ if (sc->sc_flags & TULIPF_LINK_UP)
+ mii->mii_media_status |= IFM_ACTIVE;
}
void
Home |
Main Index |
Thread Index |
Old Index