aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/dvm/ucode.c
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2012-12-24 09:51:22 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-01-03 09:27:41 -0500
commitd28cbdef8cb7ea04d5ef7c9d7b14df0751560522 (patch)
tree8610a79b4af4fa9e1767835e20484d8036a3d59b /drivers/net/wireless/iwlwifi/dvm/ucode.c
parentda58eefa6d16281c063eba6467690325bfb5f372 (diff)
iwlwifi: don't verify fw after download
No need to verify that the fw has been written correctly. In case it hasn't, we won't get ALIVE notification. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/dvm/ucode.c')
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/ucode.c94
1 files changed, 0 insertions, 94 deletions
diff --git a/drivers/net/wireless/iwlwifi/dvm/ucode.c b/drivers/net/wireless/iwlwifi/dvm/ucode.c
index c6467e5554f5..ecf700bf9842 100644
--- a/drivers/net/wireless/iwlwifi/dvm/ucode.c
+++ b/drivers/net/wireless/iwlwifi/dvm/ucode.c
@@ -286,89 +286,6 @@ static int iwl_alive_notify(struct iwl_priv *priv)
286 return iwl_send_calib_results(priv); 286 return iwl_send_calib_results(priv);
287} 287}
288 288
289
290/**
291 * iwl_verify_inst_sparse - verify runtime uCode image in card vs. host,
292 * using sample data 100 bytes apart. If these sample points are good,
293 * it's a pretty good bet that everything between them is good, too.
294 */
295static int iwl_verify_sec_sparse(struct iwl_priv *priv,
296 const struct fw_desc *fw_desc)
297{
298 __le32 *image = (__le32 *)fw_desc->data;
299 u32 len = fw_desc->len;
300 u32 val;
301 u32 i;
302
303 IWL_DEBUG_FW(priv, "ucode inst image size is %u\n", len);
304
305 for (i = 0; i < len; i += 100, image += 100/sizeof(u32)) {
306 /* read data comes through single port, auto-incr addr */
307 /* NOTE: Use the debugless read so we don't flood kernel log
308 * if IWL_DL_IO is set */
309 iwl_write_direct32(priv->trans, HBUS_TARG_MEM_RADDR,
310 i + fw_desc->offset);
311 val = iwl_read32(priv->trans, HBUS_TARG_MEM_RDAT);
312 if (val != le32_to_cpu(*image))
313 return -EIO;
314 }
315
316 return 0;
317}
318
319static void iwl_print_mismatch_sec(struct iwl_priv *priv,
320 const struct fw_desc *fw_desc)
321{
322 __le32 *image = (__le32 *)fw_desc->data;
323 u32 len = fw_desc->len;
324 u32 val;
325 u32 offs;
326 int errors = 0;
327
328 IWL_DEBUG_FW(priv, "ucode inst image size is %u\n", len);
329
330 iwl_write_direct32(priv->trans, HBUS_TARG_MEM_RADDR,
331 fw_desc->offset);
332
333 for (offs = 0;
334 offs < len && errors < 20;
335 offs += sizeof(u32), image++) {
336 /* read data comes through single port, auto-incr addr */
337 val = iwl_read32(priv->trans, HBUS_TARG_MEM_RDAT);
338 if (val != le32_to_cpu(*image)) {
339 IWL_ERR(priv, "uCode INST section at "
340 "offset 0x%x, is 0x%x, s/b 0x%x\n",
341 offs, val, le32_to_cpu(*image));
342 errors++;
343 }
344 }
345}
346
347/**
348 * iwl_verify_ucode - determine which instruction image is in SRAM,
349 * and verify its contents
350 */
351static int iwl_verify_ucode(struct iwl_priv *priv,
352 enum iwl_ucode_type ucode_type)
353{
354 const struct fw_img *img = iwl_get_ucode_image(priv, ucode_type);
355
356 if (!img) {
357 IWL_ERR(priv, "Invalid ucode requested (%d)\n", ucode_type);
358 return -EINVAL;
359 }
360
361 if (!iwl_verify_sec_sparse(priv, &img->sec[IWL_UCODE_SECTION_INST])) {
362 IWL_DEBUG_FW(priv, "uCode is good in inst SRAM\n");
363 return 0;
364 }
365
366 IWL_ERR(priv, "UCODE IMAGE IN INSTRUCTION SRAM NOT VALID!!\n");
367
368 iwl_print_mismatch_sec(priv, &img->sec[IWL_UCODE_SECTION_INST]);
369 return -EIO;
370}
371
372struct iwl_alive_data { 289struct iwl_alive_data {
373 bool valid; 290 bool valid;
374 u8 subtype; 291 u8 subtype;
@@ -450,18 +367,7 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv,
450 return -EIO; 367 return -EIO;
451 } 368 }
452 369
453 /*
454 * This step takes a long time (60-80ms!!) and
455 * WoWLAN image should be loaded quickly, so
456 * skip it for WoWLAN.
457 */
458 if (ucode_type != IWL_UCODE_WOWLAN) { 370 if (ucode_type != IWL_UCODE_WOWLAN) {
459 ret = iwl_verify_ucode(priv, ucode_type);
460 if (ret) {
461 priv->cur_ucode = old_type;
462 return ret;
463 }
464
465 /* delay a bit to give rfkill time to run */ 371 /* delay a bit to give rfkill time to run */
466 msleep(5); 372 msleep(5);
467 } 373 }