5416 and later parts get the radio rev differently; add ar5416GetRadioRev

to do it the right way
This commit is contained in:
Sam Leffler 2009-02-23 23:54:08 +00:00
parent 0f5578c15d
commit 3f1c613044
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=188971
3 changed files with 18 additions and 2 deletions

View File

@ -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);

View File

@ -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.
*/

View File

@ -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 */