aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorJuuso Oikarinen <juuso.oikarinen@nokia.com>2010-08-18 22:41:15 -0400
committerLuciano Coelho <luciano.coelho@nokia.com>2010-09-28 05:15:10 -0400
commit02fabb0eafde901ae51532ad15fdd4737b7d71e3 (patch)
treea9fc503d1618bb15dcefdf7df559bc4e1490f171 /drivers/net
parent18c311b71899803de91f1ed41b9d87eb81017a91 (diff)
wl1271: Enable/disable 11a support based on INI configuration
Instead of hardcoding 11a support, enable/disable driver support based on the dual-mode-select parameter in the nvs-file general paramters. Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com> Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com> Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/wl12xx/wl1271.h18
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_boot.c22
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_init.c2
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_main.c18
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_scan.c2
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_testmode.c14
6 files changed, 31 insertions, 45 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index 1098d1689b0e..763ece823c54 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -117,11 +117,6 @@ enum {
117#define WL1271_TX_SECURITY_LO16(s) ((u16)((s) & 0xffff)) 117#define WL1271_TX_SECURITY_LO16(s) ((u16)((s) & 0xffff))
118#define WL1271_TX_SECURITY_HI32(s) ((u32)(((s) >> 16) & 0xffffffff)) 118#define WL1271_TX_SECURITY_HI32(s) ((u32)(((s) >> 16) & 0xffffffff))
119 119
120/*
121 * Enable/disable 802.11a support for WL1273
122 */
123#undef WL1271_80211A_ENABLED
124
125#define WL1271_BUSY_WORD_CNT 1 120#define WL1271_BUSY_WORD_CNT 1
126#define WL1271_BUSY_WORD_LEN (WL1271_BUSY_WORD_CNT * sizeof(u32)) 121#define WL1271_BUSY_WORD_LEN (WL1271_BUSY_WORD_CNT * sizeof(u32))
127 122
@@ -363,6 +358,7 @@ struct wl1271 {
363 u8 *fw; 358 u8 *fw;
364 size_t fw_len; 359 size_t fw_len;
365 struct wl1271_nvs_file *nvs; 360 struct wl1271_nvs_file *nvs;
361 size_t nvs_len;
366 362
367 s8 hw_pg_ver; 363 s8 hw_pg_ver;
368 364
@@ -476,6 +472,8 @@ struct wl1271 {
476 472
477 bool sg_enabled; 473 bool sg_enabled;
478 474
475 bool enable_11a;
476
479 struct list_head list; 477 struct list_head list;
480 478
481 /* Most recently reported noise in dBm */ 479 /* Most recently reported noise in dBm */
@@ -499,14 +497,4 @@ int wl1271_plt_stop(struct wl1271 *wl);
499#define WL1271_PRE_POWER_ON_SLEEP 20 /* in miliseconds */ 497#define WL1271_PRE_POWER_ON_SLEEP 20 /* in miliseconds */
500#define WL1271_POWER_ON_SLEEP 200 /* in miliseconds */ 498#define WL1271_POWER_ON_SLEEP 200 /* in miliseconds */
501 499
502static inline bool wl1271_11a_enabled(void)
503{
504 /* FIXME: this could be determined based on the NVS-INI file */
505#ifdef WL1271_80211A_ENABLED
506 return true;
507#else
508 return false;
509#endif
510}
511
512#endif 500#endif
diff --git a/drivers/net/wireless/wl12xx/wl1271_boot.c b/drivers/net/wireless/wl12xx/wl1271_boot.c
index f750d5a79089..b91021242098 100644
--- a/drivers/net/wireless/wl12xx/wl1271_boot.c
+++ b/drivers/net/wireless/wl12xx/wl1271_boot.c
@@ -225,6 +225,28 @@ static int wl1271_boot_upload_nvs(struct wl1271 *wl)
225 if (wl->nvs == NULL) 225 if (wl->nvs == NULL)
226 return -ENODEV; 226 return -ENODEV;
227 227
228 /*
229 * FIXME: the LEGACY NVS image support (NVS's missing the 5GHz band
230 * configurations) can be removed when those NVS files stop floating
231 * around.
232 */
233 if (wl->nvs_len == sizeof(struct wl1271_nvs_file) ||
234 wl->nvs_len == WL1271_INI_LEGACY_NVS_FILE_SIZE) {
235 if (wl->nvs->general_params.dual_mode_select)
236 wl->enable_11a = true;
237 }
238
239 if (wl->nvs_len != sizeof(struct wl1271_nvs_file) &&
240 (wl->nvs_len != WL1271_INI_LEGACY_NVS_FILE_SIZE ||
241 wl->enable_11a)) {
242 wl1271_error("nvs size is not as expected: %zu != %zu",
243 wl->nvs_len, sizeof(struct wl1271_nvs_file));
244 kfree(wl->nvs);
245 wl->nvs = NULL;
246 wl->nvs_len = 0;
247 return -EILSEQ;
248 }
249
228 /* only the first part of the NVS needs to be uploaded */ 250 /* only the first part of the NVS needs to be uploaded */
229 nvs_len = sizeof(wl->nvs->nvs); 251 nvs_len = sizeof(wl->nvs->nvs);
230 nvs_ptr = (u8 *)wl->nvs->nvs; 252 nvs_ptr = (u8 *)wl->nvs->nvs;
diff --git a/drivers/net/wireless/wl12xx/wl1271_init.c b/drivers/net/wireless/wl12xx/wl1271_init.c
index 4447af1557f5..879bae095a63 100644
--- a/drivers/net/wireless/wl12xx/wl1271_init.c
+++ b/drivers/net/wireless/wl12xx/wl1271_init.c
@@ -61,7 +61,7 @@ int wl1271_init_templates_config(struct wl1271 *wl)
61 if (ret < 0) 61 if (ret < 0)
62 return ret; 62 return ret;
63 63
64 if (wl1271_11a_enabled()) { 64 if (wl->enable_11a) {
65 size_t size = sizeof(struct wl12xx_probe_req_template); 65 size_t size = sizeof(struct wl12xx_probe_req_template);
66 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_5, 66 ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_5,
67 NULL, size, 0, 67 NULL, size, 0,
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index bbd075a88f2d..11e112ff79d6 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -622,20 +622,6 @@ static int wl1271_fetch_nvs(struct wl1271 *wl)
622 return ret; 622 return ret;
623 } 623 }
624 624
625 /*
626 * FIXME: the LEGACY NVS image support (NVS's missing the 5GHz band
627 * configurations) can be removed when those NVS files stop floating
628 * around.
629 */
630 if (fw->size != sizeof(struct wl1271_nvs_file) &&
631 (fw->size != WL1271_INI_LEGACY_NVS_FILE_SIZE ||
632 wl1271_11a_enabled())) {
633 wl1271_error("nvs size is not as expected: %zu != %zu",
634 fw->size, sizeof(struct wl1271_nvs_file));
635 ret = -EILSEQ;
636 goto out;
637 }
638
639 wl->nvs = kmemdup(fw->data, sizeof(struct wl1271_nvs_file), GFP_KERNEL); 625 wl->nvs = kmemdup(fw->data, sizeof(struct wl1271_nvs_file), GFP_KERNEL);
640 626
641 if (!wl->nvs) { 627 if (!wl->nvs) {
@@ -644,6 +630,8 @@ static int wl1271_fetch_nvs(struct wl1271 *wl)
644 goto out; 630 goto out;
645 } 631 }
646 632
633 wl->nvs_len = fw->size;
634
647out: 635out:
648 release_firmware(fw); 636 release_firmware(fw);
649 637
@@ -2414,7 +2402,7 @@ int wl1271_init_ieee80211(struct wl1271 *wl)
2414 wl->hw->wiphy->max_scan_ssids = 1; 2402 wl->hw->wiphy->max_scan_ssids = 1;
2415 wl->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &wl1271_band_2ghz; 2403 wl->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &wl1271_band_2ghz;
2416 2404
2417 if (wl1271_11a_enabled()) 2405 if (wl->enable_11a)
2418 wl->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = &wl1271_band_5ghz; 2406 wl->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = &wl1271_band_5ghz;
2419 2407
2420 wl->hw->queues = 4; 2408 wl->hw->queues = 4;
diff --git a/drivers/net/wireless/wl12xx/wl1271_scan.c b/drivers/net/wireless/wl12xx/wl1271_scan.c
index 7f42ca9abab8..8d30150f3f46 100644
--- a/drivers/net/wireless/wl12xx/wl1271_scan.c
+++ b/drivers/net/wireless/wl12xx/wl1271_scan.c
@@ -188,7 +188,7 @@ void wl1271_scan_stm(struct wl1271 *wl)
188 ret = wl1271_scan_send(wl, IEEE80211_BAND_2GHZ, true, 188 ret = wl1271_scan_send(wl, IEEE80211_BAND_2GHZ, true,
189 wl->conf.tx.basic_rate); 189 wl->conf.tx.basic_rate);
190 if (ret == WL1271_NOTHING_TO_SCAN) { 190 if (ret == WL1271_NOTHING_TO_SCAN) {
191 if (wl1271_11a_enabled()) 191 if (wl->enable_11a)
192 wl->scan.state = WL1271_SCAN_STATE_5GHZ_ACTIVE; 192 wl->scan.state = WL1271_SCAN_STATE_5GHZ_ACTIVE;
193 else 193 else
194 wl->scan.state = WL1271_SCAN_STATE_DONE; 194 wl->scan.state = WL1271_SCAN_STATE_DONE;
diff --git a/drivers/net/wireless/wl12xx/wl1271_testmode.c b/drivers/net/wireless/wl12xx/wl1271_testmode.c
index 6e0952f79e9a..a3aa84386c88 100644
--- a/drivers/net/wireless/wl12xx/wl1271_testmode.c
+++ b/drivers/net/wireless/wl12xx/wl1271_testmode.c
@@ -199,19 +199,6 @@ static int wl1271_tm_cmd_nvs_push(struct wl1271 *wl, struct nlattr *tb[])
199 buf = nla_data(tb[WL1271_TM_ATTR_DATA]); 199 buf = nla_data(tb[WL1271_TM_ATTR_DATA]);
200 len = nla_len(tb[WL1271_TM_ATTR_DATA]); 200 len = nla_len(tb[WL1271_TM_ATTR_DATA]);
201 201
202 /*
203 * FIXME: the LEGACY NVS image support (NVS's missing the 5GHz band
204 * configurations) can be removed when those NVS files stop floating
205 * around.
206 */
207 if (len != sizeof(struct wl1271_nvs_file) &&
208 (len != WL1271_INI_LEGACY_NVS_FILE_SIZE ||
209 wl1271_11a_enabled())) {
210 wl1271_error("nvs size is not as expected: %zu != %zu",
211 len, sizeof(struct wl1271_nvs_file));
212 return -EMSGSIZE;
213 }
214
215 mutex_lock(&wl->mutex); 202 mutex_lock(&wl->mutex);
216 203
217 kfree(wl->nvs); 204 kfree(wl->nvs);
@@ -224,6 +211,7 @@ static int wl1271_tm_cmd_nvs_push(struct wl1271 *wl, struct nlattr *tb[])
224 } 211 }
225 212
226 memcpy(wl->nvs, buf, len); 213 memcpy(wl->nvs, buf, len);
214 wl->nvs_len = len;
227 215
228 wl1271_debug(DEBUG_TESTMODE, "testmode pushed nvs"); 216 wl1271_debug(DEBUG_TESTMODE, "testmode pushed nvs");
229 217