ath5k: Put remaining EEPROM data on ee struct
authorNick Kossifidis <mick@madwifi-project.org>
Thu, 30 Apr 2009 19:55:46 +0000 (15:55 -0400)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 6 May 2009 19:14:55 +0000 (15:14 -0400)
* Put remaining EEPROM information on ee struct and remove is_hb63
 function.

 Now we also have rfkill stuff available.

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath5k/eeprom.c
drivers/net/wireless/ath/ath5k/eeprom.h
drivers/net/wireless/ath/ath5k/reset.c

index 587c5b8..8c9dd01 100644 (file)
@@ -156,6 +156,17 @@ ath5k_eeprom_init_header(struct ath5k_hw *ah)
                ee->ee_db[AR5K_EEPROM_MODE_11G][0] = (val >> 3) & 0x7;
        }
 
+       AR5K_EEPROM_READ(AR5K_EEPROM_IS_HB63, val);
+
+       if ((ah->ah_mac_version == (AR5K_SREV_AR2425 >> 4)) && val)
+               ee->ee_is_hb63 = true;
+       else
+               ee->ee_is_hb63 = false;
+
+       AR5K_EEPROM_READ(AR5K_EEPROM_RFKILL, val);
+       ee->ee_rfkill_pin = (u8) AR5K_REG_MS(val, AR5K_EEPROM_RFKILL_GPIO_SEL);
+       ee->ee_rfkill_pol = val & AR5K_EEPROM_RFKILL_POLARITY ? true : false;
+
        return 0;
 }
 
@@ -1789,16 +1800,3 @@ 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;
-}
-
index df9ffa0..46e4d22 100644 (file)
 #define AR5K_EEPROM_MAGIC_5210         0x0000145a /* 5210 */
 
 #define        AR5K_EEPROM_IS_HB63             0x000b  /* Talon detect */
+
+#define AR5K_EEPROM_RFKILL             0x0f
+#define AR5K_EEPROM_RFKILL_GPIO_SEL    0x0000001c
+#define AR5K_EEPROM_RFKILL_GPIO_SEL_S  2
+#define AR5K_EEPROM_RFKILL_POLARITY    0x00000002
+#define AR5K_EEPROM_RFKILL_POLARITY_S  1
+
 #define AR5K_EEPROM_REG_DOMAIN         0x00bf  /* EEPROM regdom */
 #define AR5K_EEPROM_CHECKSUM           0x00c0  /* EEPROM checksum */
 #define AR5K_EEPROM_INFO_BASE          0x00c0  /* EEPROM header */
 #define AR5K_EEPROM_HDR_RFKILL(_v)     (((_v) >> 14) & 0x1)    /* Device has RFKill support */
 #define AR5K_EEPROM_HDR_T_5GHZ_DIS(_v) (((_v) >> 15) & 0x1)    /* Disable turbo for 5Ghz */
 
-#define AR5K_EEPROM_RFKILL_GPIO_SEL    0x0000001c
-#define AR5K_EEPROM_RFKILL_GPIO_SEL_S  2
-#define AR5K_EEPROM_RFKILL_POLARITY    0x00000002
-#define AR5K_EEPROM_RFKILL_POLARITY_S  1
-
 /* Newer EEPROMs are using a different offset */
 #define AR5K_EEPROM_OFF(_v, _v3_0, _v3_3) \
        (((_v) >= AR5K_EEPROM_VERSION_3_3) ? _v3_3 : _v3_0)
@@ -386,6 +388,9 @@ struct ath5k_eeprom_info {
        u16     ee_version;
        u16     ee_header;
        u16     ee_ant_gain;
+       u8      ee_rfkill_pin;
+       bool    ee_rfkill_pol;
+       bool    ee_is_hb63;
        u16     ee_misc0;
        u16     ee_misc1;
        u16     ee_misc2;
index cb8a9a1..d419c6a 100644 (file)
@@ -507,7 +507,7 @@ static void ath5k_hw_set_sleep_clock(struct ath5k_hw *ah, bool enable)
 
                if (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))
                        scal = AR5K_PHY_SCAL_32MHZ_2417;
-               else if (ath5k_eeprom_is_hb63(ah))
+               else if (ee->ee_is_hb63)
                        scal = AR5K_PHY_SCAL_32MHZ_HB63;
                else
                        scal = AR5K_PHY_SCAL_32MHZ;
@@ -598,9 +598,10 @@ static void ath5k_hw_tweak_initval_settings(struct ath5k_hw *ah,
        /* Set DAC/ADC delays */
        if (ah->ah_version == AR5K_AR5212) {
                u32 scal;
+               struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
                if (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))
                        scal = AR5K_PHY_SCAL_32MHZ_2417;
-               else if (ath5k_eeprom_is_hb63(ah))
+               else if (ee->ee_is_hb63)
                        scal = AR5K_PHY_SCAL_32MHZ_HB63;
                else
                        scal = AR5K_PHY_SCAL_32MHZ;