aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJuuso Oikarinen <juuso.oikarinen@nokia.com>2010-05-14 03:46:22 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-06-02 16:13:05 -0400
commiteb70eb723b489dd4e233e22e47d993f59858cdd8 (patch)
tree97efd7b0a941eafc1ebb71d8b10326d93a840682 /drivers
parentff37d9a9ce493743cfc4665edb05fbbdabca78ee (diff)
wl1271: Update handling of the NVS file / INI parameters
This patch updates the handling of the NVS file INI-section, trying to make it slightly more generic, and exposing the parameters being set. This is done in preparation for 5GHz parameters. 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')
-rw-r--r--drivers/net/wireless/wl12xx/wl1271.h28
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_cmd.c14
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_cmd.h26
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_ini.h118
4 files changed, 142 insertions, 44 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index 6f1b6b5640c0..1e48e75b3408 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -33,6 +33,7 @@
33#include <net/mac80211.h> 33#include <net/mac80211.h>
34 34
35#include "wl1271_conf.h" 35#include "wl1271_conf.h"
36#include "wl1271_ini.h"
36 37
37#define DRIVER_NAME "wl1271" 38#define DRIVER_NAME "wl1271"
38#define DRIVER_PREFIX DRIVER_NAME ": " 39#define DRIVER_PREFIX DRIVER_NAME ": "
@@ -116,33 +117,6 @@ enum {
116#define WL1271_TX_SECURITY_LO16(s) ((u16)((s) & 0xffff)) 117#define WL1271_TX_SECURITY_LO16(s) ((u16)((s) & 0xffff))
117#define WL1271_TX_SECURITY_HI32(s) ((u32)(((s) >> 16) & 0xffffffff)) 118#define WL1271_TX_SECURITY_HI32(s) ((u32)(((s) >> 16) & 0xffffffff))
118 119
119/* NVS data structure */
120#define WL1271_NVS_SECTION_SIZE 468
121
122#define WL1271_NVS_GENERAL_PARAMS_SIZE 57
123#define WL1271_NVS_GENERAL_PARAMS_SIZE_PADDED \
124 (WL1271_NVS_GENERAL_PARAMS_SIZE + 1)
125#define WL1271_NVS_STAT_RADIO_PARAMS_SIZE 17
126#define WL1271_NVS_STAT_RADIO_PARAMS_SIZE_PADDED \
127 (WL1271_NVS_STAT_RADIO_PARAMS_SIZE + 1)
128#define WL1271_NVS_DYN_RADIO_PARAMS_SIZE 65
129#define WL1271_NVS_DYN_RADIO_PARAMS_SIZE_PADDED \
130 (WL1271_NVS_DYN_RADIO_PARAMS_SIZE + 1)
131#define WL1271_NVS_FEM_COUNT 2
132#define WL1271_NVS_INI_SPARE_SIZE 124
133
134struct wl1271_nvs_file {
135 /* NVS section */
136 u8 nvs[WL1271_NVS_SECTION_SIZE];
137
138 /* INI section */
139 u8 general_params[WL1271_NVS_GENERAL_PARAMS_SIZE_PADDED];
140 u8 stat_radio_params[WL1271_NVS_STAT_RADIO_PARAMS_SIZE_PADDED];
141 u8 dyn_radio_params[WL1271_NVS_FEM_COUNT]
142 [WL1271_NVS_DYN_RADIO_PARAMS_SIZE_PADDED];
143 u8 ini_spare[WL1271_NVS_INI_SPARE_SIZE];
144} __attribute__ ((packed));
145
146/* 120/*
147 * Enable/disable 802.11a support for WL1273 121 * Enable/disable 802.11a support for WL1273
148 */ 122 */
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c
index 19393e236e2c..241b47781865 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c
@@ -212,8 +212,8 @@ int wl1271_cmd_general_parms(struct wl1271 *wl)
212 212
213 gen_parms->test.id = TEST_CMD_INI_FILE_GENERAL_PARAM; 213 gen_parms->test.id = TEST_CMD_INI_FILE_GENERAL_PARAM;
214 214
215 memcpy(gen_parms->params, wl->nvs->general_params, 215 memcpy(&gen_parms->general_params, &wl->nvs->general_params,
216 WL1271_NVS_GENERAL_PARAMS_SIZE); 216 sizeof(struct wl1271_ini_general_params));
217 217
218 ret = wl1271_cmd_test(wl, gen_parms, sizeof(*gen_parms), 0); 218 ret = wl1271_cmd_test(wl, gen_parms, sizeof(*gen_parms), 0);
219 if (ret < 0) 219 if (ret < 0)
@@ -238,11 +238,11 @@ 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 memcpy(radio_parms->stat_radio_params, wl->nvs->stat_radio_params, 241 memcpy(&radio_parms->static_params_2, &wl->nvs->stat_radio_params_2,
242 WL1271_NVS_STAT_RADIO_PARAMS_SIZE); 242 sizeof(struct wl1271_ini_band_params_2));
243 memcpy(radio_parms->dyn_radio_params, 243 memcpy(&radio_parms->dyn_params_2,
244 wl->nvs->dyn_radio_params[rparam->fem], 244 &wl->nvs->dyn_radio_params_2[rparam->fem].params,
245 WL1271_NVS_DYN_RADIO_PARAMS_SIZE); 245 sizeof(struct wl1271_ini_fem_params_2));
246 246
247 /* FIXME: current NVS is missing 5GHz parameters */ 247 /* FIXME: current NVS is missing 5GHz parameters */
248 248
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.h b/drivers/net/wireless/wl12xx/wl1271_cmd.h
index f2820b42a943..4ff966f6354b 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.h
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.h
@@ -439,24 +439,30 @@ struct wl1271_general_parms_cmd {
439 439
440 struct wl1271_cmd_test_header test; 440 struct wl1271_cmd_test_header test;
441 441
442 u8 params[WL1271_NVS_GENERAL_PARAMS_SIZE]; 442 struct wl1271_ini_general_params general_params;
443 s8 reserved[23];
444} __attribute__ ((packed));
445 443
446#define WL1271_STAT_RADIO_PARAMS_5_SIZE 29 444 u8 sr_debug_table[WL1271_INI_MAX_SMART_REFLEX_PARAM];
447#define WL1271_DYN_RADIO_PARAMS_5_SIZE 104 445 u8 sr_sen_n_p;
446 u8 sr_sen_n_p_gain;
447 u8 sr_sen_nrn;
448 u8 sr_sen_prn;
449 u8 padding[3];
450} __attribute__ ((packed));
448 451
449struct wl1271_radio_parms_cmd { 452struct wl1271_radio_parms_cmd {
450 struct wl1271_cmd_header header; 453 struct wl1271_cmd_header header;
451 454
452 struct wl1271_cmd_test_header test; 455 struct wl1271_cmd_test_header test;
453 456
454 u8 stat_radio_params[WL1271_NVS_STAT_RADIO_PARAMS_SIZE]; 457 /* Static radio parameters */
455 u8 stat_radio_params_5[WL1271_STAT_RADIO_PARAMS_5_SIZE]; 458 struct wl1271_ini_band_params_2 static_params_2;
459 struct wl1271_ini_band_params_5 static_params_5;
456 460
457 u8 dyn_radio_params[WL1271_NVS_DYN_RADIO_PARAMS_SIZE]; 461 /* Dynamic radio parameters */
458 u8 reserved; 462 struct wl1271_ini_fem_params_2 dyn_params_2;
459 u8 dyn_radio_params_5[WL1271_DYN_RADIO_PARAMS_5_SIZE]; 463 u8 padding2;
464 struct wl1271_ini_fem_params_5 dyn_params_5;
465 u8 padding3[2];
460} __attribute__ ((packed)); 466} __attribute__ ((packed));
461 467
462struct wl1271_cmd_cal_channel_tune { 468struct wl1271_cmd_cal_channel_tune {
diff --git a/drivers/net/wireless/wl12xx/wl1271_ini.h b/drivers/net/wireless/wl12xx/wl1271_ini.h
new file mode 100644
index 000000000000..d1590bc1bf83
--- /dev/null
+++ b/drivers/net/wireless/wl12xx/wl1271_ini.h
@@ -0,0 +1,118 @@
1/*
2 * This file is part of wl1271
3 *
4 * Copyright (C) 2010 Nokia Corporation
5 *
6 * Contact: Luciano Coelho <luciano.coelho@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 */
23
24#ifndef __WL1271_INI_H__
25#define __WL1271_INI_H__
26
27#define WL1271_INI_MAX_SMART_REFLEX_PARAM 16
28
29struct wl1271_ini_general_params {
30 u8 ref_clock;
31 u8 settling_time;
32 u8 clk_valid_on_wakeup;
33 u8 dc2dc_mode;
34 u8 dual_mode_select;
35 u8 tx_bip_fem_auto_detect;
36 u8 tx_bip_fem_manufacturer;
37 u8 general_settings;
38 u8 sr_state;
39 u8 srf1[WL1271_INI_MAX_SMART_REFLEX_PARAM];
40 u8 srf2[WL1271_INI_MAX_SMART_REFLEX_PARAM];
41 u8 srf3[WL1271_INI_MAX_SMART_REFLEX_PARAM];
42} __attribute__ ((packed));
43
44#define WL1271_INI_RSSI_PROCESS_COMPENS_SIZE 15
45
46struct wl1271_ini_band_params_2 {
47 u8 rx_trace_insertion_loss;
48 u8 tx_trace_loss;
49 u8 rx_rssi_process_compens[WL1271_INI_RSSI_PROCESS_COMPENS_SIZE];
50} __attribute__ ((packed));
51
52#define WL1271_INI_RATE_GROUP_COUNT 6
53#define WL1271_INI_CHANNEL_COUNT_2 14
54
55struct wl1271_ini_fem_params_2 {
56 __le16 tx_bip_ref_pd_voltage;
57 u8 tx_bip_ref_power;
58 u8 tx_bip_ref_offset;
59 u8 tx_per_rate_pwr_limits_normal[WL1271_INI_RATE_GROUP_COUNT];
60 u8 tx_per_rate_pwr_limits_degraded[WL1271_INI_RATE_GROUP_COUNT];
61 u8 tx_per_rate_pwr_limits_extreme[WL1271_INI_RATE_GROUP_COUNT];
62 u8 tx_per_chan_pwr_limits_11b[WL1271_INI_CHANNEL_COUNT_2];
63 u8 tx_per_chan_pwr_limits_ofdm[WL1271_INI_CHANNEL_COUNT_2];
64 u8 tx_pd_vs_rate_offsets[WL1271_INI_RATE_GROUP_COUNT];
65 u8 tx_ibias[WL1271_INI_RATE_GROUP_COUNT];
66 u8 rx_fem_insertion_loss;
67 u8 degraded_low_to_normal_thr;
68 u8 normal_to_degraded_high_thr;
69} __attribute__ ((packed));
70
71#define WL1271_INI_CHANNEL_COUNT_5 35
72#define WL1271_INI_SUB_BAND_COUNT_5 7
73
74struct wl1271_ini_band_params_5 {
75 u8 rx_trace_insertion_loss[WL1271_INI_SUB_BAND_COUNT_5];
76 u8 tx_trace_loss[WL1271_INI_SUB_BAND_COUNT_5];
77 u8 rx_rssi_process_compens[WL1271_INI_RSSI_PROCESS_COMPENS_SIZE];
78} __attribute__ ((packed));
79
80struct wl1271_ini_fem_params_5 {
81 __le16 tx_bip_ref_pd_voltage[WL1271_INI_SUB_BAND_COUNT_5];
82 u8 tx_bip_ref_power[WL1271_INI_SUB_BAND_COUNT_5];
83 u8 tx_bip_ref_offset[WL1271_INI_SUB_BAND_COUNT_5];
84 u8 tx_per_rate_pwr_limits_normal[WL1271_INI_RATE_GROUP_COUNT];
85 u8 tx_per_rate_pwr_limits_degraded[WL1271_INI_RATE_GROUP_COUNT];
86 u8 tx_per_rate_pwr_limits_extreme[WL1271_INI_RATE_GROUP_COUNT];
87 u8 tx_per_chan_pwr_limits_ofdm[WL1271_INI_CHANNEL_COUNT_5];
88 u8 tx_pd_vs_rate_offsets[WL1271_INI_RATE_GROUP_COUNT];
89 u8 tx_ibias[WL1271_INI_RATE_GROUP_COUNT];
90 u8 rx_fem_insertion_loss[WL1271_INI_SUB_BAND_COUNT_5];
91 u8 degraded_low_to_normal_thr;
92 u8 normal_to_degraded_high_thr;
93} __attribute__ ((packed));
94
95
96/* NVS data structure */
97#define WL1271_INI_NVS_SECTION_SIZE 468
98#define WL1271_INI_SPARE_SIZE 124
99#define WL1271_INI_FEM_MODULE_COUNT 2
100
101struct wl1271_nvs_file {
102 /* NVS section */
103 u8 nvs[WL1271_INI_NVS_SECTION_SIZE];
104
105 /* INI section */
106 struct wl1271_ini_general_params general_params;
107 u8 padding1;
108 struct wl1271_ini_band_params_2 stat_radio_params_2;
109 u8 padding2;
110 struct {
111 struct wl1271_ini_fem_params_2 params;
112 u8 padding;
113 } dyn_radio_params_2[WL1271_INI_FEM_MODULE_COUNT];
114
115 u8 ini_spare[WL1271_INI_SPARE_SIZE];
116} __attribute__ ((packed));
117
118#endif