Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic use the SROM info to set the media in 2114[23] au...
details: https://anonhg.NetBSD.org/src/rev/2f4165d0e6b1
branches: trunk
changeset: 534068:2f4165d0e6b1
user: chs <chs%NetBSD.org@localhost>
date: Sun Jul 14 21:02:41 2002 +0000
description:
use the SROM info to set the media in 2114[23] autonegotiation
rather than just fiddling the opmode CSR, since we might
need to change the SIA CSRs as well (eg. for some ZNYX cards).
from PR 17510.
diffstat:
sys/dev/ic/tulip.c | 46 ++++++++++++++++++++++------------------------
1 files changed, 22 insertions(+), 24 deletions(-)
diffs (94 lines):
diff -r d2a42aea5fd0 -r 2f4165d0e6b1 sys/dev/ic/tulip.c
--- a/sys/dev/ic/tulip.c Sun Jul 14 20:56:12 2002 +0000
+++ b/sys/dev/ic/tulip.c Sun Jul 14 21:02:41 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tulip.c,v 1.117 2002/07/09 20:19:57 chuck Exp $ */
+/* $NetBSD: tulip.c,v 1.118 2002/07/14 21:02:41 chs Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.117 2002/07/09 20:19:57 chuck Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.118 2002/07/14 21:02:41 chs Exp $");
#include "bpfilter.h"
@@ -3938,6 +3938,7 @@
void tlp_sia_update_link __P((struct tulip_softc *));
void tlp_sia_get __P((struct tulip_softc *, struct ifmediareq *));
int tlp_sia_set __P((struct tulip_softc *));
+int tlp_sia_media __P((struct tulip_softc *, struct ifmedia_entry *));
void tlp_sia_fixup __P((struct tulip_softc *));
void
@@ -4079,10 +4080,17 @@
tlp_sia_set(sc)
struct tulip_softc *sc;
{
+
+ return (tlp_sia_media(sc, TULIP_CURRENT_MEDIA(sc)));
+}
+
+int
+tlp_sia_media(sc, ife)
+ struct tulip_softc *sc;
struct ifmedia_entry *ife;
+{
struct tulip_21x4x_media *tm;
- ife = TULIP_CURRENT_MEDIA(sc);
tm = ife->ifm_aux;
/*
@@ -4111,7 +4119,7 @@
TULIP_WRITE(sc, CSR_SIAGEN, tm->tm_siagen | tm->tm_gpdata);
break;
default:
- TULIP_WRITE(sc, CSR_SIAGEN, tm->tm_siagen);
+ TULIP_WRITE(sc, CSR_SIAGEN, tm->tm_siagen);
}
TULIP_WRITE(sc, CSR_SIACONN, tm->tm_siaconn);
@@ -5020,29 +5028,19 @@
{
struct tulip_softc *sc = (struct tulip_softc *)self;
struct mii_data *mii = &sc->sc_mii;
+ struct ifmedia_entry *ife;
if (IFM_SUBTYPE(mii->mii_media_active) == IFM_NONE)
return;
-
- /* Idle the transmit and receive processes. */
- tlp_idle(sc, OPMODE_ST|OPMODE_SR);
-
- sc->sc_opmode &= ~(OPMODE_TTM|OPMODE_FD|OPMODE_PS|OPMODE_PCS|
- OPMODE_SCR|OPMODE_HBD);
-
- if (IFM_SUBTYPE(mii->mii_media_active) == IFM_10_T)
- sc->sc_opmode |= OPMODE_TTM;
- else
- sc->sc_opmode |= OPMODE_PS|OPMODE_PCS|OPMODE_SCR|OPMODE_HBD;
-
- if (mii->mii_media_active & IFM_FDX)
- sc->sc_opmode |= OPMODE_FD|OPMODE_HBD;
-
- /*
- * Write new OPMODE bits. This also restarts the transmit
- * and receive processes.
- */
- TULIP_WRITE(sc, CSR_OPMODE, sc->sc_opmode);
+
+ if ((ife = ifmedia_match(&mii->mii_media, mii->mii_media_active,
+ mii->mii_media.ifm_mask)) == NULL) {
+ printf("tlp_2114x_nway_statchg: no match for media 0x%x/0x%x\n",
+ mii->mii_media_active, ~mii->mii_media.ifm_mask);
+ panic("tlp_2114x_nway_statchg");
+ }
+
+ tlp_sia_media(sc, ife);
}
void
Home |
Main Index |
Thread Index |
Old Index