wlcore/wl12xx: add quirk for legacy NVS support
authorLuciano Coelho <coelho@ti.com>
Wed, 30 Nov 2011 10:30:01 +0000 (12:30 +0200)
committerLuciano Coelho <coelho@ti.com>
Thu, 12 Apr 2012 05:43:57 +0000 (08:43 +0300)
Instead of checking the chip ID directly in the wlcore code to decide
whether to use the new or the old NVS format, we now use a quirk that
should be set by the low level driver to say that it needs to use the
old format.

Signed-off-by: Luciano Coelho <coelho@ti.com>
drivers/net/wireless/ti/wl12xx/main.c
drivers/net/wireless/ti/wlcore/boot.c
drivers/net/wireless/ti/wlcore/wlcore.h

index 8d82203d3da84a5a2e755c886d55ccf7ee9a2cf6..d24e49a0b82004a3c1ab035c57e9585e78dad75f 100644 (file)
@@ -151,7 +151,8 @@ static int wl12xx_identify_chip(struct wl1271 *wl)
                wl1271_warning("chip id 0x%x (1271 PG10) support is obsolete",
                               wl->chip.id);
 
-               wl->quirks |= WLCORE_QUIRK_NO_BLOCKSIZE_ALIGNMENT;
+               wl->quirks |= WLCORE_QUIRK_NO_BLOCKSIZE_ALIGNMENT |
+                       WLCORE_QUIRK_LEGACY_NVS;
                wl->plt_fw_name = WL127X_PLT_FW_NAME;
                wl->sr_fw_name = WL127X_FW_NAME_SINGLE;
                wl->mr_fw_name = WL127X_FW_NAME_MULTI;
@@ -161,7 +162,8 @@ static int wl12xx_identify_chip(struct wl1271 *wl)
                wl1271_debug(DEBUG_BOOT, "chip id 0x%x (1271 PG20)",
                             wl->chip.id);
 
-               wl->quirks |= WLCORE_QUIRK_NO_BLOCKSIZE_ALIGNMENT;
+               wl->quirks |= WLCORE_QUIRK_NO_BLOCKSIZE_ALIGNMENT |
+                       WLCORE_QUIRK_LEGACY_NVS;
                wl->plt_fw_name = WL127X_PLT_FW_NAME;
                wl->sr_fw_name = WL127X_FW_NAME_SINGLE;
                wl->mr_fw_name = WL127X_FW_NAME_MULTI;
index 7d49870982df38ed34135a6d246b9a10f2a720f5..9520073cab55fcdf8248a38ae7adc46a546a1d70 100644 (file)
@@ -215,27 +215,7 @@ int wlcore_boot_upload_nvs(struct wl1271 *wl)
        if (wl->nvs == NULL)
                return -ENODEV;
 
-       if (wl->chip.id == CHIP_ID_1283_PG20) {
-               struct wl128x_nvs_file *nvs = (struct wl128x_nvs_file *)wl->nvs;
-
-               if (wl->nvs_len == sizeof(struct wl128x_nvs_file)) {
-                       if (nvs->general_params.dual_mode_select)
-                               wl->enable_11a = true;
-               } else {
-                       wl1271_error("nvs size is not as expected: %zu != %zu",
-                                    wl->nvs_len,
-                                    sizeof(struct wl128x_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(nvs->nvs);
-               nvs_ptr = (u8 *)nvs->nvs;
-
-       } else {
+       if (wl->quirks & WLCORE_QUIRK_LEGACY_NVS) {
                struct wl1271_nvs_file *nvs =
                        (struct wl1271_nvs_file *)wl->nvs;
                /*
@@ -263,6 +243,25 @@ int wlcore_boot_upload_nvs(struct wl1271 *wl)
                /* only the first part of the NVS needs to be uploaded */
                nvs_len = sizeof(nvs->nvs);
                nvs_ptr = (u8 *) nvs->nvs;
+       } else {
+               struct wl128x_nvs_file *nvs = (struct wl128x_nvs_file *)wl->nvs;
+
+               if (wl->nvs_len == sizeof(struct wl128x_nvs_file)) {
+                       if (nvs->general_params.dual_mode_select)
+                               wl->enable_11a = true;
+               } else {
+                       wl1271_error("nvs size is not as expected: %zu != %zu",
+                                    wl->nvs_len,
+                                    sizeof(struct wl128x_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(nvs->nvs);
+               nvs_ptr = (u8 *)nvs->nvs;
        }
 
        /* update current MAC address to NVS */
index 76c27dd93c20806d20bbfece355573a2a13d822a..5f5dadbf909262ccbb4d922778aca13ea75bf4ad 100644 (file)
@@ -322,6 +322,9 @@ int wlcore_free_hw(struct wl1271 *wl);
 /* Older firmwares did not implement the FW logger over bus feature */
 #define WLCORE_QUIRK_FWLOG_NOT_IMPLEMENTED     BIT(4)
 
+/* Older firmwares use an old NVS format */
+#define WLCORE_QUIRK_LEGACY_NVS                        BIT(5)
+
 /* TODO: move to the lower drivers when all usages are abstracted */
 #define CHIP_ID_1271_PG10              (0x4030101)
 #define CHIP_ID_1271_PG20              (0x4030111)