Author: adrian
Date: Thu Jan 27 09:26:37 2011
New Revision: 217930
URL: http://svn.freebsd.org/changeset/base/217930

Log:
  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.

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c      Thu Jan 27 09:04:20 
2011        (r217929)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c      Thu Jan 27 09:26:37 
2011        (r217930)
@@ -44,6 +44,7 @@ static void ar5416InitBB(struct ath_hal 
 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 *);
@@ -210,6 +211,11 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO
        }
 
        /*
+        * 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 *a
        }
 }
 
+/*
+ * 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
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to