iwlwifi: unify tx antenna toggling
[safe/jmp/linux-2.6] / drivers / net / wireless / iwlwifi / iwl-commands.h
index 6957b22..67680a7 100644 (file)
@@ -98,6 +98,11 @@ enum {
        COEX_MEDIUM_NOTIFICATION = 0x5b,
        COEX_EVENT_CMD = 0x5c,
 
+       /* Calibration */
+       CALIBRATION_CFG_CMD = 0x65,
+       CALIBRATION_RES_NOTIFICATION = 0x66,
+       CALIBRATION_COMPLETE_NOTIFICATION = 0x67,
+
        /* 802.11h related */
        RADAR_NOTIFICATION = 0x70,      /* not used */
        REPLY_QUIET_CMD = 0x71,         /* not used */
@@ -163,6 +168,13 @@ enum {
 /* iwl_cmd_header flags value */
 #define IWL_CMD_FAILED_MSK 0x40
 
+#define SEQ_TO_QUEUE(s)        (((s) >> 8) & 0x1f)
+#define QUEUE_TO_SEQ(q)        (((q) & 0x1f) << 8)
+#define SEQ_TO_INDEX(s)        ((s) & 0xff)
+#define INDEX_TO_SEQ(i)        ((i) & 0xff)
+#define SEQ_HUGE_FRAME __constant_cpu_to_le16(0x4000)
+#define SEQ_RX_FRAME   __constant_cpu_to_le16(0x8000)
+
 /**
  * struct iwl_cmd_header
  *
@@ -171,7 +183,7 @@ enum {
  */
 struct iwl_cmd_header {
        u8 cmd;         /* Command ID:  REPLY_RXON, etc. */
-       u8 flags;       /* IWL_CMD_* */
+       u8 flags;       /* 0:5 reserved, 6 abort, 7 internal */
        /*
         * The driver sets up the sequence number to values of its chosing.
         * uCode does not use this value, but passes it back to the driver
@@ -187,11 +199,12 @@ struct iwl_cmd_header {
         *
         * The Linux driver uses the following format:
         *
-        *  0:7    index/position within Tx queue
-        *  8:13   Tx queue selection
-        * 14:14   driver sets this to indicate command is in the 'huge'
-        *         storage at the end of the command buffers, i.e. scan cmd
-        * 15:15   uCode sets this in uCode-originated response/notification
+        *  0:7         tfd index - position within TX queue
+        *  8:12        TX queue id
+        *  13          reserved
+        *  14          huge - driver sets this to indicate command is in the
+        *              'huge' storage at the end of the command buffers
+        *  15          unsolicited RX or uCode-originated notification
         */
        __le16 sequence;
 
@@ -270,18 +283,20 @@ struct iwl_cmd_header {
 #define RATE_MCS_SGI_MSK 0x2000
 
 /**
- * rate_n_flags Tx antenna masks (4965 has 2 transmitters):
- * bit14:15 01 B inactive, A active
- *          10 B active, A inactive
- *          11 Both active
+ * rate_n_flags Tx antenna masks
+ * 4965 has 2 transmitters
+ * 5100 has 1 transmitter B
+ * 5150 has 1 transmitter A
+ * 5300 has 3 transmitters
+ * 5350 has 3 transmitters
+ * bit14:16
  */
 #define RATE_MCS_ANT_POS      14
 #define RATE_MCS_ANT_A_MSK    0x04000
 #define RATE_MCS_ANT_B_MSK    0x08000
 #define RATE_MCS_ANT_C_MSK    0x10000
 #define RATE_MCS_ANT_ABC_MSK  0x1C000
-
-#define RATE_MCS_ANT_INIT_IND   1
+#define RATE_ANT_NUM 3
 
 #define POWER_TABLE_NUM_ENTRIES                        33
 #define POWER_TABLE_NUM_HT_OFDM_ENTRIES                32
@@ -469,11 +484,6 @@ struct iwl_alive_resp {
 } __attribute__ ((packed));
 
 
-union tsf {
-       u8 byte[8];
-       __le16 word[4];
-       __le32 dw[2];
-};
 
 /*
  * REPLY_ERROR = 0x2 (response only, not a command)
@@ -484,7 +494,7 @@ struct iwl_error_resp {
        u8 reserved1;
        __le16 bad_cmd_seq_num;
        __le32 error_info;
-       union tsf timestamp;
+       __le64 timestamp;
 } __attribute__ ((packed));
 
 /******************************************************************************
@@ -556,6 +566,8 @@ enum {
 #define RXON_FLG_CHANNEL_MODE_MSK              __constant_cpu_to_le32(0x3 << 25)
 #define RXON_FLG_CHANNEL_MODE_PURE_40_MSK      __constant_cpu_to_le32(0x1 << 25)
 #define RXON_FLG_CHANNEL_MODE_MIXED_MSK                __constant_cpu_to_le32(0x2 << 25)
+/* CTS to self (if spec allows) flag */
+#define RXON_FLG_SELF_CTS_EN                   __constant_cpu_to_le32(0x1<<30)
 
 /* rx_config filter flags */
 /* accept all data frames */
@@ -664,14 +676,13 @@ struct iwl4965_rxon_assoc_cmd {
        __le16 reserved;
 } __attribute__ ((packed));
 
-
-
+#define IWL_CONN_MAX_LISTEN_INTERVAL   10
 
 /*
  * REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
  */
-struct iwl4965_rxon_time_cmd {
-       union tsf timestamp;
+struct iwl_rxon_time_cmd {
+       __le64 timestamp;
        __le16 beacon_interval;
        __le16 atim_window;
        __le32 beacon_init_val;
@@ -723,7 +734,7 @@ struct iwl4965_csa_notification {
  * transmission retry.  Device uses cw_max as a bit mask, ANDed with new CW
  * value, to cap the CW value.
  */
-struct iwl4965_ac_qos {
+struct iwl_ac_qos {
        __le16 cw_min;
        __le16 cw_max;
        u8 aifsn;
@@ -745,9 +756,9 @@ struct iwl4965_ac_qos {
  * This command sets up timings for each of the 4 prioritized EDCA Tx FIFOs
  * 0: Background, 1: Best Effort, 2: Video, 3: Voice.
  */
-struct iwl4965_qosparam_cmd {
+struct iwl_qosparam_cmd {
        __le32 qos_flags;
-       struct iwl4965_ac_qos ac[AC_NUM];
+       struct iwl_ac_qos ac[AC_NUM];
 } __attribute__ ((packed));
 
 /******************************************************************************
@@ -1074,10 +1085,12 @@ struct iwl4965_rx_frame {
 } __attribute__ ((packed));
 
 /* Fixed (non-configurable) rx data from phy */
-#define RX_PHY_FLAGS_ANTENNAE_OFFSET           (4)
-#define RX_PHY_FLAGS_ANTENNAE_MASK             (0x70)
-#define IWL_AGC_DB_MASK        (0x3f80)        /* MASK(7,13) */
-#define IWL_AGC_DB_POS         (7)
+
+#define IWL49_RX_RES_PHY_CNT 14
+#define IWL49_RX_PHY_FLAGS_ANTENNAE_OFFSET     (4)
+#define IWL49_RX_PHY_FLAGS_ANTENNAE_MASK       (0x70)
+#define IWL49_AGC_DB_MASK                      (0x3f80)        /* MASK(7,13) */
+#define IWL49_AGC_DB_POS                       (7)
 struct iwl4965_rx_non_cfg_phy {
        __le16 ant_selection;   /* ant A bit 4, ant B bit 5, ant C bit 6 */
        __le16 agc_info;        /* agc code 0:6, agc dB 7:13, reserved 14:15 */
@@ -1085,12 +1098,30 @@ struct iwl4965_rx_non_cfg_phy {
        u8 pad[0];
 } __attribute__ ((packed));
 
+
+#define IWL50_RX_RES_PHY_CNT 8
+#define IWL50_RX_RES_AGC_IDX     1
+#define IWL50_RX_RES_RSSI_AB_IDX 2
+#define IWL50_RX_RES_RSSI_C_IDX  3
+#define IWL50_OFDM_AGC_MSK 0xfe00
+#define IWL50_OFDM_AGC_BIT_POS 9
+#define IWL50_OFDM_RSSI_A_MSK 0x00ff
+#define IWL50_OFDM_RSSI_A_BIT_POS 0
+#define IWL50_OFDM_RSSI_B_MSK 0xff0000
+#define IWL50_OFDM_RSSI_B_BIT_POS 16
+#define IWL50_OFDM_RSSI_C_MSK 0x00ff
+#define IWL50_OFDM_RSSI_C_BIT_POS 0
+
+struct iwl5000_non_cfg_phy {
+       __le32 non_cfg_phy[IWL50_RX_RES_PHY_CNT];  /* upto 8 phy entries */
+} __attribute__ ((packed));
+
+
 /*
  * REPLY_RX = 0xc3 (response only, not a command)
  * Used only for legacy (non 11n) frames.
  */
-#define RX_RES_PHY_CNT 14
-struct iwl4965_rx_phy_res {
+struct iwl_rx_phy_res {
        u8 non_cfg_phy_cnt;     /* non configurable DSP phy data byte count */
        u8 cfg_phy_cnt;         /* configurable DSP phy data byte count */
        u8 stat_id;             /* configurable DSP phy data set ID */
@@ -1099,8 +1130,7 @@ struct iwl4965_rx_phy_res {
        __le32 beacon_time_stamp; /* beacon at on-air rise */
        __le16 phy_flags;       /* general phy flags: band, modulation, ... */
        __le16 channel;         /* channel number */
-       __le16 non_cfg_phy[RX_RES_PHY_CNT];     /* upto 14 phy entries */
-       __le32 reserved2;
+       u8 non_cfg_phy_buf[32]; /* for various implementations of non_cfg_phy */
        __le32 rate_n_flags;    /* RATE_MCS_* */
        __le16 byte_count;      /* frame's byte-count */
        __le16 reserved3;
@@ -1139,6 +1169,11 @@ struct iwl4965_rx_mpdu_res_start {
 
 /* REPLY_TX Tx flags field */
 
+/* 1: Use RTS/CTS protocol or CTS-to-self if spec alows it
+ * before this frame. if CTS-to-self required check
+ * RXON_FLG_SELF_CTS_EN status. */
+#define TX_CMD_FLG_RTS_CTS_MSK __constant_cpu_to_le32(1 << 0)
+
 /* 1: Use Request-To-Send protocol before this frame.
  * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK. */
 #define TX_CMD_FLG_RTS_MSK __constant_cpu_to_le32(1 << 1)
@@ -1536,7 +1571,7 @@ struct iwl5000_tx_resp {
  *
  * Reports Block-Acknowledge from recipient station
  */
-struct iwl4965_compressed_ba_resp {
+struct iwl_compressed_ba_resp {
        __le32 sta_addr_lo32;
        __le16 sta_addr_hi16;
        __le16 reserved;
@@ -1986,7 +2021,7 @@ struct iwl4965_spectrum_notification {
  *****************************************************************************/
 
 /**
- * struct iwl4965_powertable_cmd - Power Table Command
+ * struct iwl_powertable_cmd - Power Table Command
  * @flags: See below:
  *
  * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
@@ -2001,8 +2036,8 @@ struct iwl4965_spectrum_notification {
  *   bit 2 - '0' PM have to walk up every DTIM
  *           '1' PM could sleep over DTIM till listen Interval.
  * PCI power managed
- *   bit 3 - '0' (PCI_LINK_CTRL & 0x1)
- *           '1' !(PCI_LINK_CTRL & 0x1)
+ *   bit 3 - '0' (PCI_CFG_LINK_CTRL & 0x1)
+ *           '1' !(PCI_CFG_LINK_CTRL & 0x1)
  * Force sleep Modes
  *   bit 31/30- '00' use both mac/xtal sleeps
  *              '01' force Mac sleep
@@ -2020,7 +2055,7 @@ struct iwl4965_spectrum_notification {
 #define IWL_POWER_PCI_PM_MSK                   __constant_cpu_to_le16(1 << 3)
 #define IWL_POWER_FAST_PD                      __constant_cpu_to_le16(1 << 4)
 
-struct iwl4965_powertable_cmd {
+struct iwl_powertable_cmd {
        __le16 flags;
        u8 keep_alive_seconds;
        u8 debug_flags;
@@ -2092,6 +2127,9 @@ struct iwl_ct_kill_config {
  *
  *****************************************************************************/
 
+#define SCAN_CHANNEL_TYPE_PASSIVE __constant_cpu_to_le32(0)
+#define SCAN_CHANNEL_TYPE_ACTIVE  __constant_cpu_to_le32(1)
+
 /**
  * struct iwl_scan_channel - entry in REPLY_SCAN_CMD channel table
  *
@@ -2115,12 +2153,12 @@ struct iwl_scan_channel {
        /*
         * type is defined as:
         * 0:0 1 = active, 0 = passive
-        * 1:4 SSID direct bit map; if a bit is set, then corresponding
+        * 1:20 SSID direct bit map; if a bit is set, then corresponding
         *     SSID IE is transmitted in probe request.
-        * 5:7 reserved
+        * 21:31 reserved
         */
-       u8 type;
-       u8 channel;     /* band is selected by iwl4965_scan_cmd "flags" field */
+       __le32 type;
+       __le16 channel; /* band is selected by iwl_scan_cmd "flags" field */
        u8 tx_gain;             /* gain for analog radio */
        u8 dsp_atten;           /* gain for DSP */
        __le16 active_dwell;    /* in 1024-uSec TU (time units), typ 5-50 */
@@ -2140,9 +2178,9 @@ struct iwl_ssid_ie {
        u8 ssid[32];
 } __attribute__ ((packed));
 
-#define PROBE_OPTION_MAX        0x4
+#define PROBE_OPTION_MAX               0x14
 #define TX_CMD_LIFE_TIME_INFINITE      __constant_cpu_to_le32(0xFFFFFFFF)
-#define IWL_GOOD_CRC_TH                __constant_cpu_to_le16(1)
+#define IWL_GOOD_CRC_TH                        __constant_cpu_to_le16(1)
 #define IWL_MAX_SCAN_SIZE 1024
 
 /*
@@ -2314,7 +2352,7 @@ struct iwl4965_beacon_notif {
 /*
  * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
  */
-struct iwl4965_tx_beacon_cmd {
+struct iwl_tx_beacon_cmd {
        struct iwl_tx_cmd tx;
        __le16 tim_idx;
        u8 tim_size;
@@ -2506,7 +2544,7 @@ struct statistics_general {
  */
 #define IWL_STATS_CONF_CLEAR_STATS __constant_cpu_to_le32(0x1) /* see above */
 #define IWL_STATS_CONF_DISABLE_NOTIF __constant_cpu_to_le32(0x2)/* see above */
-struct iwl4965_statistics_cmd {
+struct iwl_statistics_cmd {
        __le32 configuration_flags;     /* IWL_STATS_CONF_* */
 } __attribute__ ((packed));
 
@@ -2527,7 +2565,7 @@ struct iwl4965_statistics_cmd {
  */
 #define STATISTICS_REPLY_FLG_BAND_24G_MSK         __constant_cpu_to_le32(0x2)
 #define STATISTICS_REPLY_FLG_FAT_MODE_MSK         __constant_cpu_to_le32(0x8)
-struct iwl4965_notif_statistics {
+struct iwl_notif_statistics {
        __le32 flag;
        struct statistics_rx rx;
        struct statistics_tx tx;
@@ -2843,25 +2881,11 @@ enum {
        IWL5000_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD = 19,
 };
 
-enum {
-       CALIBRATION_CFG_CMD = 0x65,
-       CALIBRATION_RES_NOTIFICATION = 0x66,
-       CALIBRATION_COMPLETE_NOTIFICATION = 0x67
-};
-
-struct iwl_cal_crystal_freq_cmd {
+struct iwl_cal_xtal_freq {
        u8 cap_pin1;
        u8 cap_pin2;
 } __attribute__ ((packed));
 
-struct iwl5000_calibration {
-       u8 op_code;
-       u8 first_group;
-       u8 num_groups;
-       u8 all_data_valid;
-       struct iwl_cal_crystal_freq_cmd data;
-} __attribute__ ((packed));
-
 #define IWL_CALIB_INIT_CFG_ALL __constant_cpu_to_le32(0xffffffff)
 
 struct iwl_calib_cfg_elmnt_s {
@@ -2891,6 +2915,11 @@ struct iwl5000_calib_hdr {
        u8 data_valid;
 } __attribute__ ((packed));
 
+struct iwl5000_calib_cmd {
+       struct iwl5000_calib_hdr hdr;
+       u8 data[0];
+} __attribute__ ((packed));
+
 struct iwl5000_calibration_chain_noise_reset_cmd {
        u8 op_code;     /* IWL5000_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD */
        u8 flags;       /* not used */
@@ -2919,7 +2948,7 @@ struct iwl5000_calibration_chain_noise_gain_cmd {
  * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field),
  * this command turns it on or off, or sets up a periodic blinking cycle.
  */
-struct iwl4965_led_cmd {
+struct iwl_led_cmd {
        __le32 interval;        /* "interval" in uSec */
        u8 id;                  /* 1: Activity, 2: Link, 3: Tech */
        u8 off;                 /* # intervals off while blinking;
@@ -3000,10 +3029,9 @@ struct iwl_rx_packet {
                struct iwl_rem_sta_resp rem_sta;
                struct iwl4965_sleep_notification sleep_notif;
                struct iwl4965_spectrum_resp spectrum;
-               struct iwl4965_notif_statistics stats;
-               struct iwl4965_compressed_ba_resp compressed_ba;
+               struct iwl_notif_statistics stats;
+               struct iwl_compressed_ba_resp compressed_ba;
                struct iwl4965_missed_beacon_notif missed_beacon;
-               struct iwl5000_calibration calib;
                __le32 status;
                u8 raw[0];
        } u;