ath5k: Misc hw_attach fixes
[cascardo/linux.git] / drivers / net / wireless / ath5k / ath5k.h
index 9ea8c54..9102eea 100644 (file)
@@ -140,7 +140,9 @@ enum ath5k_radio {
        AR5K_RF5110     = 0,
        AR5K_RF5111     = 1,
        AR5K_RF5112     = 2,
-       AR5K_RF5413     = 3,
+       AR5K_RF2413     = 3,
+       AR5K_RF5413     = 4,
+       AR5K_RF2425     = 5,
 };
 
 /*
@@ -168,12 +170,15 @@ struct ath5k_srev_name {
 #define AR5K_SREV_VER_AR5212   0x50
 #define AR5K_SREV_VER_AR5213   0x55
 #define AR5K_SREV_VER_AR5213A  0x59
-#define AR5K_SREV_VER_AR2424   0xa0
-#define AR5K_SREV_VER_AR5424   0xa3
+#define AR5K_SREV_VER_AR2413   0x78
+#define AR5K_SREV_VER_AR2414   0x79
+#define AR5K_SREV_VER_AR2424   0xa0 /* PCI-E */
+#define AR5K_SREV_VER_AR5424   0xa3 /* PCI-E */
 #define AR5K_SREV_VER_AR5413   0xa4
 #define AR5K_SREV_VER_AR5414   0xa5
-#define AR5K_SREV_VER_AR5416   0xc0    /* ? */
-#define AR5K_SREV_VER_AR5418   0xca
+#define AR5K_SREV_VER_AR5416   0xc0 /* PCI-E */
+#define AR5K_SREV_VER_AR5418   0xca /* PCI-E */
+#define AR5K_SREV_VER_AR2425   0xe2 /* PCI-E */
 
 #define AR5K_SREV_RAD_5110     0x00
 #define AR5K_SREV_RAD_5111     0x10
@@ -181,10 +186,13 @@ struct ath5k_srev_name {
 #define AR5K_SREV_RAD_2111     0x20
 #define AR5K_SREV_RAD_5112     0x30
 #define AR5K_SREV_RAD_5112A    0x35
+#define        AR5K_SREV_RAD_5112B     0x36
 #define AR5K_SREV_RAD_2112     0x40
 #define AR5K_SREV_RAD_2112A    0x45
-#define AR5K_SREV_RAD_SC1      0x63    /* Found on 5413/5414 */
-#define AR5K_SREV_RAD_SC2      0xa2    /* Found on 2424/5424 */
+#define        AR5K_SREV_RAD_2112B     0x46
+#define AR5K_SREV_RAD_SC0      0x50    /* Found on 2413/2414 */
+#define AR5K_SREV_RAD_SC1      0x60    /* Found on 5413/5414 */
+#define AR5K_SREV_RAD_SC2      0xa0    /* Found on 2424-5/5424 */
 #define AR5K_SREV_RAD_5133     0xc0    /* MIMO found on 5418 */
 
 /* IEEE defs */
@@ -263,15 +271,18 @@ enum ath5k_driver_mode {
 /* adding this flag to rate_code enables short preamble, see ar5212_reg.h */
 #define AR5K_SET_SHORT_PREAMBLE 0x04
 
-#define HAS_SHPREAMBLE(_ix) (rt->rates[_ix].modulation == IEEE80211_RATE_SHORT_PREAMBLE)
-#define SHPREAMBLE_FLAG(_ix) (HAS_SHPREAMBLE(_ix) ? AR5K_SET_SHORT_PREAMBLE : 0)
+#define HAS_SHPREAMBLE(_ix) \
+       (rt->rates[_ix].modulation == IEEE80211_RATE_SHORT_PREAMBLE)
+#define SHPREAMBLE_FLAG(_ix) \
+       (HAS_SHPREAMBLE(_ix) ? AR5K_SET_SHORT_PREAMBLE : 0)
+
 
 /****************\
   TX DEFINITIONS
 \****************/
 
 /*
- * Tx Descriptor
+ * TX Status
  */
 struct ath5k_tx_status {
        u16     ts_seqnum;
@@ -419,7 +430,7 @@ enum ath5k_dmasize {
 \****************/
 
 /*
- * Rx Descriptor
+ * RX Status
  */
 struct ath5k_rx_status {
        u16     rs_datalen;
@@ -441,16 +452,6 @@ struct ath5k_rx_status {
 #define AR5K_RXKEYIX_INVALID   ((u8) - 1)
 #define AR5K_TXKEYIX_INVALID   ((u32) - 1)
 
-struct ath5k_mib_stats {
-       u32     ackrcv_bad;
-       u32     rts_bad;
-       u32     rts_good;
-       u32     fcs_bad;
-       u32     beacons;
-};
-
-
-
 
 /**************************\
  BEACON TIMERS DEFINITIONS
@@ -493,29 +494,23 @@ struct ath5k_beacon_state {
 #define TSF_TO_TU(_tsf) (u32)((_tsf) >> 10)
 
 
-
 /********************\
   COMMON DEFINITIONS
 \********************/
 
 /*
- * Atheros descriptor
+ * Atheros hardware descriptor
+ * This is read and written to by the hardware
  */
 struct ath5k_desc {
-       u32     ds_link;
-       u32     ds_data;
-       u32     ds_ctl0;
-       u32     ds_ctl1;
-       u32     ds_hw[4];
+       u32     ds_link;        /* physical address of the next descriptor */
+       u32     ds_data;        /* physical address of data buffer (skb) */
 
        union {
-               struct ath5k_rx_status rx;
-               struct ath5k_tx_status tx;
-       } ds_us;
-
-#define ds_rxstat ds_us.rx
-#define ds_txstat ds_us.tx
-
+               struct ath5k_hw_5210_tx_desc    ds_tx5210;
+               struct ath5k_hw_5212_tx_desc    ds_tx5212;
+               struct ath5k_hw_all_rx_desc     ds_rx;
+       } ud;
 } __packed;
 
 #define AR5K_RXDESC_INTREQ     0x0020
@@ -892,6 +887,8 @@ enum ath5k_capability_type {
        AR5K_CAP_RFSILENT               = 20,   /* Supports RFsilent */
 };
 
+
+/* XXX: we *may* move cap_range stuff to struct wiphy */
 struct ath5k_capabilities {
        /*
         * Supported PHY modes
@@ -957,6 +954,7 @@ 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;
@@ -1032,8 +1030,10 @@ struct ath5k_hw {
        int (*ah_setup_xtx_desc)(struct ath5k_hw *, struct ath5k_desc *,
                unsigned int, unsigned int, unsigned int, unsigned int,
                unsigned int, unsigned int);
-       int (*ah_proc_tx_desc)(struct ath5k_hw *, struct ath5k_desc *);
-       int (*ah_proc_rx_desc)(struct ath5k_hw *, struct ath5k_desc *);
+       int (*ah_proc_tx_desc)(struct ath5k_hw *, struct ath5k_desc *,
+               struct ath5k_tx_status *);
+       int (*ah_proc_rx_desc)(struct ath5k_hw *, struct ath5k_desc *,
+               struct ath5k_rx_status *);
 };
 
 /*
@@ -1064,6 +1064,7 @@ extern int ath5k_hw_update_tx_triglevel(struct ath5k_hw *ah, bool increase);
 extern bool ath5k_hw_is_intr_pending(struct ath5k_hw *ah);
 extern int ath5k_hw_get_isr(struct ath5k_hw *ah, enum ath5k_int *interrupt_mask);
 extern enum ath5k_int ath5k_hw_set_intr(struct ath5k_hw *ah, enum ath5k_int new_mask);
+extern void ath5k_hw_update_mib_counters(struct ath5k_hw *ah, struct ieee80211_low_level_stats *stats);
 /* EEPROM access functions */
 extern int ath5k_hw_set_regdomain(struct ath5k_hw *ah, u16 regdomain);
 /* Protocol Control Unit Functions */
@@ -1092,7 +1093,6 @@ extern int ath5k_hw_set_beacon_timers(struct ath5k_hw *ah, const struct ath5k_be
 extern void ath5k_hw_reset_beacon(struct ath5k_hw *ah);
 extern int ath5k_hw_beaconq_finish(struct ath5k_hw *ah, unsigned long phys_addr);
 #endif
-extern void ath5k_hw_update_mib_counters(struct ath5k_hw *ah, struct ath5k_mib_stats *statistics);
 /* ACK bit rate */
 void ath5k_hw_set_ack_bitrate_high(struct ath5k_hw *ah, bool high);
 /* ACK/CTS Timeouts */