summaryrefslogtreecommitdiff
path: root/sys/dev/ic/atw.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2005-09-24 11:19:15 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2005-09-24 11:19:15 +0000
commitee3ee1d58ca6a6f192ea6e9b5a8c00c2029c34d9 (patch)
tree7a3c360fd691961913b93cc9671e872e101eb554 /sys/dev/ic/atw.c
parentb50cd3c29b30dfb1ff1611edd279aa3162eaf8f6 (diff)
The ADM8211B seems to stall after some time of constant
activity at DS11 speeds. Check for this in the watchdog using seemingly undocumented bits of the TEST1 register used in Linux driver and restart if a stall is detected.
Diffstat (limited to 'sys/dev/ic/atw.c')
-rw-r--r--sys/dev/ic/atw.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/sys/dev/ic/atw.c b/sys/dev/ic/atw.c
index efae7ce4e96..aefcb7226a3 100644
--- a/sys/dev/ic/atw.c
+++ b/sys/dev/ic/atw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: atw.c,v 1.39 2005/09/24 09:22:26 jsg Exp $ */
+/* $OpenBSD: atw.c,v 1.40 2005/09/24 11:19:14 jsg Exp $ */
/* $NetBSD: atw.c,v 1.69 2004/07/23 07:07:55 dyoung Exp $ */
/*-
@@ -3365,6 +3365,7 @@ atw_watchdog(struct ifnet *ifp)
{
struct atw_softc *sc = ifp->if_softc;
struct ieee80211com *ic = &sc->sc_ic;
+ uint32_t test1, rra, rwa;
ifp->if_timer = 0;
if (ATW_IS_ENABLED(sc) == 0)
@@ -3385,6 +3386,23 @@ atw_watchdog(struct ifnet *ifp)
}
if (sc->sc_tx_timer != 0 || sc->sc_rescan_timer != 0)
ifp->if_timer = 1;
+
+ /*
+ * ADM8211B seems to stall every so often, check for this.
+ * These bits are what the Linux driver checks, they don't
+ * seem to be documented by ADMTek/Infineon?
+ */
+ if (sc->sc_rev == ATW_REVISION_BA) {
+ test1 = ATW_READ(sc, ATW_TEST1);
+ rra = (test1 >> 12) & 0x1ff;
+ rwa = (test1 >> 2) & 0x1ff;
+
+ if ((rra != rwa) && !(test1 & 0x2)) {
+ atw_init(ifp);
+ atw_start(ifp);
+ }
+ }
+
ieee80211_watchdog(ifp);
}