Skip to contentSkip to conversation

ath5k: Fix diversity

PATCH New Nick Kossifidis 1 participant 1 message Dec 16, 2007 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 3/9 ath5k: Fix diversity

* Fix diversity support

We have to write all antenna information on AR5K_PHY_ANT_SWITCH_TABLE if antenna mode is not fixed.

Changes-licensed-under: ISC

---

drivers/net/wireless/ath5k/hw.c +15 -9
index aea9589..8357cac 100644
@@ -578,7 +578,7 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum ieee80211_if_types op_mode,
 	ATH5K_TRACE(ah->ah_sc);
 
 	s_seq = 0;
-	s_ant = 1;
+	s_ant = 0;
 	ee_mode = 0;
 	freq = 0;
 	mode = 0;
@@ -753,14 +753,20 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum ieee80211_if_types op_mode,
 				    AR5K_TXCFG_B_MODE);
 		}
 
-		/* Set antenna mode */
-		AR5K_REG_MASKED_BITS(ah, AR5K_PHY(0x44),
-			ah->ah_antenna[ee_mode][0], 0xfffffc06);
-
-		if (freq == AR5K_INI_RFGAIN_2GHZ)
-			ant[0] = ant[1] = AR5K_ANT_FIXED_B;
-		else
-			ant[0] = ant[1] = AR5K_ANT_FIXED_A;
+		/*
+		 * In case a fixed antenna was set as default
+		 * write the same settings on both AR5K_PHY_ANT_SWITCH_TABLE
+		 * registers.
+		 */
+		if (s_ant != 0){
+			if (s_ant == AR5K_ANT_FIXED_A) /* 1 - Main */
+				ant[0] = ant[1] = AR5K_ANT_FIXED_A;
+			else	/* 2 - Aux */
+				ant[0] = ant[1] = AR5K_ANT_FIXED_B;
+		} else {
+			ant[0] = AR5K_ANT_FIXED_A;
+			ant[1] = AR5K_ANT_FIXED_B;
+		}
 
 		ath5k_hw_reg_write(ah, ah->ah_antenna[ee_mode][ant[0]],
 			AR5K_PHY_ANT_SWITCH_TABLE_0);