summaryrefslogtreecommitdiff
path: root/sys/dev/ic
diff options
context:
space:
mode:
authorAaron Campbell <aaron@cvs.openbsd.org>2001-03-29 01:39:34 +0000
committerAaron Campbell <aaron@cvs.openbsd.org>2001-03-29 01:39:34 +0000
commita17d5768325f54d7f5579ca02a7864645134da9c (patch)
tree5350a540ea4c26f0a62f38eea2e836d1e98a809b /sys/dev/ic
parent5580de99cd3bb2df5620394ee927c4d15d62e7f0 (diff)
Add MII support to NE2000 PCMCIA driver. Both the Netgear FA410TXC and
New Media LiveWire Fast Ethernet adapters now work after these changes, although the Netgear card still requires media to be set manually.
Diffstat (limited to 'sys/dev/ic')
-rw-r--r--sys/dev/ic/dp8390.c24
-rw-r--r--sys/dev/ic/dp8390var.h13
-rw-r--r--sys/dev/ic/ne2000.c11
-rw-r--r--sys/dev/ic/ne2000var.h7
4 files changed, 49 insertions, 6 deletions
diff --git a/sys/dev/ic/dp8390.c b/sys/dev/ic/dp8390.c
index 036595984fc..a12e0f1e541 100644
--- a/sys/dev/ic/dp8390.c
+++ b/sys/dev/ic/dp8390.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dp8390.c,v 1.11 2001/03/25 06:17:33 fgsch Exp $ */
+/* $OpenBSD: dp8390.c,v 1.12 2001/03/29 01:39:32 aaron Exp $ */
/* $NetBSD: dp8390.c,v 1.13 1998/07/05 06:49:11 jonathan Exp $ */
/*
@@ -1251,3 +1251,25 @@ dp8390_disable(sc)
sc->sc_enabled = 0;
}
}
+
+int
+dp8390_detach(sc, flags)
+ struct dp8390_softc *sc;
+ int flags;
+{
+ struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+
+ /* dp8390_disable() checks sc->sc_enabled */
+ dp8390_disable(sc);
+
+ if (sc->sc_media_fini != NULL)
+ (*sc->sc_media_fini)(sc);
+
+ /* Delete all reamining media. */
+ ifmedia_delete_instance(&sc->sc_media, IFM_INST_ANY);
+
+ ether_ifdetach(ifp);
+ if_detach(ifp);
+
+ return (0);
+}
diff --git a/sys/dev/ic/dp8390var.h b/sys/dev/ic/dp8390var.h
index fcd6b9f802c..d04b3f88a5d 100644
--- a/sys/dev/ic/dp8390var.h
+++ b/sys/dev/ic/dp8390var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dp8390var.h,v 1.4 2001/03/12 05:36:58 aaron Exp $ */
+/* $OpenBSD: dp8390var.h,v 1.5 2001/03/29 01:39:32 aaron Exp $ */
/* $NetBSD: dp8390var.h,v 1.8 1998/08/12 07:19:09 scottr Exp $ */
/*
@@ -14,6 +14,12 @@
* the author assume any responsibility for damages incurred with its use.
*/
+/*
+ * We include MII glue here -- some DP8390 compatible chips have
+ * MII interfaces on them (scary, isn't it...).
+ */
+#include <dev/mii/miivar.h>
+
#define INTERFACE_NAME_LEN 32
/*
@@ -25,7 +31,8 @@ struct dp8390_softc {
int sc_flags; /* interface flags, from config */
struct arpcom sc_arpcom; /* ethernet common */
- struct ifmedia sc_media; /* supported media information */
+ struct mii_data sc_mii; /* MII glue */
+#define sc_media sc_mii.mii_media /* compatibility definition */
bus_space_tag_t sc_regt; /* NIC register space tag */
bus_space_handle_t sc_regh; /* NIC register space handle */
@@ -148,6 +155,8 @@ void dp8390_mediastatus __P((struct ifnet *, struct ifmediareq *));
void dp8390_media_init __P((struct dp8390_softc *));
+int dp8390_detach __P((struct dp8390_softc *, int));
+
void dp8390_rint __P((struct dp8390_softc *));
void dp8390_getmcaf __P((struct arpcom *, u_int8_t *));
diff --git a/sys/dev/ic/ne2000.c b/sys/dev/ic/ne2000.c
index e49dd3e2f81..fdeede4cc0d 100644
--- a/sys/dev/ic/ne2000.c
+++ b/sys/dev/ic/ne2000.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ne2000.c,v 1.10 2001/03/13 06:02:00 aaron Exp $ */
+/* $OpenBSD: ne2000.c,v 1.11 2001/03/29 01:39:32 aaron Exp $ */
/* $NetBSD: ne2000.c,v 1.12 1998/06/10 01:15:50 thorpej Exp $ */
/*-
@@ -166,6 +166,7 @@ ne2000_attach(nsc, myea)
case NE2000_TYPE_NE2000:
case NE2000_TYPE_AX88190: /* XXX really? */
case NE2000_TYPE_DL10019:
+ case NE2000_TYPE_DL10022:
memsize = 8192 * 2;
break;
}
@@ -790,3 +791,11 @@ ne2000_writemem(nict, nich, asict, asich, src, dst, len, useword)
while (((bus_space_read_1(nict, nich, ED_P0_ISR) & ED_ISR_RDC) !=
ED_ISR_RDC) && --maxwait);
}
+
+int
+ne2000_detach(sc, flags)
+ struct ne2000_softc *sc;
+ int flags;
+{
+ return (dp8390_detach(&sc->sc_dp8390, flags));
+}
diff --git a/sys/dev/ic/ne2000var.h b/sys/dev/ic/ne2000var.h
index ded41f5b100..4f4cc08efa5 100644
--- a/sys/dev/ic/ne2000var.h
+++ b/sys/dev/ic/ne2000var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ne2000var.h,v 1.5 2001/03/12 05:36:58 aaron Exp $ */
+/* $OpenBSD: ne2000var.h,v 1.6 2001/03/29 01:39:32 aaron Exp $ */
/* $NetBSD: ne2000var.h,v 1.2 1997/10/14 22:54:12 thorpej Exp $ */
/*-
@@ -54,14 +54,17 @@ struct ne2000_softc {
#define NE2000_TYPE_NE1000 1
#define NE2000_TYPE_NE2000 2
#define NE2000_TYPE_DL10019 3
-#define NE2000_TYPE_AX88190 4
+#define NE2000_TYPE_DL10022 4
+#define NE2000_TYPE_AX88190 5
#define NE2000_USE_WORD(sc) \
(((sc)->sc_type == NE2000_TYPE_NE2000) || \
((sc)->sc_type == NE2000_TYPE_DL10019) || \
+ ((sc)->sc_type == NE2000_TYPE_DL10022) || \
((sc)->sc_type == NE2000_TYPE_AX88190))
int ne2000_attach __P((struct ne2000_softc *, u_int8_t *));
int ne2000_detect __P((struct ne2000_softc *));
+int ne2000_detach __P((struct ne2000_softc *, int));
#endif /* _DEV_IC_NE2000VAR_H_ */