Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Remove the has-mii-doesn't-have-mii OPMODE block ...



details:   https://anonhg.NetBSD.org/src/rev/f5a25c736ece
branches:  trunk
changeset: 476579:f5a25c736ece
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Sep 20 19:52:31 1999 +0000

description:
Remove the has-mii-doesn't-have-mii OPMODE block from tlp_init(), and
let the pre-init hook and media switch routines handle it all.

diffstat:

 sys/dev/ic/tulip.c |  47 ++++++++++++++---------------------------------
 1 files changed, 14 insertions(+), 33 deletions(-)

diffs (76 lines):

diff -r bac71da95931 -r f5a25c736ece sys/dev/ic/tulip.c
--- a/sys/dev/ic/tulip.c        Mon Sep 20 19:34:08 1999 +0000
+++ b/sys/dev/ic/tulip.c        Mon Sep 20 19:52:31 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tulip.c,v 1.14 1999/09/20 19:34:08 thorpej Exp $       */
+/*     $NetBSD: tulip.c,v 1.15 1999/09/20 19:52:31 thorpej Exp $       */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -1379,37 +1379,6 @@
        sc->sc_opmode |= OPMODE_SR | OPMODE_ST |
            sc->sc_txth[sc->sc_txthresh].txth_opmode;
 
-       if (sc->sc_flags & TULIPF_HAS_MII) {
-               switch (sc->sc_chip) {
-               case TULIP_CHIP_82C168:
-               case TULIP_CHIP_82C169:
-                       /* Enable the MII port. */
-                       sc->sc_opmode |= OPMODE_PS;
-
-                       TULIP_WRITE(sc, CSR_PNIC_ENDEC, PNIC_ENDEC_JDIS);
-                       break;
-
-               case TULIP_CHIP_WB89C840F:
-                       /* Nothing. */
-                       break;
-
-               default:
-                       /* Enable the MII port. */
-                       sc->sc_opmode |= OPMODE_PS;
-                       break;
-               }
-       } else {
-               switch (sc->sc_chip) {
-               case TULIP_CHIP_82C168:
-               case TULIP_CHIP_82C169:
-                       sc->sc_opmode |= OPMODE_PNIC_TBEN;
-                       break;
-
-               default:
-                       /* Nothing. */
-               }
-       }
-
        /*
         * Magical mystery initialization on the Macronix chips.
         * The MX98713 uses its own magic value, the rest share
@@ -2797,6 +2766,12 @@
        }
 
        TULIP_WRITE(sc, CSR_OPMODE, sc->sc_opmode);
+
+       /*
+        * If not using MII, enable the Tx backoff counter.
+        */
+       if ((sc->sc_flags & TULIPF_HAS_MII) == 0)
+               sc->sc_opmode |= OPMODE_PNIC_TBEN;
 }
 
 /*****************************************************************************
@@ -3377,8 +3352,14 @@
        struct ifnet *ifp = &sc->sc_ethercom.ec_if;
        struct mii_data *mii = &sc->sc_mii;
 
-       if (sc->sc_flags & TULIPF_HAS_MII)
+       if (sc->sc_flags & TULIPF_HAS_MII) {
+               /*
+                * Make sure the built-in Tx jabber timer is disabled.
+                */
+               TULIP_WRITE(sc, CSR_PNIC_ENDEC, PNIC_ENDEC_JDIS);
+
                return (tlp_mii_setmedia(sc));
+       }
 
        if (ifp->if_flags & IFF_UP) {
                mii->mii_media_status = 0;



Home | Main Index | Thread Index | Old Index