From owner-svn-src-all@FreeBSD.ORG Mon Feb 23 23:54:08 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B1A04106566B; Mon, 23 Feb 2009 23:54:08 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 84D8F8FC17; Mon, 23 Feb 2009 23:54:08 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1NNs82N043512; Mon, 23 Feb 2009 23:54:08 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1NNs88D043509; Mon, 23 Feb 2009 23:54:08 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200902232354.n1NNs88D043509@svn.freebsd.org> From: Sam Leffler Date: Mon, 23 Feb 2009 23:54:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188971 - head/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Feb 2009 23:54:09 -0000 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 */