Initialise the chainmask from the EEPROM rather than the hard-coded defaults.

The defaults enabled three chains on the AR5416 even if the card has two
chains. This restores that and ensures that only the correct TX/RX
chainmasks are used.

When HT modes are enabled, all TX chains will be correctly enabled.

This should now enable analog chain swapping with 2-chain cards.
I'm not sure if this is needed for just the AR5416 or whether
it also applies to AR9160, AR9280 and AR9287 (later on); I'll have
to get clarification.
This commit is contained in:
Adrian Chadd 2011-01-27 09:26:37 +00:00
parent 4ceb85596b
commit 0fafe07ff3

View File

@ -44,6 +44,7 @@ static void ar5416InitBB(struct ath_hal *ah, const struct ieee80211_channel *);
static void ar5416InitIMR(struct ath_hal *ah, HAL_OPMODE opmode);
static void ar5416InitQoS(struct ath_hal *ah);
static void ar5416InitUserSettings(struct ath_hal *ah);
static void ar5416UpdateChainMasks(struct ath_hal *ah, HAL_BOOL is_ht);
#if 0
static HAL_BOOL ar5416ChannelChange(struct ath_hal *, const struct ieee80211_channel *);
@ -209,6 +210,11 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMODE opmode,
#endif
}
/*
* Setup ah_tx_chainmask / ah_rx_chainmask before we fiddle
* with enabling the TX/RX radio chains.
*/
ar5416UpdateChainMasks(ah, IEEE80211_IS_CHAN_HT(chan));
/*
* This routine swaps the analog chains - it should be done
* before any radio register twiddling is done.
@ -1137,6 +1143,30 @@ ar5416RestoreChainMask(struct ath_hal *ah)
}
}
/*
* Update the chainmask based on the current channel configuration.
*
* XXX ath9k checks bluetooth co-existence here
* XXX ath9k checks whether the current state is "off-channel".
* XXX ath9k sticks the hardware into 1x1 mode for legacy;
* we're going to leave multi-RX on for multi-path cancellation.
*/
static void
ar5416UpdateChainMasks(struct ath_hal *ah, HAL_BOOL is_ht)
{
struct ath_hal_private *ahpriv = AH_PRIVATE(ah);
HAL_CAPABILITIES *pCap = &ahpriv->ah_caps;
if (is_ht) {
AH5416(ah)->ah_tx_chainmask = pCap->halTxChainMask;
} else {
AH5416(ah)->ah_tx_chainmask = 1;
}
AH5416(ah)->ah_rx_chainmask = pCap->halRxChainMask;
HALDEBUG(ah, HAL_DEBUG_ANY, "TX chainmask: 0x%x; RX chainmask: 0x%x\n",
AH5416(ah)->ah_tx_chainmask,
AH5416(ah)->ah_rx_chainmask);
}
#ifndef IS_5GHZ_FAST_CLOCK_EN
#define IS_5GHZ_FAST_CLOCK_EN(ah, chan) AH_FALSE