diff options
author | Juuso Oikarinen <juuso.oikarinen@nokia.com> | 2010-02-18 06:25:42 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-02-19 15:52:43 -0500 |
commit | 152ee6e09e2ce54d7d1cc9d338b82c0bf3cbbc95 (patch) | |
tree | d6f9ffed8d59cc257f2dfd884337f946a212ea3b /drivers | |
parent | c6999d831ab9ae5e368b20f3bc11b0ca9c17a7ec (diff) |
wl1271: Use NVS INI file configuration
Replace the hardcoded general and radio parameter configuration in the driver
with configuration taken from the NVS file directly. Also remove the driver
dependency to the structures with the parameter data.
Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Kalle Valo <kalle.valo@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271.h | 32 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_boot.c | 29 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_cmd.c | 117 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_cmd.h | 86 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_conf.h | 144 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_main.c | 101 |
6 files changed, 77 insertions, 432 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h index d0938db043b3..b3a3402593dd 100644 --- a/drivers/net/wireless/wl12xx/wl1271.h +++ b/drivers/net/wireless/wl12xx/wl1271.h | |||
@@ -109,7 +109,33 @@ enum { | |||
109 | 109 | ||
110 | #define WL1271_FW_NAME "wl1271-fw.bin" | 110 | #define WL1271_FW_NAME "wl1271-fw.bin" |
111 | #define WL1271_NVS_NAME "wl1271-nvs.bin" | 111 | #define WL1271_NVS_NAME "wl1271-nvs.bin" |
112 | #define WL1271_NVS_LEN 468 | 112 | |
113 | /* NVS data structure */ | ||
114 | #define WL1271_NVS_SECTION_SIZE 468 | ||
115 | |||
116 | #define WL1271_NVS_GENERAL_PARAMS_SIZE 57 | ||
117 | #define WL1271_NVS_GENERAL_PARAMS_SIZE_PADDED \ | ||
118 | (WL1271_NVS_GENERAL_PARAMS_SIZE + 1) | ||
119 | #define WL1271_NVS_STAT_RADIO_PARAMS_SIZE 17 | ||
120 | #define WL1271_NVS_STAT_RADIO_PARAMS_SIZE_PADDED \ | ||
121 | (WL1271_NVS_STAT_RADIO_PARAMS_SIZE + 1) | ||
122 | #define WL1271_NVS_DYN_RADIO_PARAMS_SIZE 65 | ||
123 | #define WL1271_NVS_DYN_RADIO_PARAMS_SIZE_PADDED \ | ||
124 | (WL1271_NVS_DYN_RADIO_PARAMS_SIZE + 1) | ||
125 | #define WL1271_NVS_FEM_COUNT 2 | ||
126 | #define WL1271_NVS_INI_SPARE_SIZE 124 | ||
127 | |||
128 | struct wl1271_nvs_file { | ||
129 | /* NVS section */ | ||
130 | u8 nvs[WL1271_NVS_SECTION_SIZE]; | ||
131 | |||
132 | /* INI section */ | ||
133 | u8 general_params[WL1271_NVS_GENERAL_PARAMS_SIZE_PADDED]; | ||
134 | u8 stat_radio_params[WL1271_NVS_STAT_RADIO_PARAMS_SIZE_PADDED]; | ||
135 | u8 dyn_radio_params[WL1271_NVS_FEM_COUNT] | ||
136 | [WL1271_NVS_DYN_RADIO_PARAMS_SIZE_PADDED]; | ||
137 | u8 ini_spare[WL1271_NVS_INI_SPARE_SIZE]; | ||
138 | } __attribute__ ((packed)); | ||
113 | 139 | ||
114 | /* | 140 | /* |
115 | * Enable/disable 802.11a support for WL1273 | 141 | * Enable/disable 802.11a support for WL1273 |
@@ -342,8 +368,7 @@ struct wl1271 { | |||
342 | 368 | ||
343 | u8 *fw; | 369 | u8 *fw; |
344 | size_t fw_len; | 370 | size_t fw_len; |
345 | u8 *nvs; | 371 | struct wl1271_nvs_file *nvs; |
346 | size_t nvs_len; | ||
347 | 372 | ||
348 | u8 bssid[ETH_ALEN]; | 373 | u8 bssid[ETH_ALEN]; |
349 | u8 mac_addr[ETH_ALEN]; | 374 | u8 mac_addr[ETH_ALEN]; |
@@ -461,6 +486,7 @@ int wl1271_plt_stop(struct wl1271 *wl); | |||
461 | 486 | ||
462 | static inline bool wl1271_11a_enabled(void) | 487 | static inline bool wl1271_11a_enabled(void) |
463 | { | 488 | { |
489 | /* FIXME: this could be determined based on the NVS-INI file */ | ||
464 | #ifdef WL1271_80211A_ENABLED | 490 | #ifdef WL1271_80211A_ENABLED |
465 | return true; | 491 | return true; |
466 | #else | 492 | #else |
diff --git a/drivers/net/wireless/wl12xx/wl1271_boot.c b/drivers/net/wireless/wl12xx/wl1271_boot.c index e803b876f3f0..bc3fe0275cac 100644 --- a/drivers/net/wireless/wl12xx/wl1271_boot.c +++ b/drivers/net/wireless/wl12xx/wl1271_boot.c | |||
@@ -219,29 +219,22 @@ static int wl1271_boot_upload_nvs(struct wl1271 *wl) | |||
219 | size_t nvs_len, burst_len; | 219 | size_t nvs_len, burst_len; |
220 | int i; | 220 | int i; |
221 | u32 dest_addr, val; | 221 | u32 dest_addr, val; |
222 | u8 *nvs_ptr, *nvs, *nvs_aligned; | 222 | u8 *nvs_ptr, *nvs_aligned; |
223 | 223 | ||
224 | nvs = wl->nvs; | 224 | if (wl->nvs == NULL) |
225 | if (nvs == NULL) | ||
226 | return -ENODEV; | 225 | return -ENODEV; |
227 | 226 | ||
228 | if (wl->nvs_len < WL1271_NVS_LEN) | ||
229 | return -EINVAL; | ||
230 | |||
231 | nvs_ptr = nvs; | ||
232 | |||
233 | /* only the first part of the NVS needs to be uploaded */ | 227 | /* only the first part of the NVS needs to be uploaded */ |
234 | nvs_len = WL1271_NVS_LEN; | 228 | nvs_len = sizeof(wl->nvs->nvs); |
235 | 229 | nvs_ptr = (u8 *)wl->nvs->nvs; | |
236 | /* FIXME: read init settings from the remaining part of the NVS */ | ||
237 | 230 | ||
238 | /* Update the device MAC address into the nvs */ | 231 | /* Update the device MAC address into the nvs */ |
239 | nvs[11] = wl->mac_addr[0]; | 232 | nvs_ptr[11] = wl->mac_addr[0]; |
240 | nvs[10] = wl->mac_addr[1]; | 233 | nvs_ptr[10] = wl->mac_addr[1]; |
241 | nvs[6] = wl->mac_addr[2]; | 234 | nvs_ptr[6] = wl->mac_addr[2]; |
242 | nvs[5] = wl->mac_addr[3]; | 235 | nvs_ptr[5] = wl->mac_addr[3]; |
243 | nvs[4] = wl->mac_addr[4]; | 236 | nvs_ptr[4] = wl->mac_addr[4]; |
244 | nvs[3] = wl->mac_addr[5]; | 237 | nvs_ptr[3] = wl->mac_addr[5]; |
245 | 238 | ||
246 | /* | 239 | /* |
247 | * Layout before the actual NVS tables: | 240 | * Layout before the actual NVS tables: |
@@ -283,7 +276,7 @@ static int wl1271_boot_upload_nvs(struct wl1271 *wl) | |||
283 | * is 7 bytes further. | 276 | * is 7 bytes further. |
284 | */ | 277 | */ |
285 | nvs_ptr += 7; | 278 | nvs_ptr += 7; |
286 | nvs_len -= nvs_ptr - nvs; | 279 | nvs_len -= nvs_ptr - (u8 *)wl->nvs->nvs; |
287 | nvs_len = ALIGN(nvs_len, 4); | 280 | nvs_len = ALIGN(nvs_len, 4); |
288 | 281 | ||
289 | /* FIXME: The driver sets the partition here, but this is not needed, | 282 | /* FIXME: The driver sets the partition here, but this is not needed, |
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c index dd2b5f0540a5..54b5124fc0c0 100644 --- a/drivers/net/wireless/wl12xx/wl1271_cmd.c +++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c | |||
@@ -191,43 +191,19 @@ static int wl1271_cmd_cal(struct wl1271 *wl) | |||
191 | int wl1271_cmd_general_parms(struct wl1271 *wl) | 191 | int wl1271_cmd_general_parms(struct wl1271 *wl) |
192 | { | 192 | { |
193 | struct wl1271_general_parms_cmd *gen_parms; | 193 | struct wl1271_general_parms_cmd *gen_parms; |
194 | struct conf_general_parms *g = &wl->conf.init.genparam; | ||
195 | int ret; | 194 | int ret; |
196 | 195 | ||
196 | if (!wl->nvs) | ||
197 | return -ENODEV; | ||
198 | |||
197 | gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL); | 199 | gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL); |
198 | if (!gen_parms) | 200 | if (!gen_parms) |
199 | return -ENOMEM; | 201 | return -ENOMEM; |
200 | 202 | ||
201 | gen_parms->test.id = TEST_CMD_INI_FILE_GENERAL_PARAM; | 203 | gen_parms->test.id = TEST_CMD_INI_FILE_GENERAL_PARAM; |
202 | 204 | ||
203 | gen_parms->ref_clk = g->ref_clk; | 205 | memcpy(gen_parms->params, wl->nvs->general_params, |
204 | gen_parms->settling_time = g->settling_time; | 206 | WL1271_NVS_GENERAL_PARAMS_SIZE); |
205 | gen_parms->clk_valid_on_wakeup = g->clk_valid_on_wakeup; | ||
206 | gen_parms->dc2dcmode = g->dc2dcmode; | ||
207 | gen_parms->single_dual_band = g->single_dual_band; | ||
208 | gen_parms->tx_bip_fem_autodetect = g->tx_bip_fem_autodetect; | ||
209 | gen_parms->tx_bip_fem_manufacturer = g->tx_bip_fem_manufacturer; | ||
210 | gen_parms->settings = g->settings; | ||
211 | |||
212 | gen_parms->sr_state = g->sr_state; | ||
213 | |||
214 | memcpy(gen_parms->srf1, | ||
215 | g->srf1, | ||
216 | CONF_MAX_SMART_REFLEX_PARAMS); | ||
217 | memcpy(gen_parms->srf2, | ||
218 | g->srf2, | ||
219 | CONF_MAX_SMART_REFLEX_PARAMS); | ||
220 | memcpy(gen_parms->srf3, | ||
221 | g->srf3, | ||
222 | CONF_MAX_SMART_REFLEX_PARAMS); | ||
223 | memcpy(gen_parms->sr_debug_table, | ||
224 | g->sr_debug_table, | ||
225 | CONF_MAX_SMART_REFLEX_PARAMS); | ||
226 | |||
227 | gen_parms->sr_sen_n_p = g->sr_sen_n_p; | ||
228 | gen_parms->sr_sen_n_p_gain = g->sr_sen_n_p_gain; | ||
229 | gen_parms->sr_sen_nrn = g->sr_sen_nrn; | ||
230 | gen_parms->sr_sen_prn = g->sr_sen_prn; | ||
231 | 207 | ||
232 | ret = wl1271_cmd_test(wl, gen_parms, sizeof(*gen_parms), 0); | 208 | ret = wl1271_cmd_test(wl, gen_parms, sizeof(*gen_parms), 0); |
233 | if (ret < 0) | 209 | if (ret < 0) |
@@ -240,8 +216,11 @@ int wl1271_cmd_general_parms(struct wl1271 *wl) | |||
240 | int wl1271_cmd_radio_parms(struct wl1271 *wl) | 216 | int wl1271_cmd_radio_parms(struct wl1271 *wl) |
241 | { | 217 | { |
242 | struct wl1271_radio_parms_cmd *radio_parms; | 218 | struct wl1271_radio_parms_cmd *radio_parms; |
243 | struct conf_radio_parms *r = &wl->conf.init.radioparam; | 219 | struct conf_radio_parms *rparam = &wl->conf.init.radioparam; |
244 | int i, ret; | 220 | int ret; |
221 | |||
222 | if (!wl->nvs) | ||
223 | return -ENODEV; | ||
245 | 224 | ||
246 | radio_parms = kzalloc(sizeof(*radio_parms), GFP_KERNEL); | 225 | radio_parms = kzalloc(sizeof(*radio_parms), GFP_KERNEL); |
247 | if (!radio_parms) | 226 | if (!radio_parms) |
@@ -249,73 +228,13 @@ int wl1271_cmd_radio_parms(struct wl1271 *wl) | |||
249 | 228 | ||
250 | radio_parms->test.id = TEST_CMD_INI_FILE_RADIO_PARAM; | 229 | radio_parms->test.id = TEST_CMD_INI_FILE_RADIO_PARAM; |
251 | 230 | ||
252 | /* Static radio parameters */ | 231 | memcpy(radio_parms->stat_radio_params, wl->nvs->stat_radio_params, |
253 | radio_parms->rx_trace_loss = r->rx_trace_loss; | 232 | WL1271_NVS_STAT_RADIO_PARAMS_SIZE); |
254 | radio_parms->tx_trace_loss = r->tx_trace_loss; | 233 | memcpy(radio_parms->dyn_radio_params, |
255 | memcpy(radio_parms->rx_rssi_and_proc_compens, | 234 | wl->nvs->dyn_radio_params[rparam->fem], |
256 | r->rx_rssi_and_proc_compens, | 235 | WL1271_NVS_DYN_RADIO_PARAMS_SIZE); |
257 | CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE); | 236 | |
258 | 237 | /* FIXME: current NVS is missing 5GHz parameters */ | |
259 | memcpy(radio_parms->rx_trace_loss_5, r->rx_trace_loss_5, | ||
260 | CONF_NUMBER_OF_SUB_BANDS_5); | ||
261 | memcpy(radio_parms->tx_trace_loss_5, r->tx_trace_loss_5, | ||
262 | CONF_NUMBER_OF_SUB_BANDS_5); | ||
263 | memcpy(radio_parms->rx_rssi_and_proc_compens_5, | ||
264 | r->rx_rssi_and_proc_compens_5, | ||
265 | CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE); | ||
266 | |||
267 | /* Dynamic radio parameters */ | ||
268 | radio_parms->tx_ref_pd_voltage = cpu_to_le16(r->tx_ref_pd_voltage); | ||
269 | radio_parms->tx_ref_power = r->tx_ref_power; | ||
270 | radio_parms->tx_offset_db = r->tx_offset_db; | ||
271 | |||
272 | memcpy(radio_parms->tx_rate_limits_normal, r->tx_rate_limits_normal, | ||
273 | CONF_NUMBER_OF_RATE_GROUPS); | ||
274 | memcpy(radio_parms->tx_rate_limits_degraded, r->tx_rate_limits_degraded, | ||
275 | CONF_NUMBER_OF_RATE_GROUPS); | ||
276 | memcpy(radio_parms->tx_rate_limits_extreme, r->tx_rate_limits_extreme, | ||
277 | CONF_NUMBER_OF_RATE_GROUPS); | ||
278 | |||
279 | memcpy(radio_parms->tx_channel_limits_11b, r->tx_channel_limits_11b, | ||
280 | CONF_NUMBER_OF_CHANNELS_2_4); | ||
281 | memcpy(radio_parms->tx_channel_limits_ofdm, r->tx_channel_limits_ofdm, | ||
282 | CONF_NUMBER_OF_CHANNELS_2_4); | ||
283 | memcpy(radio_parms->tx_pdv_rate_offsets, r->tx_pdv_rate_offsets, | ||
284 | CONF_NUMBER_OF_RATE_GROUPS); | ||
285 | memcpy(radio_parms->tx_ibias, r->tx_ibias, CONF_NUMBER_OF_RATE_GROUPS); | ||
286 | |||
287 | radio_parms->rx_fem_insertion_loss = r->rx_fem_insertion_loss; | ||
288 | radio_parms->degraded_low_to_normal_threshold = | ||
289 | r->degraded_low_to_normal_threshold; | ||
290 | radio_parms->degraded_normal_to_high_threshold = | ||
291 | r->degraded_normal_to_high_threshold; | ||
292 | |||
293 | |||
294 | for (i = 0; i < CONF_NUMBER_OF_SUB_BANDS_5; i++) | ||
295 | radio_parms->tx_ref_pd_voltage_5[i] = | ||
296 | cpu_to_le16(r->tx_ref_pd_voltage_5[i]); | ||
297 | memcpy(radio_parms->tx_ref_power_5, r->tx_ref_power_5, | ||
298 | CONF_NUMBER_OF_SUB_BANDS_5); | ||
299 | memcpy(radio_parms->tx_offset_db_5, r->tx_offset_db_5, | ||
300 | CONF_NUMBER_OF_SUB_BANDS_5); | ||
301 | memcpy(radio_parms->tx_rate_limits_normal_5, | ||
302 | r->tx_rate_limits_normal_5, CONF_NUMBER_OF_RATE_GROUPS); | ||
303 | memcpy(radio_parms->tx_rate_limits_degraded_5, | ||
304 | r->tx_rate_limits_degraded_5, CONF_NUMBER_OF_RATE_GROUPS); | ||
305 | memcpy(radio_parms->tx_rate_limits_extreme_5, | ||
306 | r->tx_rate_limits_extreme_5, CONF_NUMBER_OF_RATE_GROUPS); | ||
307 | memcpy(radio_parms->tx_channel_limits_ofdm_5, | ||
308 | r->tx_channel_limits_ofdm_5, CONF_NUMBER_OF_CHANNELS_5); | ||
309 | memcpy(radio_parms->tx_pdv_rate_offsets_5, r->tx_pdv_rate_offsets_5, | ||
310 | CONF_NUMBER_OF_RATE_GROUPS); | ||
311 | memcpy(radio_parms->tx_ibias_5, r->tx_ibias_5, | ||
312 | CONF_NUMBER_OF_RATE_GROUPS); | ||
313 | memcpy(radio_parms->rx_fem_insertion_loss_5, | ||
314 | r->rx_fem_insertion_loss_5, CONF_NUMBER_OF_SUB_BANDS_5); | ||
315 | radio_parms->degraded_low_to_normal_threshold_5 = | ||
316 | r->degraded_low_to_normal_threshold_5; | ||
317 | radio_parms->degraded_normal_to_high_threshold_5 = | ||
318 | r->degraded_normal_to_high_threshold_5; | ||
319 | 238 | ||
320 | wl1271_dump(DEBUG_CMD, "TEST_CMD_INI_FILE_RADIO_PARAM: ", | 239 | wl1271_dump(DEBUG_CMD, "TEST_CMD_INI_FILE_RADIO_PARAM: ", |
321 | radio_parms, sizeof(*radio_parms)); | 240 | radio_parms, sizeof(*radio_parms)); |
@@ -1022,7 +941,7 @@ int wl1271_cmd_set_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type, | |||
1022 | ret = wl1271_cmd_send(wl, CMD_SET_KEYS, cmd, sizeof(*cmd), 0); | 941 | ret = wl1271_cmd_send(wl, CMD_SET_KEYS, cmd, sizeof(*cmd), 0); |
1023 | if (ret < 0) { | 942 | if (ret < 0) { |
1024 | wl1271_warning("could not set keys"); | 943 | wl1271_warning("could not set keys"); |
1025 | goto out; | 944 | goto out; |
1026 | } | 945 | } |
1027 | 946 | ||
1028 | out: | 947 | out: |
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.h b/drivers/net/wireless/wl12xx/wl1271_cmd.h index ba433f423c8b..2dc06c73532b 100644 --- a/drivers/net/wireless/wl12xx/wl1271_cmd.h +++ b/drivers/net/wireless/wl12xx/wl1271_cmd.h | |||
@@ -428,90 +428,24 @@ struct wl1271_general_parms_cmd { | |||
428 | 428 | ||
429 | struct wl1271_cmd_test_header test; | 429 | struct wl1271_cmd_test_header test; |
430 | 430 | ||
431 | u8 ref_clk; | 431 | u8 params[WL1271_NVS_GENERAL_PARAMS_SIZE]; |
432 | u8 settling_time; | 432 | s8 reserved[23]; |
433 | u8 clk_valid_on_wakeup; | ||
434 | u8 dc2dcmode; | ||
435 | u8 single_dual_band; | ||
436 | |||
437 | u8 tx_bip_fem_autodetect; | ||
438 | u8 tx_bip_fem_manufacturer; | ||
439 | u8 settings; | ||
440 | |||
441 | u8 sr_state; | ||
442 | |||
443 | s8 srf1[CONF_MAX_SMART_REFLEX_PARAMS]; | ||
444 | s8 srf2[CONF_MAX_SMART_REFLEX_PARAMS]; | ||
445 | s8 srf3[CONF_MAX_SMART_REFLEX_PARAMS]; | ||
446 | |||
447 | s8 sr_debug_table[CONF_MAX_SMART_REFLEX_PARAMS]; | ||
448 | |||
449 | u8 sr_sen_n_p; | ||
450 | u8 sr_sen_n_p_gain; | ||
451 | u8 sr_sen_nrn; | ||
452 | u8 sr_sen_prn; | ||
453 | |||
454 | u8 padding[3]; | ||
455 | } __attribute__ ((packed)); | 433 | } __attribute__ ((packed)); |
456 | 434 | ||
435 | #define WL1271_STAT_RADIO_PARAMS_5_SIZE 29 | ||
436 | #define WL1271_DYN_RADIO_PARAMS_5_SIZE 104 | ||
437 | |||
457 | struct wl1271_radio_parms_cmd { | 438 | struct wl1271_radio_parms_cmd { |
458 | struct wl1271_cmd_header header; | 439 | struct wl1271_cmd_header header; |
459 | 440 | ||
460 | struct wl1271_cmd_test_header test; | 441 | struct wl1271_cmd_test_header test; |
461 | 442 | ||
462 | /* Static radio parameters */ | 443 | u8 stat_radio_params[WL1271_NVS_STAT_RADIO_PARAMS_SIZE]; |
463 | /* 2.4GHz */ | 444 | u8 stat_radio_params_5[WL1271_STAT_RADIO_PARAMS_5_SIZE]; |
464 | u8 rx_trace_loss; | ||
465 | u8 tx_trace_loss; | ||
466 | s8 rx_rssi_and_proc_compens[CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE]; | ||
467 | |||
468 | /* 5GHz */ | ||
469 | u8 rx_trace_loss_5[CONF_NUMBER_OF_SUB_BANDS_5]; | ||
470 | u8 tx_trace_loss_5[CONF_NUMBER_OF_SUB_BANDS_5]; | ||
471 | s8 rx_rssi_and_proc_compens_5[CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE]; | ||
472 | |||
473 | /* Dynamic radio parameters */ | ||
474 | /* 2.4GHz */ | ||
475 | __le16 tx_ref_pd_voltage; | ||
476 | u8 tx_ref_power; | ||
477 | s8 tx_offset_db; | ||
478 | |||
479 | s8 tx_rate_limits_normal[CONF_NUMBER_OF_RATE_GROUPS]; | ||
480 | s8 tx_rate_limits_degraded[CONF_NUMBER_OF_RATE_GROUPS]; | ||
481 | s8 tx_rate_limits_extreme[CONF_NUMBER_OF_RATE_GROUPS]; | ||
482 | 445 | ||
483 | s8 tx_channel_limits_11b[CONF_NUMBER_OF_CHANNELS_2_4]; | 446 | u8 dyn_radio_params[WL1271_NVS_DYN_RADIO_PARAMS_SIZE]; |
484 | s8 tx_channel_limits_ofdm[CONF_NUMBER_OF_CHANNELS_2_4]; | 447 | u8 reserved; |
485 | s8 tx_pdv_rate_offsets[CONF_NUMBER_OF_RATE_GROUPS]; | 448 | u8 dyn_radio_params_5[WL1271_DYN_RADIO_PARAMS_5_SIZE]; |
486 | |||
487 | u8 tx_ibias[CONF_NUMBER_OF_RATE_GROUPS]; | ||
488 | u8 rx_fem_insertion_loss; | ||
489 | |||
490 | u8 degraded_low_to_normal_threshold; | ||
491 | u8 degraded_normal_to_high_threshold; | ||
492 | |||
493 | u8 padding1; /* our own padding, not in ref driver */ | ||
494 | |||
495 | /* 5GHz */ | ||
496 | __le16 tx_ref_pd_voltage_5[CONF_NUMBER_OF_SUB_BANDS_5]; | ||
497 | u8 tx_ref_power_5[CONF_NUMBER_OF_SUB_BANDS_5]; | ||
498 | s8 tx_offset_db_5[CONF_NUMBER_OF_SUB_BANDS_5]; | ||
499 | |||
500 | s8 tx_rate_limits_normal_5[CONF_NUMBER_OF_RATE_GROUPS]; | ||
501 | s8 tx_rate_limits_degraded_5[CONF_NUMBER_OF_RATE_GROUPS]; | ||
502 | s8 tx_rate_limits_extreme_5[CONF_NUMBER_OF_RATE_GROUPS]; | ||
503 | |||
504 | s8 tx_channel_limits_ofdm_5[CONF_NUMBER_OF_CHANNELS_5]; | ||
505 | s8 tx_pdv_rate_offsets_5[CONF_NUMBER_OF_RATE_GROUPS]; | ||
506 | |||
507 | /* FIXME: this is inconsistent with the types for 2.4GHz */ | ||
508 | s8 tx_ibias_5[CONF_NUMBER_OF_RATE_GROUPS]; | ||
509 | s8 rx_fem_insertion_loss_5[CONF_NUMBER_OF_SUB_BANDS_5]; | ||
510 | |||
511 | u8 degraded_low_to_normal_threshold_5; | ||
512 | u8 degraded_normal_to_high_threshold_5; | ||
513 | |||
514 | u8 padding2[2]; | ||
515 | } __attribute__ ((packed)); | 449 | } __attribute__ ((packed)); |
516 | 450 | ||
517 | struct wl1271_cmd_cal_channel_tune { | 451 | struct wl1271_cmd_cal_channel_tune { |
diff --git a/drivers/net/wireless/wl12xx/wl1271_conf.h b/drivers/net/wireless/wl12xx/wl1271_conf.h index 1993d63c214e..6f9e75cc5640 100644 --- a/drivers/net/wireless/wl12xx/wl1271_conf.h +++ b/drivers/net/wireless/wl12xx/wl1271_conf.h | |||
@@ -735,81 +735,6 @@ enum single_dual_band_enum { | |||
735 | CONF_DUAL_BAND | 735 | CONF_DUAL_BAND |
736 | }; | 736 | }; |
737 | 737 | ||
738 | |||
739 | #define CONF_MAX_SMART_REFLEX_PARAMS 16 | ||
740 | |||
741 | struct conf_general_parms { | ||
742 | /* | ||
743 | * RF Reference Clock type / speed | ||
744 | * | ||
745 | * Range: CONF_REF_CLK_* | ||
746 | */ | ||
747 | u8 ref_clk; | ||
748 | |||
749 | /* | ||
750 | * Settling time of the reference clock after boot. | ||
751 | * | ||
752 | * Range: u8 | ||
753 | */ | ||
754 | u8 settling_time; | ||
755 | |||
756 | /* | ||
757 | * Flag defining whether clock is valid on wakeup. | ||
758 | * | ||
759 | * Range: 0 - not valid on wakeup, 1 - valid on wakeup | ||
760 | */ | ||
761 | u8 clk_valid_on_wakeup; | ||
762 | |||
763 | /* | ||
764 | * DC-to-DC mode. | ||
765 | * | ||
766 | * Range: Unknown | ||
767 | */ | ||
768 | u8 dc2dcmode; | ||
769 | |||
770 | /* | ||
771 | * Flag defining whether used as single or dual-band. | ||
772 | * | ||
773 | * Range: CONF_SINGLE_BAND, CONF_DUAL_BAND | ||
774 | */ | ||
775 | u8 single_dual_band; | ||
776 | |||
777 | /* | ||
778 | * TX bip fem autodetect flag. | ||
779 | * | ||
780 | * Range: Unknown | ||
781 | */ | ||
782 | u8 tx_bip_fem_autodetect; | ||
783 | |||
784 | /* | ||
785 | * TX bip gem manufacturer. | ||
786 | * | ||
787 | * Range: Unknown | ||
788 | */ | ||
789 | u8 tx_bip_fem_manufacturer; | ||
790 | |||
791 | /* | ||
792 | * Settings flags. | ||
793 | * | ||
794 | * Range: Unknown | ||
795 | */ | ||
796 | u8 settings; | ||
797 | |||
798 | /* Smart reflex settings */ | ||
799 | u8 sr_state; | ||
800 | |||
801 | s8 srf1[CONF_MAX_SMART_REFLEX_PARAMS]; | ||
802 | s8 srf2[CONF_MAX_SMART_REFLEX_PARAMS]; | ||
803 | s8 srf3[CONF_MAX_SMART_REFLEX_PARAMS]; | ||
804 | |||
805 | s8 sr_debug_table[CONF_MAX_SMART_REFLEX_PARAMS]; | ||
806 | |||
807 | u8 sr_sen_n_p; | ||
808 | u8 sr_sen_n_p_gain; | ||
809 | u8 sr_sen_nrn; | ||
810 | u8 sr_sen_prn; | ||
811 | }; | ||
812 | |||
813 | #define CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE 15 | 738 | #define CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE 15 |
814 | #define CONF_NUMBER_OF_SUB_BANDS_5 7 | 739 | #define CONF_NUMBER_OF_SUB_BANDS_5 7 |
815 | #define CONF_NUMBER_OF_RATE_GROUPS 6 | 740 | #define CONF_NUMBER_OF_RATE_GROUPS 6 |
@@ -818,78 +743,15 @@ struct conf_general_parms { | |||
818 | 743 | ||
819 | struct conf_radio_parms { | 744 | struct conf_radio_parms { |
820 | /* | 745 | /* |
821 | * Static radio parameters for 2.4GHz | 746 | * FEM parameter set to use |
822 | * | ||
823 | * Range: unknown | ||
824 | */ | ||
825 | u8 rx_trace_loss; | ||
826 | u8 tx_trace_loss; | ||
827 | s8 rx_rssi_and_proc_compens[CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE]; | ||
828 | |||
829 | /* | ||
830 | * Static radio parameters for 5GHz | ||
831 | * | ||
832 | * Range: unknown | ||
833 | */ | ||
834 | u8 rx_trace_loss_5[CONF_NUMBER_OF_SUB_BANDS_5]; | ||
835 | u8 tx_trace_loss_5[CONF_NUMBER_OF_SUB_BANDS_5]; | ||
836 | s8 rx_rssi_and_proc_compens_5[CONF_RSSI_AND_PROCESS_COMPENSATION_SIZE]; | ||
837 | |||
838 | /* | ||
839 | * Dynamic radio parameters for 2.4GHz | ||
840 | * | 747 | * |
841 | * Range: unknown | 748 | * Range: 0 or 1 |
842 | */ | 749 | */ |
843 | u16 tx_ref_pd_voltage; | 750 | u8 fem; |
844 | u8 tx_ref_power; | ||
845 | s8 tx_offset_db; | ||
846 | |||
847 | s8 tx_rate_limits_normal[CONF_NUMBER_OF_RATE_GROUPS]; | ||
848 | s8 tx_rate_limits_degraded[CONF_NUMBER_OF_RATE_GROUPS]; | ||
849 | s8 tx_rate_limits_extreme[CONF_NUMBER_OF_RATE_GROUPS]; | ||
850 | |||
851 | s8 tx_channel_limits_11b[CONF_NUMBER_OF_CHANNELS_2_4]; | ||
852 | s8 tx_channel_limits_ofdm[CONF_NUMBER_OF_CHANNELS_2_4]; | ||
853 | s8 tx_pdv_rate_offsets[CONF_NUMBER_OF_RATE_GROUPS]; | ||
854 | |||
855 | u8 tx_ibias[CONF_NUMBER_OF_RATE_GROUPS]; | ||
856 | u8 rx_fem_insertion_loss; | ||
857 | |||
858 | u8 degraded_low_to_normal_threshold; | ||
859 | u8 degraded_normal_to_high_threshold; | ||
860 | |||
861 | |||
862 | /* | ||
863 | * Dynamic radio parameters for 5GHz | ||
864 | * | ||
865 | * Range: unknown | ||
866 | */ | ||
867 | u16 tx_ref_pd_voltage_5[CONF_NUMBER_OF_SUB_BANDS_5]; | ||
868 | u8 tx_ref_power_5[CONF_NUMBER_OF_SUB_BANDS_5]; | ||
869 | s8 tx_offset_db_5[CONF_NUMBER_OF_SUB_BANDS_5]; | ||
870 | |||
871 | s8 tx_rate_limits_normal_5[CONF_NUMBER_OF_RATE_GROUPS]; | ||
872 | s8 tx_rate_limits_degraded_5[CONF_NUMBER_OF_RATE_GROUPS]; | ||
873 | s8 tx_rate_limits_extreme_5[CONF_NUMBER_OF_RATE_GROUPS]; | ||
874 | |||
875 | s8 tx_channel_limits_ofdm_5[CONF_NUMBER_OF_CHANNELS_5]; | ||
876 | s8 tx_pdv_rate_offsets_5[CONF_NUMBER_OF_RATE_GROUPS]; | ||
877 | |||
878 | /* FIXME: this is inconsistent with the types for 2.4GHz */ | ||
879 | s8 tx_ibias_5[CONF_NUMBER_OF_RATE_GROUPS]; | ||
880 | s8 rx_fem_insertion_loss_5[CONF_NUMBER_OF_SUB_BANDS_5]; | ||
881 | |||
882 | u8 degraded_low_to_normal_threshold_5; | ||
883 | u8 degraded_normal_to_high_threshold_5; | ||
884 | }; | 751 | }; |
885 | 752 | ||
886 | struct conf_init_settings { | 753 | struct conf_init_settings { |
887 | /* | 754 | /* |
888 | * Configure general parameters. | ||
889 | */ | ||
890 | struct conf_general_parms genparam; | ||
891 | |||
892 | /* | ||
893 | * Configure radio parameters. | 755 | * Configure radio parameters. |
894 | */ | 756 | */ |
895 | struct conf_radio_parms radioparam; | 757 | struct conf_radio_parms radioparam; |
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c index 6f7a7d946359..282c2bbfec86 100644 --- a/drivers/net/wireless/wl12xx/wl1271_main.c +++ b/drivers/net/wireless/wl12xx/wl1271_main.c | |||
@@ -229,93 +229,8 @@ static struct conf_drv_settings default_conf = { | |||
229 | .psm_entry_retries = 3 | 229 | .psm_entry_retries = 3 |
230 | }, | 230 | }, |
231 | .init = { | 231 | .init = { |
232 | .genparam = { | ||
233 | .ref_clk = CONF_REF_CLK_38_4_E, | ||
234 | .settling_time = 5, | ||
235 | .clk_valid_on_wakeup = 0, | ||
236 | .dc2dcmode = 0, | ||
237 | .single_dual_band = CONF_SINGLE_BAND, | ||
238 | .tx_bip_fem_autodetect = 1, | ||
239 | .tx_bip_fem_manufacturer = 1, | ||
240 | .settings = 1, | ||
241 | .sr_state = 1, | ||
242 | .srf1 = { 0x07, 0x03, 0x18, 0x10, 0x05, 0xfb, 0xf0, | ||
243 | 0xe8, 0, 0, 0, 0, 0, 0, 0, 0 }, | ||
244 | .srf2 = { 0x07, 0x03, 0x18, 0x10, 0x05, 0xfb, 0xf0, | ||
245 | 0xe8, 0, 0, 0, 0, 0, 0, 0, 0 }, | ||
246 | .srf3 = { 0x07, 0x03, 0x18, 0x10, 0x05, 0xfb, 0xf0, | ||
247 | 0xe8, 0, 0, 0, 0, 0, 0, 0, 0 }, | ||
248 | .sr_debug_table = { 0, 0, 0, 0, 0, 0, 0, 0, | ||
249 | 0, 0, 0, 0, 0, 0, 0, 0 }, | ||
250 | .sr_sen_n_p = 0, | ||
251 | .sr_sen_n_p_gain = 0, | ||
252 | .sr_sen_nrn = 0, | ||
253 | .sr_sen_prn = 0, | ||
254 | }, | ||
255 | .radioparam = { | 232 | .radioparam = { |
256 | .rx_trace_loss = 0x24, | 233 | .fem = 1, |
257 | .tx_trace_loss = 0x0, | ||
258 | .rx_rssi_and_proc_compens = { | ||
259 | 0xec, 0xf6, 0x00, 0x0c, 0x18, 0xf8, | ||
260 | 0xfc, 0x00, 0x80, 0x10, 0xf0, 0xf8, | ||
261 | 0x00, 0x0a, 0x14 }, | ||
262 | .rx_trace_loss_5 = { 0, 0, 0, 0, 0, 0, 0 }, | ||
263 | .tx_trace_loss_5 = { 0, 0, 0, 0, 0, 0, 0 }, | ||
264 | .rx_rssi_and_proc_compens_5 = { | ||
265 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
266 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
267 | 0x00, 0x00, 0x00 }, | ||
268 | .tx_ref_pd_voltage = 0x1a9, | ||
269 | .tx_ref_power = 0x80, | ||
270 | .tx_offset_db = 0x0, | ||
271 | .tx_rate_limits_normal = { | ||
272 | 0x1d, 0x1f, 0x24, 0x28, 0x28, 0x29 }, | ||
273 | .tx_rate_limits_degraded = { | ||
274 | 0x19, 0x1f, 0x22, 0x23, 0x27, 0x28 }, | ||
275 | .tx_rate_limits_extreme = { | ||
276 | 0x19, 0x1c, 0x1e, 0x20, 0x24, 0x25 }, | ||
277 | .tx_channel_limits_11b = { | ||
278 | 0x22, 0x50, 0x50, 0x50, 0x50, 0x50, | ||
279 | 0x50, 0x50, 0x50, 0x50, 0x22, 0x50, | ||
280 | 0x22, 0x50 }, | ||
281 | .tx_channel_limits_ofdm = { | ||
282 | 0x20, 0x50, 0x50, 0x50, 0x50, 0x50, | ||
283 | 0x50, 0x50, 0x50, 0x50, 0x20, 0x50, | ||
284 | 0x20, 0x50 }, | ||
285 | .tx_pdv_rate_offsets = { | ||
286 | 0x07, 0x08, 0x04, 0x02, 0x02, 0x00 }, | ||
287 | .tx_ibias = { | ||
288 | 0x11, 0x11, 0x15, 0x11, 0x15, 0x0f }, | ||
289 | .rx_fem_insertion_loss = 0x0e, | ||
290 | .degraded_low_to_normal_threshold = 0x1e, | ||
291 | .degraded_normal_to_high_threshold = 0x2d, | ||
292 | .tx_ref_pd_voltage_5 = { | ||
293 | 0x0190, 0x01a4, 0x01c3, 0x01d8, | ||
294 | 0x020a, 0x021c }, | ||
295 | .tx_ref_power_5 = { | ||
296 | 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 }, | ||
297 | .tx_offset_db_5 = { | ||
298 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, | ||
299 | .tx_rate_limits_normal_5 = { | ||
300 | 0x1b, 0x1e, 0x21, 0x23, 0x27, 0x00 }, | ||
301 | .tx_rate_limits_degraded_5 = { | ||
302 | 0x1b, 0x1e, 0x21, 0x23, 0x27, 0x00 }, | ||
303 | .tx_rate_limits_extreme_5 = { | ||
304 | 0x1b, 0x1e, 0x21, 0x23, 0x27, 0x00 }, | ||
305 | .tx_channel_limits_ofdm_5 = { | ||
306 | 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, | ||
307 | 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, | ||
308 | 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, | ||
309 | 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, | ||
310 | 0x50, 0x50, 0x50 }, | ||
311 | .tx_pdv_rate_offsets_5 = { | ||
312 | 0x01, 0x02, 0x02, 0x02, 0x02, 0x00 }, | ||
313 | .tx_ibias_5 = { | ||
314 | 0x10, 0x10, 0x10, 0x10, 0x10, 0x10 }, | ||
315 | .rx_fem_insertion_loss_5 = { | ||
316 | 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10 }, | ||
317 | .degraded_low_to_normal_threshold_5 = 0x00, | ||
318 | .degraded_normal_to_high_threshold_5 = 0x00 | ||
319 | } | 234 | } |
320 | }, | 235 | }, |
321 | .itrim = { | 236 | .itrim = { |
@@ -345,9 +260,6 @@ static void wl1271_conf_init(struct wl1271 *wl) | |||
345 | 260 | ||
346 | /* apply driver default configuration */ | 261 | /* apply driver default configuration */ |
347 | memcpy(&wl->conf, &default_conf, sizeof(default_conf)); | 262 | memcpy(&wl->conf, &default_conf, sizeof(default_conf)); |
348 | |||
349 | if (wl1271_11a_enabled()) | ||
350 | wl->conf.init.genparam.single_dual_band = CONF_DUAL_BAND; | ||
351 | } | 263 | } |
352 | 264 | ||
353 | 265 | ||
@@ -567,15 +479,14 @@ static int wl1271_fetch_nvs(struct wl1271 *wl) | |||
567 | return ret; | 479 | return ret; |
568 | } | 480 | } |
569 | 481 | ||
570 | if (fw->size % 4) { | 482 | if (fw->size != sizeof(struct wl1271_nvs_file)) { |
571 | wl1271_error("nvs size is not multiple of 32 bits: %zu", | 483 | wl1271_error("nvs size is not as expected: %zu != %zu", |
572 | fw->size); | 484 | fw->size, sizeof(struct wl1271_nvs_file)); |
573 | ret = -EILSEQ; | 485 | ret = -EILSEQ; |
574 | goto out; | 486 | goto out; |
575 | } | 487 | } |
576 | 488 | ||
577 | wl->nvs_len = fw->size; | 489 | wl->nvs = kmalloc(sizeof(struct wl1271_nvs_file), GFP_KERNEL); |
578 | wl->nvs = kmalloc(wl->nvs_len, GFP_KERNEL); | ||
579 | 490 | ||
580 | if (!wl->nvs) { | 491 | if (!wl->nvs) { |
581 | wl1271_error("could not allocate memory for the nvs file"); | 492 | wl1271_error("could not allocate memory for the nvs file"); |
@@ -583,7 +494,7 @@ static int wl1271_fetch_nvs(struct wl1271 *wl) | |||
583 | goto out; | 494 | goto out; |
584 | } | 495 | } |
585 | 496 | ||
586 | memcpy(wl->nvs, fw->data, wl->nvs_len); | 497 | memcpy(wl->nvs, fw->data, sizeof(struct wl1271_nvs_file)); |
587 | 498 | ||
588 | ret = 0; | 499 | ret = 0; |
589 | 500 | ||