iwmc3200wifi: simplify calibration map
authorZhu Yi <yi.zhu@intel.com>
Thu, 25 Jun 2009 10:28:31 +0000 (18:28 +0800)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 10 Jul 2009 19:02:25 +0000 (15:02 -0400)
The patch simplifies calibration map by combining the init_calib_map
and periodic_calib_map into one calib_map in struct iwm_conf. Now the
initial calibration map is stored in the lower 16 bits of calib_map
and the periodic calibration map is stored in the higher 16 bits.

Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwmc3200wifi/fw.c
drivers/net/wireless/iwmc3200wifi/iwm.h
drivers/net/wireless/iwmc3200wifi/lmac.h
drivers/net/wireless/iwmc3200wifi/main.c

index ec1a15a5a0e4ee7fc10de7da1d2f2455c36364d3..c58f614ce6d84dc1ef1dabfeae7a93d5d5d656a0 100644 (file)
@@ -275,6 +275,7 @@ static int iwm_load_lmac(struct iwm_priv *iwm, const char *img_name)
  */
 int iwm_load_fw(struct iwm_priv *iwm)
 {
+       unsigned long init_calib_map, periodic_calib_map;
        int ret;
 
        /* We first start downloading the UMAC */
@@ -315,23 +316,25 @@ int iwm_load_fw(struct iwm_priv *iwm)
                return ret;
        }
 
+       init_calib_map = iwm->conf.calib_map & IWM_CALIB_MAP_INIT_MSK;
+       periodic_calib_map = IWM_CALIB_MAP_PER_LMAC(iwm->conf.calib_map);
+
 #ifdef CONFIG_IWM_B0_HW_SUPPORT
        if (iwm->conf.hw_b0) {
-               clear_bit(PHY_CALIBRATE_RX_IQ_CMD, &iwm->conf.init_calib_map);
-               clear_bit(PHY_CALIBRATE_RX_IQ_CMD,
-                         &iwm->conf.periodic_calib_map);
+               clear_bit(PHY_CALIBRATE_RX_IQ_CMD, &init_calib_map);
+               clear_bit(PHY_CALIBRATE_RX_IQ_CMD, &periodic_calib_map);
        }
 #endif
        /* Read RX IQ calibration result from EEPROM */
-       if (test_bit(PHY_CALIBRATE_RX_IQ_CMD, &iwm->conf.init_calib_map)) {
+       if (test_bit(PHY_CALIBRATE_RX_IQ_CMD, &init_calib_map)) {
                iwm_store_rxiq_calib_result(iwm);
                set_bit(PHY_CALIBRATE_RX_IQ_CMD, &iwm->calib_done_map);
        }
 
        iwm_send_prio_table(iwm);
-       iwm_send_init_calib_cfg(iwm, iwm->conf.init_calib_map);
+       iwm_send_init_calib_cfg(iwm, init_calib_map);
 
-       while (iwm->calib_done_map != iwm->conf.init_calib_map) {
+       while (iwm->calib_done_map != init_calib_map) {
                ret = iwm_notif_handle(iwm, CALIBRATION_RES_NOTIFICATION,
                                       IWM_SRC_LMAC, WAIT_NOTIF_TIMEOUT);
                if (ret) {
@@ -340,7 +343,7 @@ int iwm_load_fw(struct iwm_priv *iwm)
                }
                IWM_DBG_FW(iwm, DBG, "Got calibration result. calib_done_map: "
                           "0x%lx, requested calibrations: 0x%lx\n",
-                          iwm->calib_done_map, iwm->conf.init_calib_map);
+                          iwm->calib_done_map, init_calib_map);
        }
 
        /* Handle LMAC CALIBRATION_COMPLETE notification */
@@ -378,7 +381,7 @@ int iwm_load_fw(struct iwm_priv *iwm)
 
        iwm_send_prio_table(iwm);
        iwm_send_calib_results(iwm);
-       iwm_send_periodic_calib_cfg(iwm, iwm->conf.periodic_calib_map);
+       iwm_send_periodic_calib_cfg(iwm, periodic_calib_map);
 
        return 0;
 
index 4da57f737f2707e3e3d69fd3d197c30574b79a0e..1bad78f81350c7411efd9285e7be1d271e8fb10c 100644 (file)
@@ -65,8 +65,7 @@
 
 struct iwm_conf {
        u32 sdio_ior_timeout;
-       unsigned long init_calib_map;
-       unsigned long periodic_calib_map;
+       unsigned long calib_map;
        bool reset_on_fatal_err;
        bool auto_connect;
        bool wimax_not_present;
index db2e5eea1895c1ff4ff3e6112be72d648414b909..19213e165f5fa364e74be19df68e9666fa540c0b 100644 (file)
@@ -396,6 +396,10 @@ enum {
        CALIBRATION_CMD_NUM,
 };
 
+#define IWM_CALIB_MAP_INIT_MSK         0xFFFF
+#define IWM_CALIB_MAP_PER_LMAC(m)      ((m & 0xFF0000) >> 16)
+#define IWM_CALIB_MAP_PER_UMAC(m)      ((m & 0xFF000000) >> 24)
+
 struct iwm_lmac_calib_hdr {
        u8 opcode;
        u8 first_grp;
index 930056b013f3818cd7c88c799d809469fc2b8d5c..4fedb45d62b398d01eb606b5c0999fd6228af133 100644 (file)
 static struct iwm_conf def_iwm_conf = {
 
        .sdio_ior_timeout       = 5000,
-       .init_calib_map         = BIT(PHY_CALIBRATE_DC_CMD)     |
-                                 BIT(PHY_CALIBRATE_LO_CMD)     |
-                                 BIT(PHY_CALIBRATE_TX_IQ_CMD)  |
-                                 BIT(PHY_CALIBRATE_RX_IQ_CMD),
-       .periodic_calib_map     = BIT(PHY_CALIBRATE_DC_CMD)     |
+       .calib_map              = BIT(PHY_CALIBRATE_DC_CMD)     |
                                  BIT(PHY_CALIBRATE_LO_CMD)     |
                                  BIT(PHY_CALIBRATE_TX_IQ_CMD)  |
                                  BIT(PHY_CALIBRATE_RX_IQ_CMD)  |