aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ti
diff options
context:
space:
mode:
authorLuciano Coelho <coelho@ti.com>2011-11-30 05:30:01 -0500
committerLuciano Coelho <coelho@ti.com>2012-04-12 01:43:57 -0400
commitd203e59c4b56d56916a804ebeb04b0e6d92adf4c (patch)
treeebfbc24683a39b47d40d9262872a125a4cbcdf88 /drivers/net/wireless/ti
parentf16ff75872b04fa6c779367ae24146c8a1729f2e (diff)
wlcore/wl12xx: add quirk for legacy NVS support
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>
Diffstat (limited to 'drivers/net/wireless/ti')
-rw-r--r--drivers/net/wireless/ti/wl12xx/main.c6
-rw-r--r--drivers/net/wireless/ti/wlcore/boot.c41
-rw-r--r--drivers/net/wireless/ti/wlcore/wlcore.h3
3 files changed, 27 insertions, 23 deletions
diff --git a/drivers/net/wireless/ti/wl12xx/main.c b/drivers/net/wireless/ti/wl12xx/main.c
index 8d82203d3da8..d24e49a0b820 100644
--- a/drivers/net/wireless/ti/wl12xx/main.c
+++ b/drivers/net/wireless/ti/wl12xx/main.c
@@ -151,7 +151,8 @@ static int wl12xx_identify_chip(struct wl1271 *wl)
151 wl1271_warning("chip id 0x%x (1271 PG10) support is obsolete", 151 wl1271_warning("chip id 0x%x (1271 PG10) support is obsolete",
152 wl->chip.id); 152 wl->chip.id);
153 153
154 wl->quirks |= WLCORE_QUIRK_NO_BLOCKSIZE_ALIGNMENT; 154 wl->quirks |= WLCORE_QUIRK_NO_BLOCKSIZE_ALIGNMENT |
155 WLCORE_QUIRK_LEGACY_NVS;
155 wl->plt_fw_name = WL127X_PLT_FW_NAME; 156 wl->plt_fw_name = WL127X_PLT_FW_NAME;
156 wl->sr_fw_name = WL127X_FW_NAME_SINGLE; 157 wl->sr_fw_name = WL127X_FW_NAME_SINGLE;
157 wl->mr_fw_name = WL127X_FW_NAME_MULTI; 158 wl->mr_fw_name = WL127X_FW_NAME_MULTI;
@@ -161,7 +162,8 @@ static int wl12xx_identify_chip(struct wl1271 *wl)
161 wl1271_debug(DEBUG_BOOT, "chip id 0x%x (1271 PG20)", 162 wl1271_debug(DEBUG_BOOT, "chip id 0x%x (1271 PG20)",
162 wl->chip.id); 163 wl->chip.id);
163 164
164 wl->quirks |= WLCORE_QUIRK_NO_BLOCKSIZE_ALIGNMENT; 165 wl->quirks |= WLCORE_QUIRK_NO_BLOCKSIZE_ALIGNMENT |
166 WLCORE_QUIRK_LEGACY_NVS;
165 wl->plt_fw_name = WL127X_PLT_FW_NAME; 167 wl->plt_fw_name = WL127X_PLT_FW_NAME;
166 wl->sr_fw_name = WL127X_FW_NAME_SINGLE; 168 wl->sr_fw_name = WL127X_FW_NAME_SINGLE;
167 wl->mr_fw_name = WL127X_FW_NAME_MULTI; 169 wl->mr_fw_name = WL127X_FW_NAME_MULTI;
diff --git a/drivers/net/wireless/ti/wlcore/boot.c b/drivers/net/wireless/ti/wlcore/boot.c
index 7d49870982df..9520073cab55 100644
--- a/drivers/net/wireless/ti/wlcore/boot.c
+++ b/drivers/net/wireless/ti/wlcore/boot.c
@@ -215,27 +215,7 @@ int wlcore_boot_upload_nvs(struct wl1271 *wl)
215 if (wl->nvs == NULL) 215 if (wl->nvs == NULL)
216 return -ENODEV; 216 return -ENODEV;
217 217
218 if (wl->chip.id == CHIP_ID_1283_PG20) { 218 if (wl->quirks & WLCORE_QUIRK_LEGACY_NVS) {
219 struct wl128x_nvs_file *nvs = (struct wl128x_nvs_file *)wl->nvs;
220
221 if (wl->nvs_len == sizeof(struct wl128x_nvs_file)) {
222 if (nvs->general_params.dual_mode_select)
223 wl->enable_11a = true;
224 } else {
225 wl1271_error("nvs size is not as expected: %zu != %zu",
226 wl->nvs_len,
227 sizeof(struct wl128x_nvs_file));
228 kfree(wl->nvs);
229 wl->nvs = NULL;
230 wl->nvs_len = 0;
231 return -EILSEQ;
232 }
233
234 /* only the first part of the NVS needs to be uploaded */
235 nvs_len = sizeof(nvs->nvs);
236 nvs_ptr = (u8 *)nvs->nvs;
237
238 } else {
239 struct wl1271_nvs_file *nvs = 219 struct wl1271_nvs_file *nvs =
240 (struct wl1271_nvs_file *)wl->nvs; 220 (struct wl1271_nvs_file *)wl->nvs;
241 /* 221 /*
@@ -263,6 +243,25 @@ int wlcore_boot_upload_nvs(struct wl1271 *wl)
263 /* only the first part of the NVS needs to be uploaded */ 243 /* only the first part of the NVS needs to be uploaded */
264 nvs_len = sizeof(nvs->nvs); 244 nvs_len = sizeof(nvs->nvs);
265 nvs_ptr = (u8 *) nvs->nvs; 245 nvs_ptr = (u8 *) nvs->nvs;
246 } else {
247 struct wl128x_nvs_file *nvs = (struct wl128x_nvs_file *)wl->nvs;
248
249 if (wl->nvs_len == sizeof(struct wl128x_nvs_file)) {
250 if (nvs->general_params.dual_mode_select)
251 wl->enable_11a = true;
252 } else {
253 wl1271_error("nvs size is not as expected: %zu != %zu",
254 wl->nvs_len,
255 sizeof(struct wl128x_nvs_file));
256 kfree(wl->nvs);
257 wl->nvs = NULL;
258 wl->nvs_len = 0;
259 return -EILSEQ;
260 }
261
262 /* only the first part of the NVS needs to be uploaded */
263 nvs_len = sizeof(nvs->nvs);
264 nvs_ptr = (u8 *)nvs->nvs;
266 } 265 }
267 266
268 /* update current MAC address to NVS */ 267 /* update current MAC address to NVS */
diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h b/drivers/net/wireless/ti/wlcore/wlcore.h
index 76c27dd93c20..5f5dadbf9092 100644
--- a/drivers/net/wireless/ti/wlcore/wlcore.h
+++ b/drivers/net/wireless/ti/wlcore/wlcore.h
@@ -322,6 +322,9 @@ int wlcore_free_hw(struct wl1271 *wl);
322/* Older firmwares did not implement the FW logger over bus feature */ 322/* Older firmwares did not implement the FW logger over bus feature */
323#define WLCORE_QUIRK_FWLOG_NOT_IMPLEMENTED BIT(4) 323#define WLCORE_QUIRK_FWLOG_NOT_IMPLEMENTED BIT(4)
324 324
325/* Older firmwares use an old NVS format */
326#define WLCORE_QUIRK_LEGACY_NVS BIT(5)
327
325/* TODO: move to the lower drivers when all usages are abstracted */ 328/* TODO: move to the lower drivers when all usages are abstracted */
326#define CHIP_ID_1271_PG10 (0x4030101) 329#define CHIP_ID_1271_PG10 (0x4030101)
327#define CHIP_ID_1271_PG20 (0x4030111) 330#define CHIP_ID_1271_PG20 (0x4030111)