ath5k: Update reset code
PATCH 5/7 ath5k: Update reset code
* Update reset and sync with HALs
* Clean up eeprom settings and tweaking of initvals and put them on separate functions
* Set/Restore 32KHz ref clk operation
* Add some more documentation
TODO: Spur mitigation, tpc, half/quarter rate, compression etc
v2: Address comments from Bob and Felix and fix RSSI threshold bug introduced on the first version of the patch
Signed-off-by Nick Kossifidis <[email protected]>
--- drivers/net/wireless/ath5k/ath5k.h | 11 +- drivers/net/wireless/ath5k/attach.c | 16 +- drivers/net/wireless/ath5k/eeprom.c | 14 +- drivers/net/wireless/ath5k/eeprom.h | 1 + drivers/net/wireless/ath5k/reg.h | 56 +- drivers/net/wireless/ath5k/reset.c | 930 +++++++++++++++++++++++++---------- 6 files changed, 732 insertions(+), 296 deletions(-)
drivers/net/wireless/ath5k/ath5k.h +7 -4
@@ -222,6 +222,7 @@#endif /* Initial values */ +#define AR5K_INIT_CYCRSSI_THR1 2#define AR5K_INIT_TX_LATENCY 502#define AR5K_INIT_USEC 39#define AR5K_INIT_USEC_TURBO 79
@@ -313,7 +314,7 @@ struct ath5k_srev_name {#define AR5K_SREV_AR5424 0x90/* Condor */ #define AR5K_SREV_AR5413 0xa4/* Eagle lite */ #define AR5K_SREV_AR5414 0xa0/* Eagle */ -#define AR5K_SREV_AR2415 0xb0/* Cobra */ +#define AR5K_SREV_AR2415 0xb0/* Talon */ #define AR5K_SREV_AR5416 0xc0/* PCI-E */ #define AR5K_SREV_AR5418 0xca/* PCI-E */ #define AR5K_SREV_AR2425 0xe0/* Swan */
@@ -331,7 +332,7 @@ struct ath5k_srev_name {#define AR5K_SREV_RAD_2112B 0x46#define AR5K_SREV_RAD_2413 0x50#define AR5K_SREV_RAD_5413 0x60 -#define AR5K_SREV_RAD_2316 0x70 +#define AR5K_SREV_RAD_2316 0x70/* Cobra SoC */ #define AR5K_SREV_RAD_2317 0x80#define AR5K_SREV_RAD_5424 0xa0/* Mostly same as 5413 */ #define AR5K_SREV_RAD_2425 0xa2
@@ -340,7 +341,7 @@ struct ath5k_srev_name {#define AR5K_SREV_PHY_5211 0x30#define AR5K_SREV_PHY_5212 0x41#define AR5K_SREV_PHY_5212A 0x42 -#define AR5K_SREV_PHY_2112B 0x43 +#define AR5K_SREV_PHY_5212B 0x43#define AR5K_SREV_PHY_2413 0x45#define AR5K_SREV_PHY_5413 0x61#define AR5K_SREV_PHY_2425 0x70
@@ -1030,7 +1031,6 @@ struct ath5k_hw {u16 ah_phy_revision;u16 ah_radio_5ghz_revision;u16 ah_radio_2ghz_revision; -u32 ah_phy_spending;enum ath5k_version ah_version;enum ath5k_radio ah_radio;
@@ -1156,6 +1156,7 @@ extern void ath5k_hw_update_mib_counters(struct ath5k_hw *ah, struct ieee80211_l/* EEPROM access functions */ extern int ath5k_eeprom_init (struct ath5k_hw *ah);extern int ath5k_eeprom_read_mac (struct ath5k_hw *ah,u8 *mac); +extern bool ath5k_eeprom_is_hb63 (struct ath5k_hw *ah);/* Protocol Control Unit Functions */ extern int ath5k_hw_set_opmode (struct ath5k_hw *ah);
@@ -1258,6 +1259,7 @@ extern int ath5k_hw_set_txpower_limit(struct ath5k_hw *ah, unsigned int power);/* * Translate usec to hw clock units +* TODO: Half/quarter rate */ static inline unsigned int ath5k_hw_htoclock (unsigned int usec,bool turbo) {
@@ -1266,6 +1268,7 @@ static inline unsigned int ath5k_hw_htoclock(unsigned int usec, bool turbo)/* * Translate hw clock units to usec +* TODO: Half/quarter rate */ static inline unsigned int ath5k_hw_clocktoh (unsigned int clock,bool turbo) {
drivers/net/wireless/ath5k/attach.c +2 -14
@@ -169,7 +169,6 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version) ah->ah_single_chip = false; ah->ah_radio_2ghz_revision =ath5k_hw_radio_revision (ah,CHANNEL_2GHZ ); - ah->ah_phy_spending =AR5K_PHY_SPENDING_RF5111 ;break ;case AR5K_SREV_RAD_5112 :case AR5K_SREV_RAD_2112 :
@@ -177,38 +176,31 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version) ah->ah_single_chip = false; ah->ah_radio_2ghz_revision =ath5k_hw_radio_revision (ah,CHANNEL_2GHZ ); - ah->ah_phy_spending =AR5K_PHY_SPENDING_RF5112 ;break ;case AR5K_SREV_RAD_2413 : ah->ah_radio =AR5K_RF2413 ; ah->ah_single_chip = true; - ah->ah_phy_spending =AR5K_PHY_SPENDING_RF2413 ;break ;case AR5K_SREV_RAD_5413 : ah->ah_radio =AR5K_RF5413 ; ah->ah_single_chip = true; - ah->ah_phy_spending =AR5K_PHY_SPENDING_RF5413 ;break ;case AR5K_SREV_RAD_2316 : ah->ah_radio =AR5K_RF2316 ; ah->ah_single_chip = true; - ah->ah_phy_spending =AR5K_PHY_SPENDING_RF2316 ;break ;case AR5K_SREV_RAD_2317 : ah->ah_radio =AR5K_RF2317 ; ah->ah_single_chip = true; - ah->ah_phy_spending =AR5K_PHY_SPENDING_RF2317 ;break ;case AR5K_SREV_RAD_5424 :if (ah->ah_mac_version ==AR5K_SREV_AR2425 || ah->ah_mac_version ==AR5K_SREV_AR2417 ){ ah->ah_radio =AR5K_RF2425 ; ah->ah_single_chip = true; - ah->ah_phy_spending =AR5K_PHY_SPENDING_RF2425 ; }else { ah->ah_radio =AR5K_RF5413 ; ah->ah_single_chip = true; - ah->ah_phy_spending =AR5K_PHY_SPENDING_RF5413 ; }break ;default :
@@ -227,29 +219,25 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version) ah->ah_radio =AR5K_RF2425 ; ah->ah_single_chip = true; ah->ah_radio_5ghz_revision =AR5K_SREV_RAD_2425 ; - ah->ah_phy_spending =AR5K_PHY_SPENDING_RF2425 ; }else if (srev ==AR5K_SREV_AR5213A && - ah->ah_phy_revision ==AR5K_SREV_PHY_2112B ) { + ah->ah_phy_revision ==AR5K_SREV_PHY_5212B ) { ah->ah_radio =AR5K_RF5112 ; ah->ah_single_chip = false; - ah->ah_radio_5ghz_revision =AR5K_SREV_RAD_2112B ; + ah->ah_radio_5ghz_revision =AR5K_SREV_RAD_5112B ; }else if (ah->ah_mac_version == (AR5K_SREV_AR2415 >>4 )) { ah->ah_radio =AR5K_RF2316 ; ah->ah_single_chip = true; ah->ah_radio_5ghz_revision =AR5K_SREV_RAD_2316 ; - ah->ah_phy_spending =AR5K_PHY_SPENDING_RF2316 ; }else if (ah->ah_mac_version == (AR5K_SREV_AR5414 >>4 ) || ah->ah_phy_revision ==AR5K_SREV_PHY_5413 ) { ah->ah_radio =AR5K_RF5413 ; ah->ah_single_chip = true; ah->ah_radio_5ghz_revision =AR5K_SREV_RAD_5413 ; - ah->ah_phy_spending =AR5K_PHY_SPENDING_RF5413 ; }else if (ah->ah_mac_version == (AR5K_SREV_AR2414 >>4 ) || ah->ah_phy_revision ==AR5K_SREV_PHY_2413 ) { ah->ah_radio =AR5K_RF2413 ; ah->ah_single_chip = true; ah->ah_radio_5ghz_revision =AR5K_SREV_RAD_2413 ; - ah->ah_phy_spending =AR5K_PHY_SPENDING_RF2413 ; }else {ATH5K_ERR (sc,"Couldn't identify radio revision.\n" ); ret = -ENODEV ;
drivers/net/wireless/ath5k/eeprom.c +13 -1
@@ -204,7 +204,7 @@ static int ath5k_eeprom_read_ants(struct ath5k_hw *ah, u32 *offset,/* Get antenna modes */ ah->ah_antenna[mode][0 ] = - (ee->ee_ant_control[mode][0 ] <<4 ) |0x1 ; + (ee->ee_ant_control[mode][0 ] <<4 ); ah->ah_antenna[mode][AR5K_ANT_FIXED_A ] = ee->ee_ant_control[mode][1 ] | (ee->ee_ant_control[mode][2] << 6) |
@@ -1412,6 +1412,7 @@ ath5k_eeprom_init(struct ath5k_hw *ah)return 0 ; } +/* * Read the MAC address from eeprom */
@@ -1448,3 +1449,14 @@ int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac)return 0 ; } +bool ath5k_eeprom_is_hb63 (struct ath5k_hw *ah) +{ +u16 data; + +ath5k_hw_eeprom_read (ah,AR5K_EEPROM_IS_HB63 , &data); + +if ((ah->ah_mac_version == (AR5K_SREV_AR2425 >>4 )) && data) +return true; +else +return false; +}
drivers/net/wireless/ath5k/eeprom.h +1 -0
@@ -25,6 +25,7 @@#define AR5K_EEPROM_MAGIC_5211 0x0000145b/* 5211 */ #define AR5K_EEPROM_MAGIC_5210 0x0000145a/* 5210 */ +#define AR5K_EEPROM_IS_HB63 0x000b/* Talon detect */ #define AR5K_EEPROM_REG_DOMAIN 0x00bf/* EEPROM regdom */ #define AR5K_EEPROM_CHECKSUM 0x00c0/* EEPROM checksum */ #define AR5K_EEPROM_INFO_BASE 0x00c0/* EEPROM header */
drivers/net/wireless/ath5k/reg.h +28 -28
150 lines not on this page · raw message
drivers/net/wireless/ath5k/reset.c +681 -249
1,160 lines not on this page · raw message