Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 02fabb0e authored by Juuso Oikarinen's avatar Juuso Oikarinen Committed by Luciano Coelho
Browse files

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: default avatarJuuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: default avatarLuciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: default avatarLuciano Coelho <luciano.coelho@nokia.com>
parent 18c311b7
Loading
Loading
Loading
Loading
+3 −15
Original line number Diff line number Diff line
@@ -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
+22 −0
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -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,
+3 −15
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -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;
Loading