iwlwifi-5000: implement initial calibration for 5000
[safe/jmp/linux-2.6] / drivers / net / wireless / iwlwifi / iwl-commands.h
index e5449b8..6f62beb 100644 (file)
@@ -93,6 +93,11 @@ enum {
        REPLY_LEDS_CMD = 0x48,
        REPLY_TX_LINK_QUALITY_CMD = 0x4e, /* 4965 only */
 
+       /* WiMAX coexistence */
+       COEX_PRIORITY_TABLE_CMD = 0x5a, /*5000 only */
+       COEX_MEDIUM_NOTIFICATION = 0x5b,
+       COEX_EVENT_CMD = 0x5c,
+
        /* 802.11h related */
        RADAR_NOTIFICATION = 0x70,      /* not used */
        REPLY_QUIET_CMD = 0x71,         /* not used */
@@ -368,7 +373,7 @@ struct iwl4965_tx_power_db {
  * 3)  Tx gain compensation to balance 4965's 2 Tx chains for MIMO operation,
  *     for each of 5 frequency ranges.
  */
-struct iwl4965_init_alive_resp {
+struct iwl_init_alive_resp {
        u8 ucode_minor;
        u8 ucode_major;
        __le16 reserved1;
@@ -444,7 +449,7 @@ struct iwl4965_init_alive_resp {
  * The Linux driver can print both logs to the system log when a uCode error
  * occurs.
  */
-struct iwl4965_alive_resp {
+struct iwl_alive_resp {
        u8 ucode_minor;
        u8 ucode_major;
        __le16 reserved1;
@@ -468,7 +473,7 @@ union tsf {
 /*
  * REPLY_ERROR = 0x2 (response only, not a command)
  */
-struct iwl4965_error_resp {
+struct iwl_error_resp {
        __le32 error_type;
        u8 cmd_id;
        u8 reserved1;
@@ -600,6 +605,32 @@ struct iwl4965_rxon_cmd {
        u8 ofdm_ht_dual_stream_basic_rates;
 } __attribute__ ((packed));
 
+/* 5000 HW just extend this cmmand */
+struct iwl_rxon_cmd {
+       u8 node_addr[6];
+       __le16 reserved1;
+       u8 bssid_addr[6];
+       __le16 reserved2;
+       u8 wlap_bssid_addr[6];
+       __le16 reserved3;
+       u8 dev_type;
+       u8 air_propagation;
+       __le16 rx_chain;
+       u8 ofdm_basic_rates;
+       u8 cck_basic_rates;
+       __le16 assoc_id;
+       __le32 flags;
+       __le32 filter_flags;
+       __le16 channel;
+       u8 ofdm_ht_single_stream_basic_rates;
+       u8 ofdm_ht_dual_stream_basic_rates;
+       u8 ofdm_ht_triple_stream_basic_rates;
+       u8 reserved5;
+       __le16 acquisition_data;
+       __le16 reserved6;
+} __attribute__ ((packed));
+
+
 /*
  * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
  */
@@ -769,6 +800,20 @@ struct iwl4965_keyinfo {
        u8 key[16];             /* 16-byte unicast decryption key */
 } __attribute__ ((packed));
 
+/* 5000 */
+struct iwl_keyinfo {
+       __le16 key_flags;
+       u8 tkip_rx_tsc_byte2;   /* TSC[2] for key mix ph1 detection */
+       u8 reserved1;
+       __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */
+       u8 key_offset;
+       u8 reserved2;
+       u8 key[16];             /* 16-byte unicast decryption key */
+       __le64 tx_secur_seq_cnt;
+       __le64 hw_tkip_mic_rx_key;
+       __le64 hw_tkip_mic_tx_key;
+} __attribute__ ((packed));
+
 /**
  * struct sta_id_modify
  * @addr[ETH_ALEN]: station's MAC address
@@ -844,6 +889,38 @@ struct iwl4965_addsta_cmd {
        __le32 reserved2;
 } __attribute__ ((packed));
 
+/* 5000 */
+struct iwl_addsta_cmd {
+       u8 mode;                /* 1: modify existing, 0: add new station */
+       u8 reserved[3];
+       struct sta_id_modify sta;
+       struct iwl_keyinfo key;
+       __le32 station_flags;           /* STA_FLG_* */
+       __le32 station_flags_msk;       /* STA_FLG_* */
+
+       /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
+        * corresponding to bit (e.g. bit 5 controls TID 5).
+        * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
+       __le16 tid_disable_tx;
+
+       __le16  reserved1;
+
+       /* TID for which to add block-ack support.
+        * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
+       u8 add_immediate_ba_tid;
+
+       /* TID for which to remove block-ack support.
+        * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
+       u8 remove_immediate_ba_tid;
+
+       /* Starting Sequence Number for added block-ack support.
+        * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
+       __le16 add_immediate_ba_ssn;
+
+       __le32 reserved2;
+} __attribute__ ((packed));
+
+
 #define ADD_STA_SUCCESS_MSK            0x1
 #define ADD_STA_NO_ROOM_IN_TABLE       0x2
 #define ADD_STA_NO_BLOCK_ACK_RESOURCE  0x4
@@ -851,10 +928,28 @@ struct iwl4965_addsta_cmd {
 /*
  * REPLY_ADD_STA = 0x18 (response)
  */
-struct iwl4965_add_sta_resp {
+struct iwl_add_sta_resp {
        u8 status;      /* ADD_STA_* */
 } __attribute__ ((packed));
 
+#define REM_STA_SUCCESS_MSK              0x1
+/*
+ *  REPLY_REM_STA = 0x19 (response)
+ */
+struct iwl_rem_sta_resp {
+       u8 status;
+} __attribute__ ((packed));
+
+/*
+ *  REPLY_REM_STA = 0x19 (command)
+ */
+struct iwl_rem_sta_cmd {
+       u8 num_sta;     /* number of removed stations */
+       u8 reserved[3];
+       u8 addr[ETH_ALEN]; /* MAC addr of the first station */
+       u8 reserved2[2];
+} __attribute__ ((packed));
+
 /*
  * REPLY_WEP_KEY = 0x20
  */
@@ -1124,7 +1219,7 @@ struct iwl4965_dram_scratch {
 /*
  * REPLY_TX = 0x1c (command)
  */
-struct iwl4965_tx_cmd {
+struct iwl_tx_cmd {
        /*
         * MPDU byte count:
         * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
@@ -2063,7 +2158,7 @@ struct iwl4965_scan_cmd {
 
        /* For active scans (set to all-0s for passive scans).
         * Does not include payload.  Must specify Tx rate; no rate scaling. */
-       struct iwl4965_tx_cmd tx_cmd;
+       struct iwl_tx_cmd tx_cmd;
 
        /* For directed active scans (set to all-0s otherwise) */
        struct iwl4965_ssid_ie direct_scan[PROBE_OPTION_MAX];
@@ -2160,7 +2255,7 @@ struct iwl4965_beacon_notif {
  * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
  */
 struct iwl4965_tx_beacon_cmd {
-       struct iwl4965_tx_cmd tx;
+       struct iwl_tx_cmd tx;
        __le16 tim_idx;
        u8 tim_size;
        u8 reserved1;
@@ -2683,10 +2778,59 @@ enum {
        IWL5000_PHY_CALIBRATE_AGC_TABLE_CMD     = 14,
        IWL5000_PHY_CALIBRATE_CRYSTAL_FRQ_CMD   = 15,
        IWL5000_PHY_CALIBRATE_BASE_BAND_CMD     = 16,
+       IWL5000_PHY_CALIBRATE_TX_IQ_PERD_CMD    = 17,
        IWL5000_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD = 18,
        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 {
+       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 {
+       __le32 is_enable;
+       __le32 start;
+       __le32 send_res;
+       __le32 apply_res;
+       __le32 reserved;
+} __attribute__ ((packed));
+
+struct iwl_calib_cfg_status_s {
+       struct iwl_calib_cfg_elmnt_s once;
+       struct iwl_calib_cfg_elmnt_s perd;
+       __le32 flags;
+} __attribute__ ((packed));
+
+struct iwl5000_calib_cfg_cmd {
+       struct iwl_calib_cfg_status_s ucd_calib_cfg;
+       struct iwl_calib_cfg_status_s drv_calib_cfg;
+       __le32 reserved1;
+} __attribute__ ((packed));
+
+struct iwl5000_calib_hdr {
+       u8 op_code;
+       u8 first_group;
+       u8 groups_num;
+       u8 data_valid;
+} __attribute__ ((packed));
+
 struct iwl5000_calibration_chain_noise_reset_cmd {
        u8 op_code;     /* IWL5000_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD */
        u8 flags;       /* not used */
@@ -2725,6 +2869,55 @@ struct iwl4965_led_cmd {
        u8 reserved;
 } __attribute__ ((packed));
 
+/*
+ * Coexistence WIFI/WIMAX  Command
+ * COEX_PRIORITY_TABLE_CMD = 0x5a
+ *
+ */
+enum {
+       COEX_UNASSOC_IDLE               = 0,
+       COEX_UNASSOC_MANUAL_SCAN        = 1,
+       COEX_UNASSOC_AUTO_SCAN          = 2,
+       COEX_CALIBRATION                = 3,
+       COEX_PERIODIC_CALIBRATION       = 4,
+       COEX_CONNECTION_ESTAB           = 5,
+       COEX_ASSOCIATED_IDLE            = 6,
+       COEX_ASSOC_MANUAL_SCAN          = 7,
+       COEX_ASSOC_AUTO_SCAN            = 8,
+       COEX_ASSOC_ACTIVE_LEVEL         = 9,
+       COEX_RF_ON                      = 10,
+       COEX_RF_OFF                     = 11,
+       COEX_STAND_ALONE_DEBUG          = 12,
+       COEX_IPAN_ASSOC_LEVEL           = 13,
+       COEX_RSRVD1                     = 14,
+       COEX_RSRVD2                     = 15,
+       COEX_NUM_OF_EVENTS              = 16
+};
+
+struct iwl_wimax_coex_event_entry {
+       u8 request_prio;
+       u8 win_medium_prio;
+       u8 reserved;
+       u8 flags;
+} __attribute__ ((packed));
+
+/* COEX flag masks */
+
+/* Staion table is valid */
+#define COEX_FLAGS_STA_TABLE_VALID_MSK      (0x1)
+/* UnMask wakeup src at unassociated sleep */
+#define COEX_FLAGS_UNASSOC_WA_UNMASK_MSK    (0x4)
+/* UnMask wakeup src at associated sleep */
+#define COEX_FLAGS_ASSOC_WA_UNMASK_MSK      (0x8)
+/* Enable CoEx feature. */
+#define COEX_FLAGS_COEX_ENABLE_MSK          (0x80)
+
+struct iwl_wimax_coex_cmd {
+       u8 flags;
+       u8 reserved[3];
+       struct iwl_wimax_coex_event_entry sta_prio[COEX_NUM_OF_EVENTS];
+} __attribute__ ((packed));
+
 /******************************************************************************
  * (13)
  * Union of all expected notifications/responses:
@@ -2735,20 +2928,22 @@ struct iwl_rx_packet {
        __le32 len;
        struct iwl_cmd_header hdr;
        union {
-               struct iwl4965_alive_resp alive_frame;
+               struct iwl_alive_resp alive_frame;
                struct iwl4965_rx_frame rx_frame;
                struct iwl4965_tx_resp tx_resp;
                struct iwl4965_spectrum_notification spectrum_notif;
                struct iwl4965_csa_notification csa_notif;
-               struct iwl4965_error_resp err_resp;
+               struct iwl_error_resp err_resp;
                struct iwl4965_card_state_notif card_state_notif;
                struct iwl4965_beacon_notif beacon_status;
-               struct iwl4965_add_sta_resp add_sta;
+               struct iwl_add_sta_resp add_sta;
+               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 iwl4965_missed_beacon_notif missed_beacon;
+               struct iwl5000_calibration calib;
                __le32 status;
                u8 raw[0];
        } u;