Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/sys/dev/ic Pull up revisions 1.73, 1.87 (via patch, requ...
details: https://anonhg.NetBSD.org/src/rev/b765f36fa320
branches: netbsd-1-5
changeset: 491325:b765f36fa320
user: he <he%NetBSD.org@localhost>
date: Mon Apr 23 22:05:52 2001 +0000
description:
Pull up revisions 1.73,1.87 (via patch, requested by hubertf):
Support Accton EN2242 and other AmdTek AN985 compatible cards
with the tlp(4) driver.
diffstat:
sys/dev/ic/tulip.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 70 insertions(+), 10 deletions(-)
diffs (136 lines):
diff -r 4b0b86c704ae -r b765f36fa320 sys/dev/ic/tulip.c
--- a/sys/dev/ic/tulip.c Mon Apr 23 22:05:29 2001 +0000
+++ b/sys/dev/ic/tulip.c Mon Apr 23 22:05:52 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tulip.c,v 1.68.4.5 2001/01/26 01:03:50 jhawk Exp $ */
+/* $NetBSD: tulip.c,v 1.68.4.6 2001/04/23 22:05:52 he Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -244,6 +244,8 @@
break;
case TULIP_CHIP_AL981:
+ case TULIP_CHIP_AN983:
+ case TULIP_CHIP_AN985:
sc->sc_filter_setup = tlp_al981_filter_setup;
break;
@@ -1893,6 +1895,8 @@
}
case TULIP_CHIP_AL981:
+ case TULIP_CHIP_AN983:
+ case TULIP_CHIP_AN985:
{
u_int32_t reg;
u_int8_t *enaddr = LLADDR(ifp->if_sadl);
@@ -2864,11 +2868,20 @@
struct ether_multistep step;
u_int32_t hash, mchash[2];
+ /*
+ * If the chip is running, we need to reset the interface,
+ * and will revisit here (with IFF_RUNNING) clear. The
+ * chip seems to really not like to have its multicast
+ * filter programmed without a reset.
+ */
+ if (ifp->if_flags & IFF_RUNNING) {
+ (void) tlp_init(sc);
+ return;
+ }
+
DPRINTF(sc, ("%s: tlp_al981_filter_setup: sc_flags 0x%08x\n",
sc->sc_dev.dv_xname, sc->sc_flags));
- tlp_idle(sc, OPMODE_ST|OPMODE_SR);
-
sc->sc_opmode &= ~(OPMODE_PR|OPMODE_PM);
if (ifp->if_flags & IFF_PROMISC) {
@@ -2904,8 +2917,8 @@
mchash[0] = mchash[1] = 0xffffffff;
setit:
- TULIP_WRITE(sc, CSR_ADM_MAR0, mchash[0]);
- TULIP_WRITE(sc, CSR_ADM_MAR1, mchash[1]);
+ bus_space_write_4(sc->sc_st, sc->sc_sh, CSR_ADM_MAR0, mchash[0]);
+ bus_space_write_4(sc->sc_st, sc->sc_sh, CSR_ADM_MAR1, mchash[1]);
TULIP_WRITE(sc, CSR_OPMODE, sc->sc_opmode);
DPRINTF(sc, ("%s: tlp_al981_filter_setup: returning\n",
sc->sc_dev.dv_xname));
@@ -2996,15 +3009,26 @@
csr = TULIP_READ(sc, CSR_STATUS);
if ((csr & ackmask) != ackmask) {
if ((bits & OPMODE_ST) != 0 && (csr & STATUS_TPS) == 0 &&
- (csr & STATUS_TS) != STATUS_TS_STOPPED)
+ (csr & STATUS_TS) != STATUS_TS_STOPPED) {
printf("%s: transmit process failed to idle: "
"state %s\n", sc->sc_dev.dv_xname,
tx_state_names[(csr & STATUS_TS) >> 20]);
+ }
if ((bits & OPMODE_SR) != 0 && (csr & STATUS_RPS) == 0 &&
- (csr & STATUS_RS) != STATUS_RS_STOPPED)
- printf("%s: receive process failed to idle: "
- "state %s\n", sc->sc_dev.dv_xname,
- rx_state_names[(csr & STATUS_RS) >> 17]);
+ (csr & STATUS_RS) != STATUS_RS_STOPPED) {
+ switch (sc->sc_chip) {
+ case TULIP_CHIP_AN983:
+ case TULIP_CHIP_AN985:
+ /*
+ * Filter the message out on noisy chips.
+ */
+ break;
+ default:
+ printf("%s: receive process failed to idle: "
+ "state %s\n", sc->sc_dev.dv_xname,
+ rx_state_names[(csr & STATUS_RS) >> 17]);
+ }
+ }
}
TULIP_WRITE(sc, CSR_STATUS, ackmask);
}
@@ -5594,6 +5618,42 @@
}
/*
+ * ADMtek AN983/985 media switch. Only has internal PHY, but
+ * on an SIO-like interface. Unfortunately, we can't use the
+ * standard SIO media switch, because the AN985 "ghosts" the
+ * singly PHY at every address.
+ */
+void tlp_an985_tmsw_init __P((struct tulip_softc *));
+
+const struct tulip_mediasw tlp_an985_mediasw = {
+ tlp_an985_tmsw_init, tlp_mii_getmedia, tlp_mii_setmedia
+};
+
+void
+tlp_an985_tmsw_init(sc)
+ struct tulip_softc *sc;
+{
+ struct ifnet *ifp = &sc->sc_ethercom.ec_if;
+
+ sc->sc_mii.mii_ifp = ifp;
+ sc->sc_mii.mii_readreg = tlp_bitbang_mii_readreg;
+ sc->sc_mii.mii_writereg = tlp_bitbang_mii_writereg;
+ sc->sc_mii.mii_statchg = sc->sc_statchg;
+ ifmedia_init(&sc->sc_mii.mii_media, 0, tlp_mediachange,
+ tlp_mediastatus);
+ mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff, 1,
+ MII_OFFSET_ANY, 0);
+ if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) {
+ ifmedia_add(&sc->sc_mii.mii_media, IFM_ETHER|IFM_NONE, 0, NULL);
+ ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_NONE);
+ } else {
+ sc->sc_flags |= TULIPF_HAS_MII;
+ sc->sc_tick = tlp_mii_tick;
+ ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_AUTO);
+ }
+}
+
+/*
* Davicom DM9102 media switch. Internal PHY and possibly HomePNA.
*/
void tlp_dm9102_tmsw_init __P((struct tulip_softc *));
Home |
Main Index |
Thread Index |
Old Index