diff options
Diffstat (limited to 'drivers/net/wireless/iwmc3200wifi/fw.c')
-rw-r--r-- | drivers/net/wireless/iwmc3200wifi/fw.c | 56 |
1 files changed, 39 insertions, 17 deletions
diff --git a/drivers/net/wireless/iwmc3200wifi/fw.c b/drivers/net/wireless/iwmc3200wifi/fw.c index 0f32cab9ced4..6b0bcad758ca 100644 --- a/drivers/net/wireless/iwmc3200wifi/fw.c +++ b/drivers/net/wireless/iwmc3200wifi/fw.c | |||
@@ -261,6 +261,33 @@ static int iwm_load_lmac(struct iwm_priv *iwm, const char *img_name) | |||
261 | cpu_to_le32(UMAC_RST_CTRL_FLG_LARC_CLK_EN), 0); | 261 | cpu_to_le32(UMAC_RST_CTRL_FLG_LARC_CLK_EN), 0); |
262 | } | 262 | } |
263 | 263 | ||
264 | static int iwm_init_calib(struct iwm_priv *iwm, unsigned long cfg_bitmap, | ||
265 | unsigned long expected_bitmap, u8 rx_iq_cmd) | ||
266 | { | ||
267 | /* Read RX IQ calibration result from EEPROM */ | ||
268 | if (test_bit(rx_iq_cmd, &cfg_bitmap)) { | ||
269 | iwm_store_rxiq_calib_result(iwm); | ||
270 | set_bit(PHY_CALIBRATE_RX_IQ_CMD, &iwm->calib_done_map); | ||
271 | } | ||
272 | |||
273 | iwm_send_prio_table(iwm); | ||
274 | iwm_send_init_calib_cfg(iwm, cfg_bitmap); | ||
275 | |||
276 | while (iwm->calib_done_map != expected_bitmap) { | ||
277 | if (iwm_notif_handle(iwm, CALIBRATION_RES_NOTIFICATION, | ||
278 | IWM_SRC_LMAC, WAIT_NOTIF_TIMEOUT)) { | ||
279 | IWM_DBG_FW(iwm, DBG, "Initial calibration timeout\n"); | ||
280 | return -ETIMEDOUT; | ||
281 | } | ||
282 | |||
283 | IWM_DBG_FW(iwm, DBG, "Got calibration result. calib_done_map: " | ||
284 | "0x%lx, expected calibrations: 0x%lx\n", | ||
285 | iwm->calib_done_map, expected_bitmap); | ||
286 | } | ||
287 | |||
288 | return 0; | ||
289 | } | ||
290 | |||
264 | /* | 291 | /* |
265 | * We currently have to load 3 FWs: | 292 | * We currently have to load 3 FWs: |
266 | * 1) The UMAC (Upper MAC). | 293 | * 1) The UMAC (Upper MAC). |
@@ -276,6 +303,7 @@ static int iwm_load_lmac(struct iwm_priv *iwm, const char *img_name) | |||
276 | int iwm_load_fw(struct iwm_priv *iwm) | 303 | int iwm_load_fw(struct iwm_priv *iwm) |
277 | { | 304 | { |
278 | unsigned long init_calib_map, periodic_calib_map; | 305 | unsigned long init_calib_map, periodic_calib_map; |
306 | unsigned long expected_calib_map; | ||
279 | int ret; | 307 | int ret; |
280 | 308 | ||
281 | /* We first start downloading the UMAC */ | 309 | /* We first start downloading the UMAC */ |
@@ -317,27 +345,21 @@ int iwm_load_fw(struct iwm_priv *iwm) | |||
317 | } | 345 | } |
318 | 346 | ||
319 | init_calib_map = iwm->conf.calib_map & IWM_CALIB_MAP_INIT_MSK; | 347 | init_calib_map = iwm->conf.calib_map & IWM_CALIB_MAP_INIT_MSK; |
348 | expected_calib_map = iwm->conf.expected_calib_map & | ||
349 | IWM_CALIB_MAP_INIT_MSK; | ||
320 | periodic_calib_map = IWM_CALIB_MAP_PER_LMAC(iwm->conf.calib_map); | 350 | periodic_calib_map = IWM_CALIB_MAP_PER_LMAC(iwm->conf.calib_map); |
321 | 351 | ||
322 | /* Read RX IQ calibration result from EEPROM */ | 352 | ret = iwm_init_calib(iwm, init_calib_map, expected_calib_map, |
323 | if (test_bit(PHY_CALIBRATE_RX_IQ_CMD, &init_calib_map)) { | 353 | CALIB_CFG_RX_IQ_IDX); |
324 | iwm_store_rxiq_calib_result(iwm); | 354 | if (ret < 0) { |
325 | set_bit(PHY_CALIBRATE_RX_IQ_CMD, &iwm->calib_done_map); | 355 | /* Let's try the old way */ |
326 | } | 356 | ret = iwm_init_calib(iwm, expected_calib_map, |
327 | 357 | expected_calib_map, | |
328 | iwm_send_prio_table(iwm); | 358 | PHY_CALIBRATE_RX_IQ_CMD); |
329 | iwm_send_init_calib_cfg(iwm, init_calib_map); | 359 | if (ret < 0) { |
330 | 360 | IWM_ERR(iwm, "Calibration result timeout\n"); | |
331 | while (iwm->calib_done_map != init_calib_map) { | ||
332 | ret = iwm_notif_handle(iwm, CALIBRATION_RES_NOTIFICATION, | ||
333 | IWM_SRC_LMAC, WAIT_NOTIF_TIMEOUT); | ||
334 | if (ret) { | ||
335 | IWM_ERR(iwm, "Wait for calibration result timeout\n"); | ||
336 | goto out; | 361 | goto out; |
337 | } | 362 | } |
338 | IWM_DBG_FW(iwm, DBG, "Got calibration result. calib_done_map: " | ||
339 | "0x%lx, requested calibrations: 0x%lx\n", | ||
340 | iwm->calib_done_map, init_calib_map); | ||
341 | } | 363 | } |
342 | 364 | ||
343 | /* Handle LMAC CALIBRATION_COMPLETE notification */ | 365 | /* Handle LMAC CALIBRATION_COMPLETE notification */ |