linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luciano Coelho <luciano.coelho@nokia.com>
To: linux-wireless@vger.kernel.org
Cc: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Subject: [PATCH 13/25] wl1271: Enable/disable 11a support based on INI configuration
Date: Mon, 27 Sep 2010 11:37:37 +0300	[thread overview]
Message-ID: <1285576669-8070-14-git-send-email-luciano.coelho@nokia.com> (raw)
In-Reply-To: <1285576669-8070-1-git-send-email-luciano.coelho@nokia.com>

From: Juuso Oikarinen <juuso.oikarinen@nokia.com>

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>
---
 drivers/net/wireless/wl12xx/wl1271.h          |   18 +++---------------
 drivers/net/wireless/wl12xx/wl1271_boot.c     |   22 ++++++++++++++++++++++
 drivers/net/wireless/wl12xx/wl1271_init.c     |    2 +-
 drivers/net/wireless/wl12xx/wl1271_main.c     |   18 +++---------------
 drivers/net/wireless/wl12xx/wl1271_scan.c     |    2 +-
 drivers/net/wireless/wl12xx/wl1271_testmode.c |   14 +-------------
 6 files changed, 31 insertions(+), 45 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index 1098d16..763ece8 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -117,11 +117,6 @@ enum {
 #define WL1271_TX_SECURITY_LO16(s) ((u16)((s) & 0xffff))
 #define WL1271_TX_SECURITY_HI32(s) ((u32)(((s) >> 16) & 0xffffffff))
 
-/*
- * Enable/disable 802.11a support for WL1273
- */
-#undef WL1271_80211A_ENABLED
-
 #define WL1271_BUSY_WORD_CNT 1
 #define WL1271_BUSY_WORD_LEN (WL1271_BUSY_WORD_CNT * sizeof(u32))
 
@@ -363,6 +358,7 @@ struct wl1271 {
 	u8 *fw;
 	size_t fw_len;
 	struct wl1271_nvs_file *nvs;
+	size_t nvs_len;
 
 	s8 hw_pg_ver;
 
@@ -476,6 +472,8 @@ struct wl1271 {
 
 	bool sg_enabled;
 
+	bool enable_11a;
+
 	struct list_head list;
 
 	/* Most recently reported noise in dBm */
@@ -499,14 +497,4 @@ int wl1271_plt_stop(struct wl1271 *wl);
 #define WL1271_PRE_POWER_ON_SLEEP 20 /* in miliseconds */
 #define WL1271_POWER_ON_SLEEP 200 /* in miliseconds */
 
-static inline bool wl1271_11a_enabled(void)
-{
-	/* FIXME: this could be determined based on the NVS-INI file */
-#ifdef WL1271_80211A_ENABLED
-	return true;
-#else
-	return false;
-#endif
-}
-
 #endif
diff --git a/drivers/net/wireless/wl12xx/wl1271_boot.c b/drivers/net/wireless/wl12xx/wl1271_boot.c
index f750d5a..b910212 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)
 	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;
diff --git a/drivers/net/wireless/wl12xx/wl1271_init.c b/drivers/net/wireless/wl12xx/wl1271_init.c
index 4447af1..879bae0 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)
 	if (ret < 0)
 		return ret;
 
-	if (wl1271_11a_enabled()) {
+	if (wl->enable_11a) {
 		size_t size = sizeof(struct wl12xx_probe_req_template);
 		ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_5,
 					      NULL, size, 0,
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index bbd075a..11e112f 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)
 		return ret;
 	}
 
-	/*
-	 * FIXME: the LEGACY NVS image support (NVS's missing the 5GHz band
-	 * configurations) can be removed when those NVS files stop floating
-	 * around.
-	 */
-	if (fw->size != sizeof(struct wl1271_nvs_file) &&
-	    (fw->size != WL1271_INI_LEGACY_NVS_FILE_SIZE ||
-	     wl1271_11a_enabled())) {
-		wl1271_error("nvs size is not as expected: %zu != %zu",
-			     fw->size, sizeof(struct wl1271_nvs_file));
-		ret = -EILSEQ;
-		goto out;
-	}
-
 	wl->nvs = kmemdup(fw->data, sizeof(struct wl1271_nvs_file), GFP_KERNEL);
 
 	if (!wl->nvs) {
@@ -644,6 +630,8 @@ static int wl1271_fetch_nvs(struct wl1271 *wl)
 		goto out;
 	}
 
+	wl->nvs_len = fw->size;
+
 out:
 	release_firmware(fw);
 
@@ -2414,7 +2402,7 @@ int wl1271_init_ieee80211(struct wl1271 *wl)
 	wl->hw->wiphy->max_scan_ssids = 1;
 	wl->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &wl1271_band_2ghz;
 
-	if (wl1271_11a_enabled())
+	if (wl->enable_11a)
 		wl->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = &wl1271_band_5ghz;
 
 	wl->hw->queues = 4;
diff --git a/drivers/net/wireless/wl12xx/wl1271_scan.c b/drivers/net/wireless/wl12xx/wl1271_scan.c
index 7f42ca9..8d30150 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)
 		ret = wl1271_scan_send(wl, IEEE80211_BAND_2GHZ, true,
 				       wl->conf.tx.basic_rate);
 		if (ret == WL1271_NOTHING_TO_SCAN) {
-			if (wl1271_11a_enabled())
+			if (wl->enable_11a)
 				wl->scan.state = WL1271_SCAN_STATE_5GHZ_ACTIVE;
 			else
 				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 6e0952f..a3aa843 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[])
 	buf = nla_data(tb[WL1271_TM_ATTR_DATA]);
 	len = nla_len(tb[WL1271_TM_ATTR_DATA]);
 
-	/*
-	 * FIXME: the LEGACY NVS image support (NVS's missing the 5GHz band
-	 * configurations) can be removed when those NVS files stop floating
-	 * around.
-	 */
-	if (len != sizeof(struct wl1271_nvs_file) &&
-	    (len != WL1271_INI_LEGACY_NVS_FILE_SIZE ||
-	     wl1271_11a_enabled())) {
-		wl1271_error("nvs size is not as expected: %zu != %zu",
-			     len, sizeof(struct wl1271_nvs_file));
-		return -EMSGSIZE;
-	}
-
 	mutex_lock(&wl->mutex);
 
 	kfree(wl->nvs);
@@ -224,6 +211,7 @@ static int wl1271_tm_cmd_nvs_push(struct wl1271 *wl, struct nlattr *tb[])
 	}
 
 	memcpy(wl->nvs, buf, len);
+	wl->nvs_len = len;
 
 	wl1271_debug(DEBUG_TESTMODE, "testmode pushed nvs");
 
-- 
1.6.3.3


  parent reply	other threads:[~2010-09-27  8:38 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-27  8:37 [PATCH 00/25] wl1271: pending patches Luciano Coelho
2010-09-27  8:37 ` [PATCH 01/25] wl1271: remove deprecated ACX definition Luciano Coelho
2010-09-27  8:37 ` [PATCH 02/25] wl1271: Implement CMD_SET_STA_STATE to indicate connection completion to FW Luciano Coelho
2010-09-27  8:37 ` [PATCH 03/25] wl1271: Add trigger to net_device oper_state to change BT coex priority Luciano Coelho
2010-09-27  8:37 ` [PATCH 04/25] wl1271: Fix scan race condition Luciano Coelho
2010-09-27  8:37 ` [PATCH 05/25] wl1271: remove useless 11a check when scanning Luciano Coelho
2010-09-27  8:37 ` [PATCH 06/25] wl1271: fix forced passive scan Luciano Coelho
2010-09-27  8:37 ` [PATCH 07/25] wl1271: Change supported channel order for a more optimal scan Luciano Coelho
2010-09-27  8:48   ` Johannes Berg
2010-09-27 10:50     ` Luciano Coelho
2010-09-27  8:37 ` [PATCH 08/25] wl1271: Remove outdated FIXME's Luciano Coelho
2010-09-27  8:37 ` [PATCH 09/25] wl1271: Move setting of wake-up conditions to ps.c from cmd.c Luciano Coelho
2010-09-27  8:37 ` [PATCH 10/25] wl1271: Remove acx_fw_version function Luciano Coelho
2010-09-27  8:37 ` [PATCH 11/25] wl1271: Release interrupt *after* releasing the driver context Luciano Coelho
2010-09-27  8:37 ` [PATCH 12/25] wl1271: Remove function cmd_read_memory Luciano Coelho
2010-09-27  8:37 ` Luciano Coelho [this message]
2010-10-06  5:26   ` [PATCH 13/25] wl1271: Enable/disable 11a support based on INI configuration Gabay, Benzy
2010-10-06  5:36     ` Juuso Oikarinen
2010-10-06  6:19       ` Gabay, Benzy
2010-09-27  8:37 ` [PATCH 14/25] wl1271: Reduce rate used for last PSM entry attempt Luciano Coelho
2010-09-27  8:37 ` [PATCH 15/25] wl1271: Enable 11a support always, prevent scanning for unsupporting chips Luciano Coelho
2010-09-27  8:37 ` [PATCH 16/25] wl1271: Add support for hardware GEM cipher Luciano Coelho
2010-09-27  9:12   ` Johannes Berg
2010-09-27  9:46     ` Juuso Oikarinen
2010-09-27  9:49       ` Johannes Berg
2010-09-27  9:58         ` Juuso Oikarinen
2010-09-27 10:01           ` Luciano Coelho
2010-09-27 10:42             ` [PATCHv2] " juuso.oikarinen
2010-09-27  8:37 ` [PATCH 17/25] wl1271: Fix tid-configuration of TX frames Luciano Coelho
2010-09-27  8:51   ` Johannes Berg
2010-09-27  8:57     ` Juuso Oikarinen
2010-09-27  8:37 ` [PATCH 18/25] wl1271: Fix AC/TID default configuration Luciano Coelho
2010-09-27  8:37 ` [PATCH 19/25] wl1271: Move scan complete invocation into work function Luciano Coelho
2010-09-27  8:37 ` [PATCH 20/25] wl1271: Fix work cancelling when shutting down the driver Luciano Coelho
2010-09-27  8:37 ` [PATCH 21/25] wl1271: Separate interface removal to another function Luciano Coelho
2010-09-27  8:37 ` [PATCH 22/25] wl1271: Add hardware recovery mechanism Luciano Coelho
2010-09-27  8:37 ` [PATCH 23/25] wl1271: Add handling for failing hardware scan command Luciano Coelho
2010-09-27  8:37 ` [PATCH 24/25] wl1271: Optimize scan duration Luciano Coelho
2010-10-05  5:30   ` Gabay, Benzy
2010-10-05  5:40     ` Juuso Oikarinen
2010-10-05 15:42       ` Gabay, Benzy
2010-10-06  4:59         ` Juuso Oikarinen
2010-10-06  5:21           ` Gabay, Benzy
2010-10-06  5:26             ` Juuso Oikarinen
2010-10-06  5:50               ` Gabay, Benzy
2010-09-27  8:37 ` [PATCH 25/25] wl1271: Increase connection reliability Luciano Coelho

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1285576669-8070-14-git-send-email-luciano.coelho@nokia.com \
    --to=luciano.coelho@nokia.com \
    --cc=juuso.oikarinen@nokia.com \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).