diff options
author | Juuso Oikarinen <juuso.oikarinen@nokia.com> | 2010-05-14 03:46:23 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-06-02 16:13:05 -0400 |
commit | a7da74fc88bff6f82f8255f2def49907f82f4c61 (patch) | |
tree | 6868dab7321f71feada845795a4a19434fb32ada /drivers/net/wireless/wl12xx | |
parent | eb70eb723b489dd4e233e22e47d993f59858cdd8 (diff) |
wl1271: Add support for NVS files with 5GHz band parameters
This patch adds support for NVS files with 5GHz band parameters. The change
is done in a backward compatible manner - if 11a is not enabled in the driver,
the driver will allow also old NVS files to be loaded.
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>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx')
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_cmd.c | 9 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_ini.h | 11 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_main.c | 13 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_testmode.c | 11 |
4 files changed, 35 insertions, 9 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c index 241b47781865..d7bcce887c41 100644 --- a/drivers/net/wireless/wl12xx/wl1271_cmd.c +++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c | |||
@@ -238,13 +238,20 @@ int wl1271_cmd_radio_parms(struct wl1271 *wl) | |||
238 | 238 | ||
239 | radio_parms->test.id = TEST_CMD_INI_FILE_RADIO_PARAM; | 239 | radio_parms->test.id = TEST_CMD_INI_FILE_RADIO_PARAM; |
240 | 240 | ||
241 | /* 2.4GHz parameters */ | ||
241 | memcpy(&radio_parms->static_params_2, &wl->nvs->stat_radio_params_2, | 242 | memcpy(&radio_parms->static_params_2, &wl->nvs->stat_radio_params_2, |
242 | sizeof(struct wl1271_ini_band_params_2)); | 243 | sizeof(struct wl1271_ini_band_params_2)); |
243 | memcpy(&radio_parms->dyn_params_2, | 244 | memcpy(&radio_parms->dyn_params_2, |
244 | &wl->nvs->dyn_radio_params_2[rparam->fem].params, | 245 | &wl->nvs->dyn_radio_params_2[rparam->fem].params, |
245 | sizeof(struct wl1271_ini_fem_params_2)); | 246 | sizeof(struct wl1271_ini_fem_params_2)); |
246 | 247 | ||
247 | /* FIXME: current NVS is missing 5GHz parameters */ | 248 | /* 5GHz parameters */ |
249 | memcpy(&radio_parms->static_params_5, | ||
250 | &wl->nvs->stat_radio_params_5, | ||
251 | sizeof(struct wl1271_ini_band_params_5)); | ||
252 | memcpy(&radio_parms->dyn_params_5, | ||
253 | &wl->nvs->dyn_radio_params_5[rparam->fem].params, | ||
254 | sizeof(struct wl1271_ini_fem_params_5)); | ||
248 | 255 | ||
249 | wl1271_dump(DEBUG_CMD, "TEST_CMD_INI_FILE_RADIO_PARAM: ", | 256 | wl1271_dump(DEBUG_CMD, "TEST_CMD_INI_FILE_RADIO_PARAM: ", |
250 | radio_parms, sizeof(*radio_parms)); | 257 | radio_parms, sizeof(*radio_parms)); |
diff --git a/drivers/net/wireless/wl12xx/wl1271_ini.h b/drivers/net/wireless/wl12xx/wl1271_ini.h index d1590bc1bf83..0fb156a5af12 100644 --- a/drivers/net/wireless/wl12xx/wl1271_ini.h +++ b/drivers/net/wireless/wl12xx/wl1271_ini.h | |||
@@ -95,9 +95,10 @@ struct wl1271_ini_fem_params_5 { | |||
95 | 95 | ||
96 | /* NVS data structure */ | 96 | /* NVS data structure */ |
97 | #define WL1271_INI_NVS_SECTION_SIZE 468 | 97 | #define WL1271_INI_NVS_SECTION_SIZE 468 |
98 | #define WL1271_INI_SPARE_SIZE 124 | ||
99 | #define WL1271_INI_FEM_MODULE_COUNT 2 | 98 | #define WL1271_INI_FEM_MODULE_COUNT 2 |
100 | 99 | ||
100 | #define WL1271_INI_LEGACY_NVS_FILE_SIZE 800 | ||
101 | |||
101 | struct wl1271_nvs_file { | 102 | struct wl1271_nvs_file { |
102 | /* NVS section */ | 103 | /* NVS section */ |
103 | u8 nvs[WL1271_INI_NVS_SECTION_SIZE]; | 104 | u8 nvs[WL1271_INI_NVS_SECTION_SIZE]; |
@@ -111,8 +112,12 @@ struct wl1271_nvs_file { | |||
111 | struct wl1271_ini_fem_params_2 params; | 112 | struct wl1271_ini_fem_params_2 params; |
112 | u8 padding; | 113 | u8 padding; |
113 | } dyn_radio_params_2[WL1271_INI_FEM_MODULE_COUNT]; | 114 | } dyn_radio_params_2[WL1271_INI_FEM_MODULE_COUNT]; |
114 | 115 | struct wl1271_ini_band_params_5 stat_radio_params_5; | |
115 | u8 ini_spare[WL1271_INI_SPARE_SIZE]; | 116 | u8 padding3; |
117 | struct { | ||
118 | struct wl1271_ini_fem_params_5 params; | ||
119 | u8 padding; | ||
120 | } dyn_radio_params_5[WL1271_INI_FEM_MODULE_COUNT]; | ||
116 | } __attribute__ ((packed)); | 121 | } __attribute__ ((packed)); |
117 | 122 | ||
118 | #endif | 123 | #endif |
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c index b7d9137851ac..5568f559a16b 100644 --- a/drivers/net/wireless/wl12xx/wl1271_main.c +++ b/drivers/net/wireless/wl12xx/wl1271_main.c | |||
@@ -566,14 +566,21 @@ static int wl1271_fetch_nvs(struct wl1271 *wl) | |||
566 | return ret; | 566 | return ret; |
567 | } | 567 | } |
568 | 568 | ||
569 | if (fw->size != sizeof(struct wl1271_nvs_file)) { | 569 | /* |
570 | * FIXME: the LEGACY NVS image support (NVS's missing the 5GHz band | ||
571 | * configurations) can be removed when those NVS files stop floating | ||
572 | * around. | ||
573 | */ | ||
574 | if (fw->size != sizeof(struct wl1271_nvs_file) && | ||
575 | (fw->size != WL1271_INI_LEGACY_NVS_FILE_SIZE || | ||
576 | wl1271_11a_enabled())) { | ||
570 | wl1271_error("nvs size is not as expected: %zu != %zu", | 577 | wl1271_error("nvs size is not as expected: %zu != %zu", |
571 | fw->size, sizeof(struct wl1271_nvs_file)); | 578 | fw->size, sizeof(struct wl1271_nvs_file)); |
572 | ret = -EILSEQ; | 579 | ret = -EILSEQ; |
573 | goto out; | 580 | goto out; |
574 | } | 581 | } |
575 | 582 | ||
576 | wl->nvs = kmalloc(sizeof(struct wl1271_nvs_file), GFP_KERNEL); | 583 | wl->nvs = kzalloc(sizeof(struct wl1271_nvs_file), GFP_KERNEL); |
577 | 584 | ||
578 | if (!wl->nvs) { | 585 | if (!wl->nvs) { |
579 | wl1271_error("could not allocate memory for the nvs file"); | 586 | wl1271_error("could not allocate memory for the nvs file"); |
@@ -581,7 +588,7 @@ static int wl1271_fetch_nvs(struct wl1271 *wl) | |||
581 | goto out; | 588 | goto out; |
582 | } | 589 | } |
583 | 590 | ||
584 | memcpy(wl->nvs, fw->data, sizeof(struct wl1271_nvs_file)); | 591 | memcpy(wl->nvs, fw->data, fw->size); |
585 | 592 | ||
586 | out: | 593 | out: |
587 | release_firmware(fw); | 594 | release_firmware(fw); |
diff --git a/drivers/net/wireless/wl12xx/wl1271_testmode.c b/drivers/net/wireless/wl12xx/wl1271_testmode.c index 554deb4d024e..6e0952f79e9a 100644 --- a/drivers/net/wireless/wl12xx/wl1271_testmode.c +++ b/drivers/net/wireless/wl12xx/wl1271_testmode.c | |||
@@ -199,7 +199,14 @@ 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 | if (len != sizeof(struct wl1271_nvs_file)) { | 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())) { | ||
203 | wl1271_error("nvs size is not as expected: %zu != %zu", | 210 | wl1271_error("nvs size is not as expected: %zu != %zu", |
204 | len, sizeof(struct wl1271_nvs_file)); | 211 | len, sizeof(struct wl1271_nvs_file)); |
205 | return -EMSGSIZE; | 212 | return -EMSGSIZE; |
@@ -209,7 +216,7 @@ static int wl1271_tm_cmd_nvs_push(struct wl1271 *wl, struct nlattr *tb[]) | |||
209 | 216 | ||
210 | kfree(wl->nvs); | 217 | kfree(wl->nvs); |
211 | 218 | ||
212 | wl->nvs = kmalloc(sizeof(struct wl1271_nvs_file), GFP_KERNEL); | 219 | wl->nvs = kzalloc(sizeof(struct wl1271_nvs_file), GFP_KERNEL); |
213 | if (!wl->nvs) { | 220 | if (!wl->nvs) { |
214 | wl1271_error("could not allocate memory for the nvs file"); | 221 | wl1271_error("could not allocate memory for the nvs file"); |
215 | ret = -ENOMEM; | 222 | ret = -ENOMEM; |