diff options
author | sam <sam@FreeBSD.org> | 2009-02-23 23:54:08 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2009-02-23 23:54:08 +0000 |
commit | fdb4cb08bcf3ce12f8afdb0dcf2bc93603875d1a (patch) | |
tree | add99075d5bb52f45c19dc6afa8a98e90c84897e /sys/dev/ath | |
parent | 35472ccdb1e284ef3ec4da95ae63644e58bf0855 (diff) | |
download | FreeBSD-src-fdb4cb08bcf3ce12f8afdb0dcf2bc93603875d1a.zip FreeBSD-src-fdb4cb08bcf3ce12f8afdb0dcf2bc93603875d1a.tar.gz |
5416 and later parts get the radio rev differently; add ar5416GetRadioRev
to do it the right way
Diffstat (limited to 'sys/dev/ath')
-rw-r--r-- | sys/dev/ath/ath_hal/ar5416/ar5416.h | 1 | ||||
-rw-r--r-- | sys/dev/ath/ath_hal/ar5416/ar5416_attach.c | 15 | ||||
-rw-r--r-- | sys/dev/ath/ath_hal/ar5416/ar9160_attach.c | 4 |
3 files changed, 18 insertions, 2 deletions
diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416.h b/sys/dev/ath/ath_hal/ar5416/ar5416.h index 20714e8..15dfe23 100644 --- a/sys/dev/ath/ath_hal/ar5416/ar5416.h +++ b/sys/dev/ath/ath_hal/ar5416/ar5416.h @@ -85,6 +85,7 @@ struct ath_hal; extern struct ath_hal * ar5416Attach(uint16_t devid, HAL_SOFTC sc, HAL_BUS_TAG st, HAL_BUS_HANDLE sh, HAL_STATUS *status); +extern uint32_t ar5416GetRadioRev(struct ath_hal *ah); extern void ar5416InitState(struct ath_hal_5416 *, uint16_t devid, HAL_SOFTC sc, HAL_BUS_TAG st, HAL_BUS_HANDLE sh, HAL_STATUS *status); diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c b/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c index ac7122d..57dc2a9 100644 --- a/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c +++ b/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c @@ -156,6 +156,21 @@ ar5416InitState(struct ath_hal_5416 *ahp5416, uint16_t devid, HAL_SOFTC sc, AH5416(ah)->ah_tx_chainmask = AR5416_DEFAULT_TXCHAINMASK; } +uint32_t +ar5416GetRadioRev(struct ath_hal *ah) +{ + uint32_t val; + int i; + + /* Read Radio Chip Rev Extract */ + OS_REG_WRITE(ah, AR_PHY(0x36), 0x00007058); + for (i = 0; i < 8; i++) + OS_REG_WRITE(ah, AR_PHY(0x20), 0x00010000); + val = (OS_REG_READ(ah, AR_PHY(256)) >> 24) & 0xff; + val = ((val & 0xf0) >> 4) | ((val & 0x0f) << 4); + return ath_hal_reverseBits(val, 8); +} + /* * Attach for an AR5416 part. */ diff --git a/sys/dev/ath/ath_hal/ar5416/ar9160_attach.c b/sys/dev/ath/ath_hal/ar5416/ar9160_attach.c index f92c3a6..54b0f91 100644 --- a/sys/dev/ath/ath_hal/ar5416/ar9160_attach.c +++ b/sys/dev/ath/ath_hal/ar5416/ar9160_attach.c @@ -14,7 +14,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: ar9160_attach.c,v 1.14 2008/11/27 22:30:08 sam Exp $ + * $FreeBSD$ */ #include "opt_ah.h" @@ -190,7 +190,7 @@ ar9160Attach(uint16_t devid, HAL_SOFTC sc, OS_REG_WRITE(ah, AR_PHY(0), 0x00000007); /* Read Radio Chip Rev Extract */ - AH_PRIVATE(ah)->ah_analog5GhzRev = ar5212GetRadioRev(ah); + AH_PRIVATE(ah)->ah_analog5GhzRev = ar5416GetRadioRev(ah); switch (AH_PRIVATE(ah)->ah_analog5GhzRev & AR_RADIO_SREV_MAJOR) { case AR_RAD2133_SREV_MAJOR: /* Sowl: 2G/3x3 */ case AR_RAD5133_SREV_MAJOR: /* Sowl: 2+5G/3x3 */ |