ath9k_hw: fix antenna diversity on AR9285
authorFelix Fietkau <nbd@openwrt.org>
Sun, 11 Jul 2010 10:48:39 +0000 (12:48 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 12 Jul 2010 20:05:37 +0000 (16:05 -0400)
On AR9285, the antenna switch configuration register uses more than just
16 bits. Because of an arbitrary mask applied to the EEPROM value that
stores this configuration, diversity was broken in some cases, leading
to a significant degradation in signal strength.
Fix this by changing the callback to return a 32 bit value and remove
the arbitrary mask.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Cc: stable@kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
drivers/net/wireless/ath/ath9k/eeprom.h
drivers/net/wireless/ath/ath9k/eeprom_4k.c
drivers/net/wireless/ath/ath9k/eeprom_9287.c
drivers/net/wireless/ath/ath9k/eeprom_def.c

index 343c9a427acb50f9b48abfb778975d6bcde74005..ace8d2678b18a890c3d64b2756623ce0f29be9c4 100644 (file)
@@ -951,7 +951,7 @@ static u8 ath9k_hw_ar9300_get_num_ant_config(struct ath_hw *ah,
        return 1;
 }
 
-static u16 ath9k_hw_ar9300_get_eeprom_antenna_cfg(struct ath_hw *ah,
+static u32 ath9k_hw_ar9300_get_eeprom_antenna_cfg(struct ath_hw *ah,
                                                  struct ath9k_channel *chan)
 {
        return -EINVAL;
index bdd8aa054b80bffa98ab56fd773a133a518aede2..8750c558c221658302c18fabff9a25f83906b730 100644 (file)
@@ -670,7 +670,7 @@ struct eeprom_ops {
        int (*get_eeprom_ver)(struct ath_hw *hw);
        int (*get_eeprom_rev)(struct ath_hw *hw);
        u8 (*get_num_ant_config)(struct ath_hw *hw, enum ieee80211_band band);
-       u16 (*get_eeprom_antenna_cfg)(struct ath_hw *hw,
+       u32 (*get_eeprom_antenna_cfg)(struct ath_hw *hw,
                                      struct ath9k_channel *chan);
        void (*set_board_values)(struct ath_hw *hw, struct ath9k_channel *chan);
        void (*set_addac)(struct ath_hw *hw, struct ath9k_channel *chan);
index e25a2abbf5619a01986c1105ab31b82a88b1da3c..afafc4d4b8fb0cfbfe873d6170720b87f9bd18c8 100644 (file)
@@ -1150,13 +1150,13 @@ static void ath9k_hw_4k_set_board_values(struct ath_hw *ah,
        }
 }
 
-static u16 ath9k_hw_4k_get_eeprom_antenna_cfg(struct ath_hw *ah,
+static u32 ath9k_hw_4k_get_eeprom_antenna_cfg(struct ath_hw *ah,
                                              struct ath9k_channel *chan)
 {
        struct ar5416_eeprom_4k *eep = &ah->eeprom.map4k;
        struct modal_eep_4k_header *pModal = &eep->modalHeader;
 
-       return pModal->antCtrlCommon & 0xFFFF;
+       return pModal->antCtrlCommon;
 }
 
 static u8 ath9k_hw_4k_get_num_ant_config(struct ath_hw *ah,
index 39a41053705f4c849729d5f4451a8ad35228ac62..37207dfd1799a76916f8a22aa95d9fd8610991ac 100644 (file)
@@ -1130,13 +1130,13 @@ static u8 ath9k_hw_ar9287_get_num_ant_config(struct ath_hw *ah,
        return 1;
 }
 
-static u16 ath9k_hw_ar9287_get_eeprom_antenna_cfg(struct ath_hw *ah,
+static u32 ath9k_hw_ar9287_get_eeprom_antenna_cfg(struct ath_hw *ah,
                                                  struct ath9k_channel *chan)
 {
        struct ar9287_eeprom *eep = &ah->eeprom.map9287;
        struct modal_eep_ar9287_header *pModal = &eep->modalHeader;
 
-       return pModal->antCtrlCommon & 0xFFFF;
+       return pModal->antCtrlCommon;
 }
 
 static u16 ath9k_hw_ar9287_get_spur_channel(struct ath_hw *ah,
index 77b1433312ccab88d08b45d0a1f799582a6c99a7..60480a1122b2d6ec294f9114d78c953dcf421b5e 100644 (file)
@@ -1438,14 +1438,14 @@ static u8 ath9k_hw_def_get_num_ant_config(struct ath_hw *ah,
        return num_ant_config;
 }
 
-static u16 ath9k_hw_def_get_eeprom_antenna_cfg(struct ath_hw *ah,
+static u32 ath9k_hw_def_get_eeprom_antenna_cfg(struct ath_hw *ah,
                                               struct ath9k_channel *chan)
 {
        struct ar5416_eeprom_def *eep = &ah->eeprom.def;
        struct modal_eep_header *pModal =
                &(eep->modalHeader[IS_CHAN_2GHZ(chan)]);
 
-       return pModal->antCtrlCommon & 0xFFFF;
+       return pModal->antCtrlCommon;
 }
 
 static u16 ath9k_hw_def_get_spur_channel(struct ath_hw *ah, u16 i, bool is2GHz)