ath9k: Cleanup TX power calculation for 4K chips
[safe/jmp/linux-2.6] / drivers / net / wireless / ath / ath9k / hw.h
index 7e37570..e83e900 100644 (file)
@@ -42,6 +42,9 @@
 #define AR_SUBVENDOR_ID_NEW_A  0x7065
 #define AR5416_MAGIC           0x19641014
 
+#define AR5416_DEVID_AR9287_PCI  0x002D
+#define AR5416_DEVID_AR9287_PCIE 0x002E
+
 /* Register read/write primitives */
 #define REG_WRITE(_ah, _reg, _val) ath9k_iowrite32((_ah), (_reg), (_val))
 #define REG_READ(_ah, _reg) ath9k_ioread32((_ah), (_reg))
@@ -95,6 +98,7 @@
 
 #define MAX_RATE_POWER              63
 #define AH_WAIT_TIMEOUT             100000 /* (us) */
+#define AH_TSF_WRITE_TIMEOUT        100    /* (us) */
 #define AH_TIME_QUANTUM             10
 #define AR_KEYTABLE_SIZE            128
 #define POWER_UP_TIME               200000
 
 enum wireless_mode {
        ATH9K_MODE_11A = 0,
-       ATH9K_MODE_11B = 2,
-       ATH9K_MODE_11G = 3,
-       ATH9K_MODE_11NA_HT20 = 6,
-       ATH9K_MODE_11NG_HT20 = 7,
-       ATH9K_MODE_11NA_HT40PLUS = 8,
-       ATH9K_MODE_11NA_HT40MINUS = 9,
-       ATH9K_MODE_11NG_HT40PLUS = 10,
-       ATH9K_MODE_11NG_HT40MINUS = 11,
-       ATH9K_MODE_MAX
+       ATH9K_MODE_11G,
+       ATH9K_MODE_11NA_HT20,
+       ATH9K_MODE_11NG_HT20,
+       ATH9K_MODE_11NA_HT40PLUS,
+       ATH9K_MODE_11NA_HT40MINUS,
+       ATH9K_MODE_11NG_HT40PLUS,
+       ATH9K_MODE_11NG_HT40MINUS,
+       ATH9K_MODE_MAX,
 };
 
 enum ath9k_hw_caps {
@@ -400,6 +403,7 @@ struct ath_hw {
        union {
                struct ar5416_eeprom_def def;
                struct ar5416_eeprom_4k map4k;
+               struct ar9287_eeprom map9287;
        } eeprom;
        const struct eeprom_ops *eep_ops;
        enum ath9k_eep_map eep_map;
@@ -415,9 +419,10 @@ struct ath_hw {
        u32 wlanactive_gpio;
        u32 ah_flags;
 
+       bool htc_reset_init;
+
        enum nl80211_iftype opmode;
        enum ath9k_power_mode power_mode;
-       enum ath9k_power_mode restore_mode;
 
        struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS];
        struct ar5416Stats stats;
@@ -436,14 +441,14 @@ struct ath_hw {
        enum ath9k_ant_setting diversity_control;
 
        /* Calibration */
-       enum hal_cal_types supp_cals;
-       struct hal_cal_list iq_caldata;
-       struct hal_cal_list adcgain_caldata;
-       struct hal_cal_list adcdc_calinitdata;
-       struct hal_cal_list adcdc_caldata;
-       struct hal_cal_list *cal_list;
-       struct hal_cal_list *cal_list_last;
-       struct hal_cal_list *cal_list_curr;
+       enum ath9k_cal_types supp_cals;
+       struct ath9k_cal_list iq_caldata;
+       struct ath9k_cal_list adcgain_caldata;
+       struct ath9k_cal_list adcdc_calinitdata;
+       struct ath9k_cal_list adcdc_caldata;
+       struct ath9k_cal_list *cal_list;
+       struct ath9k_cal_list *cal_list_last;
+       struct ath9k_cal_list *cal_list_curr;
 #define totalPowerMeasI meas0.unsign
 #define totalPowerMeasQ meas1.unsign
 #define totalIqCorrMeas meas2.sign
@@ -538,11 +543,11 @@ struct ath_hw {
        struct ar5416IniArray iniModesTxGain;
 };
 
-/* Attach, Detach, Reset */
+/* Initialization, Detach, Reset */
 const char *ath9k_hw_probe(u16 vendorid, u16 devid);
 void ath9k_hw_detach(struct ath_hw *ah);
-struct ath_hw *ath9k_hw_attach(u16 devid, struct ath_softc *sc, int *error);
-void ath9k_hw_rfdetach(struct ath_hw *ah);
+int ath9k_hw_init(struct ath_hw *ah);
+void ath9k_hw_rf_free(struct ath_hw *ah);
 int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
                   bool bChannelChange);
 void ath9k_hw_fill_cap_info(struct ath_hw *ah);
@@ -565,9 +570,6 @@ u32 ath9k_hw_gpio_get(struct ath_hw *ah, u32 gpio);
 void ath9k_hw_cfg_output(struct ath_hw *ah, u32 gpio,
                         u32 ah_signal_type);
 void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val);
-#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
-void ath9k_enable_rfkill(struct ath_hw *ah);
-#endif
 u32 ath9k_hw_getdefantenna(struct ath_hw *ah);
 void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna);
 bool ath9k_hw_setantennaswitch(struct ath_hw *ah,
@@ -580,7 +582,8 @@ bool ath9k_hw_setantennaswitch(struct ath_hw *ah,
 bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val, u32 timeout);
 u32 ath9k_hw_reverse_bits(u32 val, u32 n);
 bool ath9k_get_channel_edges(struct ath_hw *ah, u16 flags, u16 *low, u16 *high);
-u16 ath9k_hw_computetxtime(struct ath_hw *ah, struct ath_rate_table *rates,
+u16 ath9k_hw_computetxtime(struct ath_hw *ah,
+                          const struct ath_rate_table *rates,
                           u32 frameLen, u16 rateix, bool shortPreamble);
 void ath9k_hw_get_channel_centers(struct ath_hw *ah,
                                  struct ath9k_channel *chan,
@@ -589,7 +592,7 @@ u32 ath9k_hw_getrxfilter(struct ath_hw *ah);
 void ath9k_hw_setrxfilter(struct ath_hw *ah, u32 bits);
 bool ath9k_hw_phy_disable(struct ath_hw *ah);
 bool ath9k_hw_disable(struct ath_hw *ah);
-bool ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit);
+void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit);
 void ath9k_hw_setmac(struct ath_hw *ah, const u8 *mac);
 void ath9k_hw_setopmode(struct ath_hw *ah);
 void ath9k_hw_setmcastfilter(struct ath_hw *ah, u32 filter0, u32 filter1);
@@ -598,7 +601,7 @@ void ath9k_hw_write_associd(struct ath_softc *sc);
 u64 ath9k_hw_gettsf64(struct ath_hw *ah);
 void ath9k_hw_settsf64(struct ath_hw *ah, u64 tsf64);
 void ath9k_hw_reset_tsf(struct ath_hw *ah);
-bool ath9k_hw_set_tsfadjust(struct ath_hw *ah, u32 setting);
+void ath9k_hw_set_tsfadjust(struct ath_hw *ah, u32 setting);
 bool ath9k_hw_setslottime(struct ath_hw *ah, u32 us);
 void ath9k_hw_set11nmac2040(struct ath_hw *ah, enum ath9k_ht_macmode mode);
 void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period);
@@ -611,7 +614,6 @@ void ath9k_hw_configpcipowersave(struct ath_hw *ah, int restore);
 /* Interrupt Handling */
 bool ath9k_hw_intrpend(struct ath_hw *ah);
 bool ath9k_hw_getisr(struct ath_hw *ah, enum ath9k_int *masked);
-enum ath9k_int ath9k_hw_intrget(struct ath_hw *ah);
 enum ath9k_int ath9k_hw_set_interrupts(struct ath_hw *ah, enum ath9k_int ints);
 
 void ath9k_hw_btcoex_enable(struct ath_hw *ah);