Merge branch 'ima-memory-use-fixes'
[pandora-kernel.git] / drivers / net / wireless / wl12xx / wl1271_boot.c
index e5a7f04..b910212 100644 (file)
@@ -225,6 +225,28 @@ static int wl1271_boot_upload_nvs(struct wl1271 *wl)
        if (wl->nvs == NULL)
                return -ENODEV;
 
+       /*
+        * FIXME: the LEGACY NVS image support (NVS's missing the 5GHz band
+        * configurations) can be removed when those NVS files stop floating
+        * around.
+        */
+       if (wl->nvs_len == sizeof(struct wl1271_nvs_file) ||
+           wl->nvs_len == WL1271_INI_LEGACY_NVS_FILE_SIZE) {
+               if (wl->nvs->general_params.dual_mode_select)
+                       wl->enable_11a = true;
+       }
+
+       if (wl->nvs_len != sizeof(struct wl1271_nvs_file) &&
+           (wl->nvs_len != WL1271_INI_LEGACY_NVS_FILE_SIZE ||
+            wl->enable_11a)) {
+               wl1271_error("nvs size is not as expected: %zu != %zu",
+                            wl->nvs_len, sizeof(struct wl1271_nvs_file));
+               kfree(wl->nvs);
+               wl->nvs = NULL;
+               wl->nvs_len = 0;
+               return -EILSEQ;
+       }
+
        /* only the first part of the NVS needs to be uploaded */
        nvs_len = sizeof(wl->nvs->nvs);
        nvs_ptr = (u8 *)wl->nvs->nvs;
@@ -251,8 +273,10 @@ static int wl1271_boot_upload_nvs(struct wl1271 *wl)
                burst_len = nvs_ptr[0];
                dest_addr = (nvs_ptr[1] & 0xfe) | ((u32)(nvs_ptr[2] << 8));
 
-               /* FIXME: Due to our new wl1271_translate_reg_addr function,
-                  we need to add the REGISTER_BASE to the destination */
+               /*
+                * Due to our new wl1271_translate_reg_addr function,
+                * we need to add the REGISTER_BASE to the destination
+                */
                dest_addr += REGISTERS_BASE;
 
                /* We move our pointer to the data */
@@ -280,8 +304,6 @@ static int wl1271_boot_upload_nvs(struct wl1271 *wl)
                        ALIGN(nvs_ptr - (u8 *)wl->nvs->nvs + 7, 4);
        nvs_len -= nvs_ptr - (u8 *)wl->nvs->nvs;
 
-       /* FIXME: The driver sets the partition here, but this is not needed,
-          since it sets to the same one as currently in use */
        /* Now we must set the partition correctly */
        wl1271_set_partition(wl, &part_table[PART_WORK]);
 
@@ -291,9 +313,6 @@ static int wl1271_boot_upload_nvs(struct wl1271 *wl)
                return -ENOMEM;
 
        /* And finally we upload the NVS tables */
-       /* FIXME: In wl1271, we upload everything at once.
-          No endianness handling needed here?! The ref driver doesn't do
-          anything about it at this point */
        wl1271_write(wl, CMD_MBOX_ADDRESS, nvs_aligned, nvs_len, false);
 
        kfree(nvs_aligned);
@@ -491,10 +510,7 @@ int wl1271_boot(struct wl1271 *wl)
 
        wl1271_debug(DEBUG_BOOT, "pause1 0x%x", pause);
 
-       pause &= ~(WU_COUNTER_PAUSE_VAL); /* FIXME: This should probably be
-                                          * WU_COUNTER_PAUSE_VAL instead of
-                                          * 0x3ff (magic number ).  How does
-                                          * this work?! */
+       pause &= ~(WU_COUNTER_PAUSE_VAL);
        pause |= WU_COUNTER_PAUSE_VAL;
        wl1271_write32(wl, WU_COUNTER_PAUSE, pause);
 
@@ -548,7 +564,6 @@ int wl1271_boot(struct wl1271 *wl)
        if (ret < 0)
                goto out;
 
-       /* FIXME: Need to check whether this is really what we want */
        wl1271_write32(wl, ACX_REG_INTERRUPT_MASK,
                       WL1271_ACX_ALL_EVENTS_VECTOR);