Created
June 9, 2016 05:35
-
-
Save coypoop/2724f4988bdf69845d0a6931ceaed7a4 to your computer and use it in GitHub Desktop.
Define AR_CR_RXE to be different for newer devices
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 89a1f6962c7338e0933b196d785e6d0d30574fc4 Mon Sep 17 00:00:00 2001 | |
From: coypu <coypu@sdf.org> | |
Date: Thu, 9 Jun 2016 08:32:06 +0300 | |
Subject: [PATCH 1/1] Define AR_CR_RXE to be different for newer devices | |
From linux. | |
Adjust users of AR_CR_RXE to pass sc so we can test it. | |
Note that AR_SREV_9300_OR_LATER in linux is same as our test for | |
AR_SREV_9380_10_OR_LATER - test if mac ver is higher than 0x1c0. | |
(There are no AR93xx devices before AR9380) | |
--- | |
sys/dev/ic/arn5008.c | 4 ++-- | |
sys/dev/ic/athn.c | 2 +- | |
sys/dev/ic/athnreg.h | 2 +- | |
sys/dev/usb/if_athn_usb.c | 2 +- | |
4 files changed, 5 insertions(+), 5 deletions(-) | |
diff --git a/sys/dev/ic/arn5008.c b/sys/dev/ic/arn5008.c | |
index 9efed9a..5f8d598 100644 | |
--- a/sys/dev/ic/arn5008.c | |
+++ b/sys/dev/ic/arn5008.c | |
@@ -719,7 +719,7 @@ ar5008_rx_enable(struct athn_softc *sc) | |
/* Enable Rx. */ | |
AR_WRITE(sc, AR_RXDP, SIMPLEQ_FIRST(&rxq->head)->bf_daddr); | |
- AR_WRITE(sc, AR_CR, AR_CR_RXE); | |
+ AR_WRITE(sc, AR_CR, AR_CR_RXE(sc)); | |
AR_WRITE_BARRIER(sc); | |
} | |
@@ -950,7 +950,7 @@ ar5008_rx_process(struct athn_softc *sc) | |
rxq->lastds = ds; | |
/* Re-enable Rx. */ | |
- AR_WRITE(sc, AR_CR, AR_CR_RXE); | |
+ AR_WRITE(sc, AR_CR, AR_CR_RXE(sc)); | |
AR_WRITE_BARRIER(sc); | |
return 0; | |
} | |
diff --git a/sys/dev/ic/athn.c b/sys/dev/ic/athn.c | |
index cbeb3d9..e292add 100644 | |
--- a/sys/dev/ic/athn.c | |
+++ b/sys/dev/ic/athn.c | |
@@ -1749,7 +1749,7 @@ athn_stop_rx_dma(struct athn_softc *sc) | |
AR_WRITE(sc, AR_CR, AR_CR_RXD); | |
/* Wait for Rx enable bit to go low. */ | |
for (ntries = 0; ntries < 100; ntries++) { | |
- if (!(AR_READ(sc, AR_CR) & AR_CR_RXE)) | |
+ if (!(AR_READ(sc, AR_CR) & AR_CR_RXE(sc))) | |
return 0; | |
DELAY(100); | |
} | |
diff --git a/sys/dev/ic/athnreg.h b/sys/dev/ic/athnreg.h | |
index 0070de4..8966b8c 100644 | |
--- a/sys/dev/ic/athnreg.h | |
+++ b/sys/dev/ic/athnreg.h | |
@@ -257,7 +257,7 @@ | |
/* Bits for AR_CR. */ | |
-#define AR_CR_RXE 0x00000004 | |
+#define AR_CR_RXE(sc) (AR_SREV_9380_10_OR_LATER(sc) ? 0x0000000c : 0x00000004) | |
#define AR_CR_RXD 0x00000020 | |
#define AR_CR_SWI 0x00000040 | |
diff --git a/sys/dev/usb/if_athn_usb.c b/sys/dev/usb/if_athn_usb.c | |
index 471f68b..5c56068 100644 | |
--- a/sys/dev/usb/if_athn_usb.c | |
+++ b/sys/dev/usb/if_athn_usb.c | |
@@ -1569,7 +1569,7 @@ athn_usb_rx_enable(struct athn_softc *sc) | |
DPRINTFN(DBG_FN, sc, "\n"); | |
- AR_WRITE(sc, AR_CR, AR_CR_RXE); | |
+ AR_WRITE(sc, AR_CR, AR_CR_RXE(sc)); | |
AR_WRITE_BARRIER(sc); | |
} | |
-- | |
2.8.2 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment