Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Feb 2009 23:54:08 +0000 (UTC)
From:      Sam Leffler <sam@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r188971 - head/sys/dev/ath/ath_hal/ar5416
Message-ID:  <200902232354.n1NNs88D043509@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sam
Date: Mon Feb 23 23:54:08 2009
New Revision: 188971
URL: http://svn.freebsd.org/changeset/base/188971

Log:
  5416 and later parts get the radio rev differently; add ar5416GetRadioRev
  to do it the right way

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416.h
  head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
  head/sys/dev/ath/ath_hal/ar5416/ar9160_attach.c

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416.h
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416.h	Mon Feb 23 23:48:17 2009	(r188970)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416.h	Mon Feb 23 23:54:08 2009	(r188971)
@@ -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);

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c	Mon Feb 23 23:48:17 2009	(r188970)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c	Mon Feb 23 23:54:08 2009	(r188971)
@@ -156,6 +156,21 @@ ar5416InitState(struct ath_hal_5416 *ahp
 	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.
  */

Modified: head/sys/dev/ath/ath_hal/ar5416/ar9160_attach.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar9160_attach.c	Mon Feb 23 23:48:17 2009	(r188970)
+++ head/sys/dev/ath/ath_hal/ar5416/ar9160_attach.c	Mon Feb 23 23:54:08 2009	(r188971)
@@ -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 s
 	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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200902232354.n1NNs88D043509>